Solutions to Mathematical Problems, Exams of Discrete Structures and Graph Theory

Solutions to various mathematical problems, including proofs by the chinese remainder theorem, fermat's little theorem, and the binomial theorem. The problems cover topics such as equivalence relations, carmichael numbers, sums of consecutive integers, and probabilities.

Typology: Exams

Pre 2010

Uploaded on 08/31/2009

koofers-user-fba
koofers-user-fba 🇺🇸

9 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS280, Spring 2004: Final
1. [4 points] Which of the following relations on {0,1,2,3}is an equivalence relation. (If it is,
explain why. If it isn’t, explain why not.) Just saying “Yes” or “No” with no explanation
gets 0 points. The explanations can be very short though.)
(a) {(0,0,),(1,1),(2,2),(3,3)}
(b) {(0,0),(0,1),(1,0),(1,1)}.
Solution: (a) is an equivalence relation, since it is reflexive, symmetric, and transitive.
(b) is not an equivalence relation, since it is not reflexive; neither (2,2) nor (3,3) are in
the relation. (It is symmetric and transitive; you got one point if you said that, even if
you didn’t get the right answer.)
Grading: Basically, 1 point for the correct answer and 1 point for the reason. For (b), 1
point was given for the wrong answer if you said it was symmetric and transitive.
2. [5 points] Recall that a composite nis a Carmichael number if for any brelatively prime to
n,bn11 (mod n). Show that 1105 is a Carmichael number. [Hint: 1105 = 5 ·13 ·17.]
Solution: We want to show that if b is relatively prime to 1105, then b1104 1
(mod 1105). By the Chinese Remainder Theorem, it suffices to show that b1104 1
(mod 5), b1104 1 (mod 13), and b1104 1 (mod 17). By Fermat’s Little Theorem,
ap11 (mod p) if ais relatively prime to p. By assumption, bis relatively prime
to 1105, so bis also relatively prime to 5, 13, and 17. Thus b41 (mod 5), b12 1
(mod 13), and b16 1 (mod 17). Thus, b4n1 (mod 5) for all n; similarly b12n1
(mod 13) and b16n1 (mod 17) for all n. Since 4, 12, and 16 all divide 1104 evenly, it
follows that b1104 1 (mod 5), b1104 1 (mod 13), and b1104 1 (mod 17).
Grading: You lost one point if you didn’t explicitly state that since bis relatively prime
to 1105, it is relatively prime to each of 5, 13, and 17. You also lost one point if you
didn’t justify the fact that bp11 (mod p) for each of p= 5,13,17 (i.e., you had to
mention Fermat’s Little Theorem). You also lost one point for not mentioning the Chinese
Remainder Theorem.
3. [4 points] Consider any six natural numbers n1, . . . , n6. Show that the sum of some
subsequence of consecutive numbers is divisible by 6 (e.g., perhaps n3+n4+n5is divisible
by 6, or n4itself is divisible by 6, or n2+n3is divisible by 6). [Hint: Look at the sums
0, n1,n1+n2,n1+n2+n3, . . . , n1+n2+·· · +n6, and think in terms of mod 6.]
Solution: Following the hint, consider each of the sums 0, n1,n1+n2,n1+n2+n3,
. . . , n1+n2+· ·· +n6mod 6. If any of them is 0 mod 6, we’re done (since that sum is
divisible by 6). By the pigeonhole principle, two of the sums must be the same mod 6.
(The “pigeons” are the sums, the “holes” are 1, . . . , 5, since all the sums must be in the
range 1, . . . , 5 mod 6.) If two sums are the same mod 6, their difference must be 0 mod
6, hence must be divisible by 6. But the difference between two such sequences is a sum
of consecutive integers. (The difference between n1+·· · +nkand n1+· ·· +nm(where
k > m), is nm+1 +· · · +nk.) Thus, this sum of consecutive integers is divisible by 6.
1
pf3
pf4
pf5

Partial preview of the text

Download Solutions to Mathematical Problems and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

CS280, Spring 2004: Final

  1. [4 points] Which of the following relations on { 0 , 1 , 2 , 3 } is an equivalence relation. (If it is, explain why. If it isn’t, explain why not.) Just saying “Yes” or “No” with no explanation gets 0 points. The explanations can be very short though.)

(a) {(0, 0 , ), (1, 1), (2, 2), (3, 3)} (b) {(0, 0), (0, 1), (1, 0), (1, 1)}. Solution: (a) is an equivalence relation, since it is reflexive, symmetric, and transitive. (b) is not an equivalence relation, since it is not reflexive; neither (2,2) nor (3,3) are in the relation. (It is symmetric and transitive; you got one point if you said that, even if you didn’t get the right answer.) Grading: Basically, 1 point for the correct answer and 1 point for the reason. For (b), 1 point was given for the wrong answer if you said it was symmetric and transitive.

  1. [5 points] Recall that a composite n is a Carmichael number if for any b relatively prime to n, bn−^1 ≡ 1 (mod n). Show that 1105 is a Carmichael number. [Hint: 1105 = 5 · 13 · 17.] Solution: We want to show that if b is relatively prime to 1105, then b^1104 ≡ 1 (mod 1105). By the Chinese Remainder Theorem, it suffices to show that b^1104 ≡ 1 (mod 5), b^1104 ≡ 1 (mod 13), and b^1104 ≡ 1 (mod 17). By Fermat’s Little Theorem, ap−^1 ≡ 1 (mod p) if a is relatively prime to p. By assumption, b is relatively prime to 1105, so b is also relatively prime to 5, 13, and 17. Thus b^4 ≡ 1 (mod 5), b^12 ≡ 1 (mod 13), and b^16 ≡ 1 (mod 17). Thus, b^4 n^ ≡ 1 (mod 5) for all n; similarly b^12 n^ ≡ 1 (mod 13) and b^16 n^ ≡ 1 (mod 17) for all n. Since 4, 12, and 16 all divide 1104 evenly, it follows that b^1104 ≡ 1 (mod 5), b^1104 ≡ 1 (mod 13), and b^1104 ≡ 1 (mod 17). Grading: You lost one point if you didn’t explicitly state that since b is relatively prime to 1105, it is relatively prime to each of 5, 13, and 17. You also lost one point if you didn’t justify the fact that bp−^1 ≡ 1 (mod p) for each of p = 5, 13 , 17 (i.e., you had to mention Fermat’s Little Theorem). You also lost one point for not mentioning the Chinese Remainder Theorem.
  2. [4 points] Consider any six natural numbers n 1 ,... , n 6. Show that the sum of some subsequence of consecutive numbers is divisible by 6 (e.g., perhaps n 3 +n 4 +n 5 is divisible by 6, or n 4 itself is divisible by 6, or n 2 + n 3 is divisible by 6). [Hint: Look at the sums 0, n 1 , n 1 + n 2 , n 1 + n 2 + n 3 ,... , n 1 + n 2 + · · · + n 6 , and think in terms of mod 6.] Solution: Following the hint, consider each of the sums 0, n 1 , n 1 + n 2 , n 1 + n 2 + n 3 , ... , n 1 + n 2 + · · · + n 6 mod 6. If any of them is 0 mod 6, we’re done (since that sum is divisible by 6). By the pigeonhole principle, two of the sums must be the same mod 6. (The “pigeons” are the sums, the “holes” are 1,... , 5, since all the sums must be in the range 1,... , 5 mod 6.) If two sums are the same mod 6, their difference must be 0 mod 6, hence must be divisible by 6. But the difference between two such sequences is a sum of consecutive integers. (The difference between n 1 + · · · + nk and n 1 + · · · + nm (where k > m), is nm+1 + · · · + nk.) Thus, this sum of consecutive integers is divisible by 6.

Grading: This one was hard for most people. You got 1 point for saying “pigeon hole”; 1 point for mentioning the trivial case where one of n 1 ,... , n 6 ≡ 0 (mod 6); 1 point for saying that two of the sequences from n 1 , n 1 + n 2 ,... n 1 + · · · + n 6 must be congruent mod 6; and 1 point for saying their difference must be congruent to 0 mod 6. No points were given for showing that the sum of 6 consecutive numbers is always divisible by 6. No points were given for listing pairs, triplets, etc of numbers that could not be used.

  1. [5 points] What is the coefficient of x^25 in the binomial expansion of (2x − (^) x^32 )^58? (There’s no need to simplify the expression.) Solution: By the Binomial Theorem,

(2x −

x^2

)^58 =

∑^58

k=

k

(2x)k(−

x^2 )^58 −k^ =

∑^58

k=

k

2 k(−3)^58 −kxk−2(58−k).

k −2(58−k) = 25 iff 3k −116 = 25 iff k = 47. Thus, the coefficient of x^25 is

47

247 (−3)^11.

Grading: 2 points for using the binomial expansion; 2 points for getting k = 47 or k = 11; 1 point for getting the right answer.

  1. [5 points] Prove that 3n^ ≥ n^3 for all n ≥ 3.

Solution: We proceed by induction. Let P (n) be the statement that 3n^ ≥ n^3. P (3) is obviously true, since 3^3 = 3^3. Suppose that P (k) is true for k ≥ 3. That is, assume that 3k^ ≥ k^3. We want to show that 3k+1^ > (k + 1)^3. By the Binomial Theorem, (k + 1)^3 = k^3 + 3k^2 + 3k + 1. Since k ≥ 3, it follows that

  • 3 k^2 ≤ kk^2 = k^3
  • 3 k + 1 ≤ 3 k + k = 4k ≤ 9 k ≤ k^2 k = k^3

Thus, (k + 1)^3 ≤ k^3 + 3k^2 + 3k + 1 ≤ 3 k^3. By the induction hypothesis, k^3 ≤ 3 k, so (k + 1)^3 l 33 k^ = 3k+1. This completes the induction proof. Grading: Here we used the standard induction grading scheme. 1 point for stating the induction hypothesis; 1 point for the base case; 1 point for the conclusion; 2 points for an appropriate use of the inductive hypothesis.

  1. [3 points] How many 5-card hands have exactly 3 kings?

Solution: There are

3

ways of choosing the kings and

2

ways of choosing the re- maining two cards, so there are ( 4 3

= 4 × 48 × 47 /2 = 96 × 47

ways altogether. (See the next problem for grading comments.)

  1. [4 points] A committee of 7 is to be chosen from 8 men and 9 women. How many contain either Alice or Bob, but not both? [You do not have to simplify the expression that you get.]

(c) A sum of Bernoulli random variables is a binomial random variable. Solution: False. For example, take X + X, where X is Bernoulli. This is not a binomial random variable. This actually is true if all the Bernoulli random variables are iid (independent and identically distributed).

(d) If X and Y are independent then V (X + Y ) = V (X) + V (Y ).

Solution: True. This was done in class, but here’s a formal proof:

V (X + Y ) = E((X + Y )^2 ) − E(X + Y )^2 = E(X^2 + 2XY + Y 2 ) − (E(X)^2 + 2E(X)E(Y ) − E( = (E(X^2 ) − E(X)^2 ) + (E(Y 2 ) − E(Y )^2 ) + 2E(XY ) − E(X)E(Y ) = V (X) + V (Y ).

Here I’m using the fact that if X and Y are independent, then E(XY ) = E(X)E(Y ). (e) If a is a real number and X is a random variable, then V (aX) = aV (X). Solution: False. V (aX) = a^2 V (X). (Proof: V (aX) = E((aX)^2 ) − (E(aX))^2 = a^2 E(X^2 ) − a^2 E(X)^2 = a^2 V (X).) (f) If X and Y are not independent then E(X + Y ) 6 = E(X) + E(Y ). Solution: False. E(X + Y ) = E(X) + E(Y ) whether or not XR and Y are inde- pendent. (g) If A and B are independent events then Pr(A ∪ B) = Pr(A) + Pr(B). Solution: False. Pr(A ∪ B) = Pr(A) + Pr(B) − Pr(A ∩ B). If A and B are independent, then Pr(A ∩ B) = Pr(A) Pr(B), but it does not equal 0 in general.

(h) Suppose that you have a coin that has probability .2 of landing heads, and you toss it 100 times. Let X be the number of times that the coin lands heads. Then P r(X ≥ 60) ≤ 1 /100. Solution: True. (This is Chebyshev’s inequality, using the fact that X is a binomial random variable, with p = .2 and n = 100. Thus, E(X) = 20, V ar(X) = np(1−p) = 16, and σX = 4. Note that Pr(X ≥ 60) = Pr(|X − 20 | ≥ 40), and 40 = 10σX. Thus, Pr(X ≥ 60) ≤ 1 /100.) (i) Let Tn be the number of times a fair coin lands heads after being flipped n times. Then

nlim→∞ Pr

Tn n

∣ <.^01

Solution: True. The Law of Large numbers says that for all ,

lim n→∞ Pr

Tn n

(j) Taking Tn as above, lim n→∞ Pr

2 Tn − n √ n

∣ <^1

Solution: False. By the Central Limit Theorem, the required limit is the area under the curve of the Gaussian distribution, between -1 and 1. Although it is close to 1, it is not 1.

  1. [4 points] There are three cards. The first is red on both sides; the second is black on both sides; and the third is red on one side and black on the other side. A card is randomly selected and randomly placed on the table. The color that we see is red. What is the probability that the hidden side is black? Solution: Let the three cards be a, b, and c. Let a1 denote the first side of the first card, a2 the second side, and so on. So the event that you see red is R = {a 1 , a 2 , c 1 }. In only one of these cases is the other side black, so the probability that the other side is black is 1/3. (More formally, the event that the other side is black is OB = {b 1 , b 2 , c 1 }, so we are interested in Pr(OB | R) = Pr(OB ∩ R)/ Pr(R) = 1/3. Grading: You lost a point if you got the answer 2/3 rather than 1/3, if this was the result of using 1/3 in the numerator rather than 1/6. You lost two points if you got 1/ 2 because you didn’t try to restrict the sample space.
  2. [4 points] Two fair dice are rolled. What is the probability at least one lands on 6 given that the dice land on different numbers? Solution: The event D that the dice land on different numbers consist of the 30 pairs (i, j) such that i 6 = j. The event S that one die lands 6 consists of the 11 events of the form (6, j) and (i, 6). (There are only 11 since you don’t want to double-count (6, 6).) Note that S ∩D has 10 elements (all the elements in S except for (6,6).) We are interested in Pr(S | R) = 10/30 = 1/3.
  3. [5 points]

Input: n (a positive integer) factorial ← 1 i ← 1 while i < n do i ← i + 1 factorial ← i ∗ factorial

Prove that the program terminates with factorial = n! given input n, using an appropriate loop invariant. Solution: The loop invariant is that before the kth iteration, factorial = k! and i = k. We prove this by induction, taking P (k) to be the statement of the loop invariant. The base case is obvious, since initially factorial = 1 and i = 1. Suppose that P (k) holds; we prove P (k + 1). Clearly during the (k + 1)st interation, i is set to i + 1, which is k + 1, given the inductive hypothesis, and factorial is then set to i ∗ factorial, which is (k + 1)k! = (k + 1)!. This completes the inductive proof. It follows that before the nth iteration, i = n and factorial = n!. The program then terminates, since it is not the case that i < n. Grading: It’s fine to say that the loop invariant is factorial = i!, but then you have to be really careful to state your inductive hypothesis. Remember that if P (k) is your inductive hypothesis, it should have a k in it. Saying P (k) is factorial = i! lost you one

(a) Nobody knows Alice. (b) Sam knows everyone. (c) There is someone that Sam doesn’t know. (d) Everyone knows someone. (e) Sam knows everyone that David knows.

Solution:

(a) ∀x¬K(x, Alice) (or ¬∃xK(x, Alice)). (b) ∀xK(Sam, x). (c) ∃x¬K(Sam, x). (d) ∀x∃yK(x, y). (e) ∀x(K(David, x) ⇒ K(Sam, x)).

Grading: Each part got one point. Half a point was taken off for mixing up existential and universal quantifiers, if this mistake was made more than once; we tried not to penalize you for it each time. In general, the biggest mistake was people putting quantifiers inside predicates. (It’s not OK to write K(x, ∃y), for example.)