Solutions to CS 1050A Problem Set 5: Big O Notation and Number Theory, Assignments of Computer Science

Solutions to problem set 5 of the cs 1050a: constructing proofs course. It includes proofs for the relationships between big o notation, divisibility, and the greatest common divisor (gcd). The document also covers the euclidean algorithm for finding the gcd and the extended euclidean algorithm for finding the bezout coefficients.

Typology: Assignments

Pre 2010

Uploaded on 08/04/2009

koofers-user-523
koofers-user-523 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 1050A: Constructing Proofs
Solutions to Problem Set 5
Problem 1
1. f(n) is O(g(n)) and h(n) is O(g(n))
f(n)c1·g(n)n>N1and h(n)c2·g(n)n>N2
f(n) + h(n)(c1+c2)·g(n)n > max(N1, N2)
(f(n) + h(n) is O(g(n)).
2. f(n) is O(g(n)) and h(n) is O(g(n))
f(n)c1·g(n)n>N1and h(n)c2·g(n)n>N2
f(n)·h(n)(c1·c2)·g(n)2n > max(N1, N2)
(f(n)·h(n) is O(g(n)2).
Problem 2
1. a|cand b|d
c=x1·aand d=x2·bfor some x1, x2Z
c·d=x1x2ab ab|cd
2. Let gcd(a, b) = g1and gcd(c, d) = g2
g1|aand a|cg1|c
g1|band b|dg1|d
g2=s·c+t·dfor some s, t, Z
g1|g2
Problem 3
1. Set of Divisors of 150 = {1,2,3,5,6,10,15,25,30,50,75,150}
Set of Divisors of 42 = {1,2,3,6,7,14,21,42}
Therefore, gcd(150,42) = 6
2. 150 = 21·31·52
42 = 21·31·71
Therefore gcd(150,42) = 2min(1,1) ·3min(1,1) ·5min(2,0) ·7min(0,1) = 6
3. 150 = 3 ·42 + 24
42 = 1 ·24 + 18
24 = 1 ·18 + 6
18 = 3 ·6+0
Therefore gcd(150,42) = 6
24 = 150 3(42)
18 = 42 24 = 42 150 + 3(42) = 4(42) 150
6 = 24 18 = 150 3(42) 4(42) + 150 = 2(150) + (7)42
Therefore s= 2 and t=7
1
pf2

Partial preview of the text

Download Solutions to CS 1050A Problem Set 5: Big O Notation and Number Theory and more Assignments Computer Science in PDF only on Docsity!

CS 1050A: Constructing Proofs

Solutions to Problem Set 5

Problem 1

  1. f (n) is O(g(n)) and h(n) is O(g(n)) ⇒ f (n) ≤ c 1 · g(n) ∀ n > N 1 and h(n) ≤ c 2 · g(n) ∀ n > N 2 ⇒ f (n) + h(n) ≤ (c 1 + c 2 ) · g(n) ∀ n > max(N 1 , N 2 ) ⇒ (f (n) + h(n) is O(g(n)).
  2. f (n) is O(g(n)) and h(n) is O(g(n)) ⇒ f (n) ≤ c 1 · g(n) ∀ n > N 1 and h(n) ≤ c 2 · g(n) ∀ n > N 2 ⇒ f (n) · h(n) ≤ (c 1 · c 2 ) · g(n)^2 ∀ n > max(N 1 , N 2 ) ⇒ (f (n) · h(n) is O(g(n)^2 ).

Problem 2

  1. a|c and b|d ⇒ c = x 1 · a and d = x 2 · b for some x 1 , x 2 ∈ Z ⇒ c · d = x 1 x 2 ab ⇒ ab|cd
  2. Let gcd(a, b) = g 1 and gcd(c, d) = g 2 g 1 |a and a|c ⇒ g 1 |c g 1 |b and b|d ⇒ g 1 |d g 2 = s · c + t · d for some s, t, ∈ Z ⇒ g 1 |g 2

Problem 3

  1. Set of Divisors of 150 = { 1 , 2 , 3 , 5 , 6 , 10 , 15 , 25 , 30 , 50 , 75 , 150 } Set of Divisors of 42 = { 1 , 2 , 3 , 6 , 7 , 14 , 21 , 42 } Therefore, gcd(150, 42) = 6
  2. 150 = 2^1 · 31 · 52 42 = 2^1 · 31 · 71 Therefore gcd(150, 42) = 2min(1,1)^ · 3 min(1,1)^ · 5 min(2,0)^ · 7 min(0,1)^ = 6
  3. 150 = 3 · 42 + 24 42 = 1 · 24 + 18 24 = 1 · 18 + 6 18 = 3 · 6 + 0 Therefore gcd(150, 42) = 6 24 = 150 − 3(42) 18 = 42 − 24 = 42 − 150 + 3(42) = 4(42) − 150 6 = 24 − 18 = 150 − 3(42) − 4(42) + 150 = 2(150) + (−7) Therefore s = 2 and t = − 7

Problem 4

a ≡ b(modn) ⇒ n|(a − b) ⇒ a − b = x 1 · n for some x 1 ∈ Z b ≡ c(modn) ⇒ n|(b − c) ⇒ b − c = x 2 · n for some x 2 ∈ Z ⇒ a − c = (a − b) + (b − c) = x 1 · n + x 2 · n = (x 1 + x 2 ) · n ⇒ n|(a − c) ⇒ a ≡ c(modn)

Problem 5

1. 6 = 2^1 · 31

9 = 3^2

lcm(6, 9) = 2max(1,0)^ · 3 max(1,2)^ = 18

60 = 2^2 · 31 · 51

18 = 2^1 · 32

lcm(60, 18) = 2max(2,1)^ · 3 max(1,2)^ · 5 max(1,0)^ = 180

  1. Prime factorization of lcm(a, b) is as follows: lcm(a, b) = Πki=1pimax(si,ti)

LHS = a · b = Πki=1pisi+ti

RHS = lcm(a, b) · gcd(a, b) = Πki=1pimax(si,ti)+min(si,ti)

Consider 2 cases: Case 1 - si < ti ⇒ max(si, ti) = ti min(si, ti) = si ⇒ RHS = Πki=1piti+si Therefore, LHS = RHS Case 2 - si ≥ ti ⇒ max(si, ti) = si min(si, ti) = ti ⇒ RHS = Πki=1pisi+ti Therefore, LHS = RHS