Solution to Assignment 3 - Mathematical and Statistical Sciences

Cmput 272 Winter 2005
Assignment 3 Solutions
Posted: Wed, Feb 9
Due: Wed, Mar 23 / Thurs, Mar 24 at beginning of class
Reading: Chapters 4.1, 4.2, 4.3, 4.4, 4.5
Department of Computing Science
University of Alberta
Question 1. [Exercises 4.1 # 2(c)]
Show that
1 · 1! + 2 · 2! + 3 · 3! + · · · + n · n! = (n + 1)! − 1
(∗)
for all n ≥ 1,
(a) using the Principle of Mathematical Induction,
(b) using a combinatorial argument.
Solution:
(a) Base Case: Let n = 1, then
1 · 1! = 1 = (1 + 1)! − 1
and (∗) is true for n = 1.
Inductive Step: Let n ≥ 1 be an abritrary positive integer and assume the (∗) is true for n, then from
the inductive hypothesis we have
1 · 1! + 2 · 2! + 3 · 3! + · · · + n · n! + (n + 1) · (n + 1)!
= (n + 1)! − 1 + (n + 1) · (n + 1)!
= (n + 1)! · [1 + (n + 1)] − 1
= (n + 1)! · (n + 2) − 1
= (n + 2)! − 1
and (∗) is true for n + 1 also.
Therefore, by the Principle of Mathematical Induction, (∗) is true for all integers n ≥ 1.
(b) It is not difficult to see using the well-ordering property of the positive integers and the division
algorithm that every positive integer N ∈ N can be written uniquely as a sum of the form
N = a1 · 1! + a2 · 2! + a3 · 3! + · · · + an · n!
where the ai ’s are integers satisfying 0 ≤ ai ≤ i for i = 1, 2, . . . , n.
If N > 0, from the well-ordering property, there is a unique positive integer n such that
n! ≤ N < (n + 1)!,
now we use the division algorithm to divide N by n!, and the quotient is an , the remainder is then
divided by (n − 1)! and the quotient is an−1 , etc.
This representation of a nonnegative integer N is called the factorial representation of N and the
ai ’s are called the factorial digits of N.
Using this representation, the largest n “digit” number is
1 · 1! + 2 · 2! + 3 · 3! + · · · + n · n!
and the smallest n + 1 “digit” number is
0 · 1! + 0 · 2! + 0 · 3! + · · · + 0 · n! + 1 · (n + 1)!
and therefore 1 · 1! + 2 · 2! + 3 · 3! + · · · + n · n! must equal (n + 1)! − 1.
Question 2. [Exercises 4.1]
For which positive integers n is it true that
3n2 + 2n < n3 ?
(∗∗)
You must prove your conjecture using the Principle of Mathematical Induction.
Solution: From the following table,
n
1
2
3
4
5
3n2 + 2n
5
16
33
56
85
n3
1
8
27
64
125
it appears that 3n2 + 2n < n3 for all integers n ≥ 4, and we prove this by induction.
Base Case: If n = 4, then
3 · 42 + 2 · 4 = 48 + 8 = 56 < 64 = 43 ,
and (∗∗) is true for n = 4.
Inductive Step: Let n ≥ 4 be an arbitrary integer and assume that (∗∗) is true for n.
Now, since n ≥ 4, then
n(n − 1) ≥ 4 · 3 = 12 >
4
,
3
so that
3n2 − 3n > 4
for all n ≥ 4, and this implies that
3n2 + 3n + 1 > 6n + 5
for all n ≥ 4.
From the inductive hypothesis we have
3(n + 1)2 + 2(n + 1) = 3n2 + 2n + 6n + 5 < n3 + 6n + 5 < n3 + 3n2 + 3n + 1 = (n + 1)3
and (∗∗) is also true for n + 1.
Therefore, by the Principle of Mathematical Induction, (∗∗) is true for all integers n ≥ 4.
Question 3. [Exercises 4.1 # 18]
Consider the following four equations
1=1
2+3+4=1+8
5 + 6 + 7 + 8 + 9 = 8 + 27
10 + 11 + 12 + 13 + 14 + 15 + 16 = 27 + 64
Conjecture the general formula suggested by these four equations, and prove your conjecture.
Solution: The left hand side of the nth equation appears to be the sum of the positive integers from
(n − 1)2 + 1 to n2 for n = 1, 2, 3, 4, and if the pattern continues in this way, then the leftt hand side of the
equations is equal to
n2
X
k
k=(n−1)2 +1
for n = 1, 2, 3, 4, . . . .
On the other hand, the right hand side of the nth equation appears to be just (n − 1)3 + n3 , so the conjecture
is that
2
n
X
k=(n−1)2 +1
k = (n − 1)3 + n3
(∗ ∗ ∗)
for all integers n ≥ 1.
We can prove this using the Principle of Matematical Induction, or we can use the identity we proved in
class, namely,
N
X
N (N + 1)
k=
2
k=1
for all positive integers N. We have,
2
n
X
(n−1)2
2
k=
k=(n−1)2 +1
n
X
k=1
k−
X
k
k=1
1 2 2
n (n + 1) − (n − 1)2 ((n − 1)2 + 1)
2
= 2n3 − 3n2 + 3n − 1
=
= n3 − 3n2 + 3n − 1 + n3
= (n − 1)3 + n3
for all n ≥ 1.
Question 4. [Exercises 4.1 # 24 ]
A sequence of numbers a1 , a2 , a3 , . . . is defined by
a1 = 1,
a2 = 2,
an = an−1 + an−2 ,
n ≥ 3.
(a) Determine the values of a3 , a4 , a5 , a6 , and a7 .
n
(b) Prove that for all n ≥ 4, an > 2 2 .
Solution:
(a) Using the initial values a1 = 1 and a2 = 2, and the recurrence relation, we have
a3 = a 2 + a 1 = 2 + 1 = 3
a4 = a 3 + a 2 = 3 + 2 = 5
a5 = a 4 + a 3 = 5 + 3 = 8
a6 = a5 + a4 = 8 + 5 = 13
a7 = a6 + a5 = 13 + 8 = 21
and it appears that an = Fn+1 for all n ≥ 1.
(b) We will show that
n
(∗ ∗ ∗∗)
an > 2 2
for all n ≥ 4 using the Principle of Strong Mathematical Induction.
Base Case: For n = 4 we have
4
a4 = 5 > 4 = 2 2 ,
and (∗ ∗ ∗∗) is true for n = 4.
Also, for n = 5 we have
5
a5 = 8 > 2 2 ,
since 82 = 64 > 32 = 25 , and (∗ ∗ ∗∗) is true for n = 5.
Inductive Step: Let n ≥ 4 be an arbitrary integer and suppose that (∗ ∗ ∗∗) is true for all integers k
with 4 ≤ k ≤ n, we will show that this implies that (∗ ∗ ∗∗) is true for n + 1 also.
Note that if n = 4 then n + 1 = 5, and (∗ ∗ ∗∗) is true in this case; while if n ≥ 5, then n − 1 ≥ 4, and
from the recurrence relation and the inductive hypothesis we have
an+1 = an + an−1
n
> 22 +2
=2
n−1
2
>2·2
=2
=2
and (∗ ∗ ∗∗) is true for n + 1 also.
n−1
2
1
(2 2 + 1)
n−1
2
n−1
2 +1
n+1
2
Therefore, by the Principle of Mathematical Induction, (∗ ∗ ∗∗) is true for all positive integers n ≥ 4.
Question 5. [Exercises 4.2]
Let an be the number of strings of length n from the alphabet Σ = { 0, 1, 2 } with no consecutive 0’s.
(a) Find a1 , a2 , a3 , a4 .
(b) Give a simple counting argument to show that
an = 2an−1 + 2an−2
for all n ≥ 3.
(c) Use the Principle of Mathematical Induction to show that
√ n+2
√ n+2 1 − 1− 3
1+ 3
an = √
4 3
for all n ≥ 0.
Solutions:
(a) For n = 1, every string of length 1 from the alphabet Σ = { 0, 1, 2 } contains no consecutive 0’s, and
therefore a1 = 3.
For n = 2, the total number of strings of length 2 is 32 , and there is only one string with consecutive
0’s, namely 0 0, and therefore, a2 = 32 − 1 = 8.
For n = 3, there are only 5 strings of length 3 that contain consecutive 0’s, namely,
0 0 0 1 0 0 2 0 0 0 0 1 0 0 2,
and the total number of strings of length 3 from the alphabet Σ = { 0, 1, 2 } is 33 , and therefore
a3 = 33 − 5 = 22.
For n = 4, given a string of length 4 from the alphabet Σ = { 0, 1, 2 } with no consecutive 0’s, it either
starts with a 0, a 1, or a 2.
If it starts with a 0, the second element of the string must be either a 1 or a 2, and so there are
2a2 strings of length 4 with no consecutive 0’s that start with a 0.
If it starts with a 1, then there are a3 strings of length 4 with no consecutive 0’s that start with
a 1.
If it starts with a 2, then there are a3 strings of length 4 with no consecutive 0’s that start with
a 2.
Since this accounts for all strings of length 4 with no consecutive 0’s, and since these cases are mutually
exclusive, from the rule of sum we have
a4 = 2a2 + 2a3 = 2 · 8 + 2 · 22 = 60.
(b) We can use the method we used to determine a4 to find a recurrence relation satisfied by an for all
n ≥ 3. Any string of length n with no consecutive 0’s from the alphabet Σ = { 0, 1, 2 } either starts
with a 0, a 1, or a 2. Reasoning as above, there are 2an−2 that start with a 0, an−1 that start with a 1,
and an−1 that start with a 2. This accounts for all such strings of length n, and from the rule of sum,
an = 2an−1 + 2an−2
for all n ≥ 3.
(c) If we want the formula (∗ ∗ ∗ ∗ ∗) below to hold for all n ≥ 0, we need to define a 0 , and we do this using
the recurrence relation and the values of a1 and a2 . We want
8 = a2 = 2a1 + 2a0 = 6 + 2a0 ,
so that we should define a0 = 1. This makes sense, since there is only one string of length 0, namely,
the empty string, and it has no consecutive 0’s.
Now the recurrence relation
an+2 = 2an+1 + 2an
holds for all n ≥ 0, and we will use this to show by the Principle of Strong Mathematical Induction
that
√ n+2 √ n+2
1 1+ 3
an = √
− 1− 3
(∗ ∗ ∗ ∗ ∗)
4 3
is true for all n ≥ 0.
Base Case: For n = 0, we have
√ i
√ 2 √
√ 2
1 h
1 √
1+ 3 − 1− 3
= √ 4 + 2 3 − 4 − 2 3 = 1 = a0
4 3
4 3
and (∗ ∗ ∗ ∗ ∗) holds for n = 0.
Inductive Step: Let n ≥ 0 be arbitrary and assume that (∗∗∗∗∗) holds for all integers k with 0 ≤ k ≤ n,
then from the recurrence relation we have
an+1 = 2an + 2an−1
√ n+2 √ n+1 √ n+2
√ n+1
1 1 = √
1+ 3
+ √
1+ 3
− 1− 3
− 1− 3
2 3
2 3
√ n+2 √ n+2 √ n+1
√ n+1
1 1 1+ 3
− √
1− 3
= √
+ 1+ 3
+ 1− 3
2 3
2 3
√ n+1
√ n+1
√ √ 1 1 = √
2+ 3 1+ 3
− √
2− 3 1− 3
2 3
2 3
"
#
"
#
√
√
√ n+1
√ n+1
1
1
(1 + 3)2 (1 − 3)2 = √
1+ 3
− √
1− 3
,
2
2
2 3
2 3
since
(1 +
√ 2
√
3) = 2(2 + 3)
so that
an+1
and
(1 −
√
3)2 = 2(2 −
√
3),
√ n+3
√ n+3 1 − 1− 3
= √
1+ 3
,
4 3
and (∗ ∗ ∗ ∗ ∗) also holds for n + 1.
Therefore, (∗ ∗ ∗ ∗ ∗) holds for all integers n ≥ 0 by the Principle of Strong Mathematical Induction.
Question 6. [Exercises 4.3]
If n ∈ Z+ is odd, show that n(n2 − 1) is divisible by 12.
Solution: If n is an odd positive integer, then
n(n2 − 1) = n(n − 1)(n + 1),
and since n is odd, then n − 1 and n + 1 are both even, so that n(n2 − 1) is divisible by 4.
We will show that given any three consecutive integers, one of them must be divisible by 3.
(i) If 3 n, then we are done.
(ii) If n leaves
a remainder of 1 when divided by 3, then n = 3k + 1 for some integer k, so that n − 1 = 3k
and 3 n − 1.
(iii) If n leaves a remainder of 2 when divided by 3, then n = 3k + 2 for some integer k, and n + 1 = 3(k + 1)
so that 3 n + 1.
Therefore, n(n2 − 1) is divisible by 4, and is divisible by 3 also, and since gcd(3, 4) = 1, then n(n2 − 1) is
divisible by 12.
Question 7. [Exercises 4.3]
Let a, b, and c be positive integers such that
c2 = a 2 + b 2 ,
where a, b, and c have no common divisors. Show that exactly one of a, b, or c is divisible by 5.
Solution: If the positive integers a, b, and c have no common divisors, then at most one of them can be
divisible by 5.
Suppose that neither a nor b is divisible by 5, then a2 and b2 must be congruent to 1 or 4 modulo 5. This
means that a2 + b2 must be congruent to
1 + 1 ≡ 2 (mod 5)
1 + 4 ≡ 0 (mod 5)
4 + 1 ≡ 0 (mod 5)
4 + 4 ≡ 3 (mod 5)
and since a2 + b2 = c2 is a perfect square, we cannot have c2 ≡ 2 (mod 5) or c2 ≡ 3 (mod 5), and therefore
c2 ≡ 0 (mod 5). Since 5 is a prime, this implies that c ≡ 0 (mod 5), and therefore, if neither a nor b is divisible
by 5, then c must be divisible by 5.
Question 8. [Exercises 4.3 # 28]
Let n be a fixed positive integer and define the set Xn ⊆ Z+ recursively as follows:
(i) n ∈ Xn , and
(ii) if a, b ∈ Xn then a + b ∈ Xn .
Prove that Xn = { n · k k ∈ Z+ }, that is, Xn is the set of all positive integers divisible by n.
Solution: Let
A = { n · k k ∈ Z+ },
first we use the Principle of Mathematical Induction to show that A ⊆ Xn .
Base Case: If k = 1, then n · 1 = n ∈ Xn from (i).
Inductive Step: Now suppose that k ≥ 1 is arbitrary and that n · k ∈ Xn , then from (i) and (ii) we have
n · (k + 1) = n · k + n · 1 = n · k + n ∈ Xn .
Therefore, by the Principle of Mathematical Induction, n · k ∈ Xn for all positive integers k, that is, A ⊆ Xn .
Now suppose that A $ Xn , then there exists an integer a ∈ Xn such that a 6∈ A, and by the well-ordering
property for the positive integers, there exists a smallest integer a0 such that a0 ∈ Xn but a0 6∈ A.
From the recursive definition of Xn , the only way that a0 can be in the set Xn is if there exist positive
integers b0 and c0 in Xn such that a0 = b0 + c0 . Note that since c0 > 0, this implies that b0 < a0 and
similarly, b0 > 0 implies that c0 < a0 .
Since a0 is the smallest positive integer such that a0 ∈ Xn but a0 6∈ A, then we have b0 ∈ A and c0 ∈ A, so
there exist positive integers k and ` such that b0 = n · k and c0 = n · `. However, this implies that
a0 = b0 + c0 = n · k + n · ` = n · (k + `),
that is, a0 ∈ A, which is a contradiction. Therefore A = Xn .
Question 9. [Exercises 4.4]
For which positive integers n is
n n
n n
?
3
2
Again, you must prove your conjecture using the Principle of Mathematical Induction.
Solution: We show that
n n
< n! <
< n! <
n n
3
2
for all positive integers n ≥ 6 using the Principle of Mathematical Induction.
Base Case: For n = 6,
n n
= 26 = 64
n n
= 36 = 729
3
2
while n! = 6! = 720, so that 26 < 6! < 36 , and the result is true for n = 6.
and
Inductive Step: Assuming that the result is true for some n ≥ 6, then it suffices to show that
n+1
n+1
n+1
n+1
3
2
n n
n n
<n+1<
,
3
2
since then the inequatity
n n
n n
< n! <
3
2
implies that
n+1
n+1
n+1
n+1
< (n + 1)! <
3
2
which is precisely what we want to show.
The inequality (†) is equivalent to the inequality
n
1
< 3,
2 < 1+
n
which is true for all n ≥ 1. This follows easily from the fact that the function
1
log(1 + x), x > 0
x
is strictly monotone decreasing on the interval (0, ∞) so that the sequence
n
1
, n≥1
an = 1 +
n
f (x) =
is strictly increasing and a1 = 2, while lim an = e < 3.
n→∞
Alternatively, the proof of (††) follows directly from the binomial theorem. For example, we have
n X
n k
n
n = nn + n · nk−1 + · · · > nn + nn = 2nn ,
(n + 1) =
k
k=0
so that
2<
1
1+
n
n
.
For the other part of the inequality, we note that
n
X
1
1
1
1
=1+1+
+
+···+
k!
1·2 1·2·3
1 · 2 · 3···n
k=0
<1+1+
1
1
1
1
+
+ 3 + · · · + n−1
2 22
2
2
1 − 1/2n
1 − 1/2
1
=1+2 1− n
2
=1+
< 1 + 2 = 3,
so that
n
P
1
< 3.
k!
k=0
(†)
(††)
Now, from the binomial theorem,
n
1
1
1
1
2
1
1
2
n−1
1
1+
1−
+
1−
1−
+···+
1−
1−
··· 1−
=1+1+
n
2!
n
3!
n
n
n!
n
n
n
<1+1+
1
1
1
+ +···+
2! 3!
n!
< 3,
so that
1+
1
n
n
< 3.
Therefore, by the Principle of Mathematical Induction, the result is true for all n ≥ 6, and so
√
n
n
n
< n! <
3
2
for all n ≥ 6.
Question 10. [Exercises 4.4 # 10]
If the positive integers a and b are relatively prime, prove that

1
if a and b have opposite parity,
gcd(a − b, a + b) =
2
if a and b are both odd.
Solution: If a and b are relatively prime then there exist integers x and y such that ax + by = 1, so that
2ax + 2by = 2.
If d is a positive common divisor of a − b and a + b then d a − b and d a + b, so that
d 2a
and
d 2b,
and therefore, d 2, that is, d = 1 or d = 2.
If a and b have opposite parity, say a is even and b is odd, the a − b and a + b are both odd, so that
gcd(a − b, a + b) = 1.
If a and b are both odd, then a − b and a + b are both even, so that gcd(a − b, a + b) = 2.
Question 11. [Exercises 4.4 #18]
(a) If a, b, c ∈ Z+ , show that the linear diophantine equation
ax + by = c
has a solution x = x0 , y = y0 if and only if gcd(a, b) c.
(b) Show that for a, b ∈ Z+ ,
a · b = lcm(a, b) · gcd(a, b).
Solution:
(a) If x = x0 , y = y0 is a solution to this linear diophantine equation, then
ax0 + by0 = c,
and if d is any positive common divisor of a and b, then d c, so that gcd(a, b) c.
Conversely, if d = gcd(a, b) and d c, then c = k · d. From the Euclidean algorithm, there exist integers
x1 and y1 such that
d = ax1 + by1 ,
so that
c = k · d = k · ax1 + k · by1 = a(kx1 ) + b(ky1 ),
and x0 = kx1 , y0 = ky1 is a solution to the linear diophantine equation. Note that this tells us how to
find a solution!
(b) From the Fundamental Theorem of Arithmetic, if a > 1 and b > 1 are positive integers, we can write
their prime power factorizations as
αk
α2
1
a = pα
1 · p2 · · · pk
b = pβ1 1 · pβ2 2 · · · pβk k
where p1 , p2 , . . . , pk are distinct primes, with αi ≥ 0, and βi ≥ 0, for i = 1, 2, . . . , k.
Now, the greatest common divisor and least common multiple of a and b are given by
min{α1 ,β1 }
gcd(a, b) = p1
max{α1 ,β1 }
lcm(a, b) = p1
min{α2 ,β2 }
· p2
max{α2 ,β2 }
· p2
min{αk ,βk }
· · · pk
max{αk ,βk }
· · · pk
and therefore,
min{α1 ,β1 }+max{α1 ,β1 }
gcd(a, b) · lcm(a, b) = p1
min{α2 ,β2 }+max{α2 ,β2 }
· p2
min{αk ,βk }+max{αk ,βk }
· · · pk
and since
min{αi , βi } + max{αi , βi } = αi + βi
for all i = 1, 2, . . . k, then
2 +β2
k +βk
gcd(a, b) · lcm(a, b) = p1α1 +β1 · pα
· · · pα
,
2
k
that is,
β1
β2
βk
α2
αk
1
gcd(a, b) · lcm(a, b) = pα
1 · p2 · · · pk · p1 · p2 · · · pk = a · b
Question 12. [Exercises 4.5 # 12]
Let a ∈ Z+ . Find the smallest value of a for which 2a is a perfect square and 3a is a perfect cube.
Solution: The smallest value of such an a will occur if the only prime divisors of a are 2 and 3, so we may
assume that
a = 2 α 3β
for some positive integers α and β.
Since
2a = 2α+1 3β
and
3a = 2α 3β+1 ,
and we want 2a to be a perfect square, then we need α + 1 and β to be even integers, and since we want 3a
to be a perfect cube, then we want α and β + 1 to be multiples of 3. This will happen if we take α = 3 and
β = 2, and in this case
a = 23 32 = 8 · 9 = 72
is the smallest positive integer for which 2a = 122 is a perfect square and 3a = 63 is a perfect cube.
Question 13. [Exercises 4.5 # 26]
When does a positive integer n have exactly
(a) two positive divisors?
(b) three positive divisors?
(c) four positive divisors?
(d) five positive divisors?
Solution: As in class, we use the notation τ (n) to denote the number of positive divisors of the positive
integer n, and if the prime power factorization of n is given by
αk
α2
1
n = pα
1 · p2 · · · pk ,
then
τ (n) = (α1 + 1)(α2 + 1) · · · (αk + 1).
(a) A positive integer n has exactly two positive divisors if and only if τ (n) = 2, and this is the case if and
only if n is a prime.
(b) A positive integer n has exactly three positive divisors if and only if τ (n) = 3, and this is the case if
and only if n = p2 , where p is a prime.
(c) A positive integer n has exactly four positive divisors if and only if τ (n) = 4, and this is the case if
and only if
(i) n = p3 , where p is a prime, or
(ii) n = p · q, where p and q are distinct primes.
These two cases correspond to the only two ways to factor τ (n) = 4, as 2 · 2 in (i) and as 1 · 4 in (ii).
(d) A positive integer n has exactly five positive divisors if and only if τ (n) = 5, and this is the case if and
only if n = p4 , where p is a prime. This follows, since τ (n) = 5 is prime.