This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 09/11/2000 MON 10:52 FAX 6434330 MOFFITT LIBRARY 001 Math 55: Second Midterm — Solutions Problem 1 (15 points):
(a) How many integers between 1 and 1000 inclusive are divisible by either 4 or 21? Since 4 and 21 are relatively prime, lcm(4, 21) = 4 21 = 84. Thus numbers divisible by both 4
and 21 are precisely those divisible by 84. Since the number of integers between I and n inclusiVe
which are divisible by p is [rt/p], the answer is [moo/41+ [1000/21] [1000/84]: 250 + 47 — 11 = 286 by inclusion—exclusion.
(b) How many integers between 1 and 1000 inclusive are divisible by either 4 or 6?
Since lcm(4,6) :: 12, numbers divisible by both 4 and 6 are precisely those divisible by 12. Thus the answer is [1000/4] + [1000/6] — [1000/12] = 250 + 166 — 83 = 333. Problem 2 (15 points): Assume n and m are integers with n 2 m 2 0. How many ways are there
to put 11 identical objects into m numbered boxes in such a way that no box is empty?
Let 2:, be the number of objects in box number i, for i = l, . . . , m. Then we are asking for the number of solutions (:31, :02, . . . , mm) to 31+22+..+zm:n, as;>1. Begin by putting 1 object in each box; then we have n—m objects left to distribute among in boxes.
Mathematically, put :1 = l + y where (y; , yg, . . . , ym) is a solution to yl+y2+"+2Jm=ﬂm, yr>0 We know that the number of solutions (3/1,” .,ym) is the same as the number of ways to choose
11 — m objects of m kinds, which is C(n — m+ m — 1,m— 1) = C(n — 1,m — 1). Problem 3 (15 points): Use the binomial theorem to compute the coefﬁcient a: of 22 in the
expansion By the binomial theorem,
2 m m 10 101: 2 k m 10 k 10w2k
(3+2) k )1 (a) k )h  The exponent of a: is 2 when 10 — 2!: = ‘2 or k z 4, so the coefﬁcient of :1:2 is .  7
2‘( 140)=1614%—=3360 Problem 4 (25 points): Deﬁne a sample space S by S = {1,2,3,4,5,6}, and let the probability
of any outcome 3 in S be p(::) = 1/6. Deﬁne random variables ﬁg : S —> Z by ﬂat) = 2' mod 2, 9(2) : 2 mod 3. 09/11/2000 MON 10:52 FAX 6434330 MUFFITT LIBRARY 002 (:1) Calculate EU) and Deﬁne sets .13; and G, by F, = {f = i} for i = 0,1 and 01 = {g = j} for j = 0,1,2. Then = 1/2 and p(GJ) = 1/3, so 1 1 1
E(f)—§'0+§'1—§
and 1 1 l
E(g)=§O+§'1+§2:1.
(b) Calculate V(f) and V(g).
211.2 2—}
BOW2 0 +2 1 2
and 1 1 1 5
2.__.2 ._.2 _.2:_
E(g)—30+31+32 3. so V(f) = 1/4 and V(g) = 2/3.
(c) Prove that f and g are independent. We need to show that p(f : i,g : j) = _p(f = i)p(g = j) or equivalently that p(F,n Gj) =
p(F()p(Gj) for all i,j. Since Fa = {2,4,6}, 1“; = {1,3,5}, Go 2 {3,6}, 01 = {1,4}, 02 = {2,5}. we
see that IF. n GJI = 1, so p(F; I") Gj)=1/6 = p(F.)p(GJ) and f is independent of g. (d) Calculate EU + g) and V(f+g). First, EU + g) = EU) + E(g) = 1 + 1/2 = 3/2. Second, since f and g are independent, their variances add: VU +9) 2 V(f) + V(g) = 11/12. Problem 5 (25 points): Consider the following pseudocode: function f(a: integer, b: nonnegative integer) if (b = O)
f(a. b) := 1 else if (b mod 2 = 0) f(a, b) := f(a, b / 2) at f(a, b / 2) else f(a. b) := a * f(a, b  1) (a) Evaluate f(—3, 2). Put, a = —3 and b = 2. Since 13 is even and nonzero, f(a,b) : f(a,b/2) t f(a, 13/2) 2 f(—3,1)*
:E(——3, 1). Since 1 is odd and nonzero, f(3, l) = —3 at f(—3, 1 — 1) = —3 1 f(—3,0) = —3. Thus
f(—3, 2) = (—3) a: (—3) = 9. (b) What function of a and I) does this code calculate? If a = b = 0, this code returns 1. Otherwise, it returns ab. It computes ab recursively, using the
fact that ab : (3.111”)2 ifb is even and ab = a  ab‘l ifb is odd. (0) Use induction to prove that your answer to (b) is correct. (Hint: Start at b = 1.) We will use the second kind of induction, on b, with a ﬁxed. The case b = U is clear, so we will
start at b = 1. Base: 1: : 1. Then f(a,b) : a I): f(a, O) = a is correct since a1 = a. Induction step: Consider two cases. Case 1: b is even. Then by the induction hypothesis, f(a, 13/2) = ab”, 39 we have £(a,b) = (ab/2)2 = ab.
Case 2: b is odd. Then by the induction hypothesis, f(a,b — 1) = ab“1, so we have f(a,b) =
a * ab—1 = ab. ...
View
Full
Document
This test prep was uploaded on 04/01/2008 for the course MATH 55 taught by Professor Strain during the Spring '08 term at University of California, Berkeley.
 Spring '08
 STRAIN
 Math

Click to edit the document details