Midterm Exam 2 Solutions for Math 213, Section X1 (Spring 2006), Exams of Discrete Mathematics

The solutions to the math 213, section x1 midterm exam held in spring 2006. It includes the solutions to six problems covering topics such as probability calculations, recurrences, generating functions, and power series expansions.

Typology: Exams

Pre 2010

Uploaded on 03/16/2009

koofers-user-ya4
koofers-user-ya4 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 213, Section X1 Midterm Exam 2 Solutions Spring 2006
Problem 1
Suppose you roll 4 ordinary dice. Determine the following probabilities:
1. The probability that at least one 6 comes up.
Solution: By the complement trick, this is 1 P(no 6 in 4 rolls), i.e., 1 (5/6)4.
2. The probability that exactly one 6 comes up.
Solution: This is given by the binomial distribution: 4
1(1/6)1(1 1/6)3=4·53
64.
3. The probability that all four numbers showing up are distinct.
Solution: This is a birthday-type probability: 6·5·4·3
64=5
18 .
4. The probability that all four dice show the same number.
Solution: There are 6 ways to choose the number showing up on the dice, and for a
given number, the probability that all four dice show this particular number is 1/64.
Thus, the probability in question is 6 ·(1/64) = 1/63.
Problem 2
Consider the recurrence an=2nan1.
1. (Multiple choice. Circle the correct answer.) Determine whether this recurrence is
(a) Linear and homogeneous
(b) Linear and nonhomogeneous
(c) Nonlinear and homogeneous
(d) Nonlinear and nonhomogeneous
Solution: (a) The recurrence is linear and homogeneous. (Note that in a linear recur-
rence the coefficients of the terms an,an1, etc., don’t have to be constant and can be
arbitrary functions of n.)
2. Solve this recurrence with initial condition a0= 1.
Solution: By iteration,
an=2nan1= (2)2n(n1)an2=··· = (2)nn(n1) . . . 2·1a0= (2)nn!.
Problem 3
Let andenote the number of ways to climb nstairs if stairs can be climbed 2 or 3 at a time.
Set up a recurrence for an; be sure to clearly explain how each term in this relation arises.
Solution: Consider the last step when climbing nstairs. If this is a 2-stair step, your position
before taking this step is at the end of n2 stairs, and there are an2ways to reach this
position. If it is a 3-stair step, your position before taking the step is at the end of n3
stairs, and there are an3ways to reach this position. Since these are the only possibilities
for the last step, the sum of these two counts gives the total number of ways to climb nstairs,
i.e., we have the recurrence an=an2+an3.
Page 1
pf3

Partial preview of the text

Download Midterm Exam 2 Solutions for Math 213, Section X1 (Spring 2006) and more Exams Discrete Mathematics in PDF only on Docsity!

Problem 1

Suppose you roll 4 ordinary dice. Determine the following probabilities:

  1. The probability that at least one 6 comes up.

Solution: By the complement trick, this is 1 − P (no 6 in 4 rolls), i.e., 1 − (5/6)^4.

  1. The probability that exactly one 6 comes up.

Solution: This is given by the binomial distribution:

(1/6)^1 (1 − 1 /6)^3 =

  1. The probability that all four numbers showing up are distinct.

Solution: This is a birthday-type probability:

  1. The probability that all four dice show the same number. Solution: There are 6 ways to choose the number showing up on the dice, and for a given number, the probability that all four dice show this particular number is 1/ 64. Thus, the probability in question is 6 · (1/ 64 ) = 1 / 63.

Problem 2

Consider the recurrence an = − 2 nan− 1.

  1. (Multiple choice. Circle the correct answer.) Determine whether this recurrence is (a) Linear and homogeneous (b) Linear and nonhomogeneous (c) Nonlinear and homogeneous (d) Nonlinear and nonhomogeneous Solution: (a) The recurrence is linear and homogeneous. (Note that in a linear recur- rence the coefficients of the terms an, an− 1 , etc., don’t have to be constant and can be arbitrary functions of n.)
  2. Solve this recurrence with initial condition a 0 = 1.

Solution: By iteration,

an = − 2 nan− 1 = (−2)^2 n(n − 1)an− 2 = · · · = (−2)nn(n − 1)... 2 · 1 a 0 = (−2)nn!.

Problem 3

Let an denote the number of ways to climb n stairs if stairs can be climbed 2 or 3 at a time. Set up a recurrence for an; be sure to clearly explain how each term in this relation arises.

Solution: Consider the last step when climbing n stairs. If this is a 2-stair step, your position before taking this step is at the end of n − 2 stairs, and there are an− 2 ways to reach this position. If it is a 3-stair step, your position before taking the step is at the end of n − 3 stairs, and there are an− 3 ways to reach this position. Since these are the only possibilities for the last step, the sum of these two counts gives the total number of ways to climb n stairs, i.e., we have the recurrence an = an− 2 + an− 3.

Problem 4

  1. Find the general solution to the recurrence an = 6an− 1 − 9 an− 2.

Solution: The associated characteristic equation is r^2 − 6 r + 9 = 0, which has a double root at r = 3. Thus, the general solution is of the form an = α 13 n^ + α 2 n 3 n^.

  1. Find a particular solution to the recurrence an = 6an− 1 − 9 an− 2 + 28n.

Solution: The nonhomogeneous term is 28n, so we seek a solution of the form (∗) an = An + B with constants A and B. Substituting (∗) into the recurrence, we get

An + B = 6(A(n − 1) + B) − 9(A(n − 2) + B) + 28n = n(− 3 A + 28) + (12A − 3 B).

Equating coefficients of n and of 1 (i.e., the constant terms) on both sides, we get the equations A = − 3 A + 28 and B = 12A − 3 B, so A = 7 and B = 3A = 21. Thus, a particular solution is an = 7n + 21.

Problem 5

  1. Write down the generating function G(x) for the number ar of solutions to the equation

x 1 + x 2 + x 3 + x 4 = r,

where x 1 , x 2 , x 3 are arbitrary nonnegative integers, and x 4 is a nonnegative multiple of 10 (i.e., the possible values of x 4 are 0, 10 , 20 ,... ). Simplify your formula as much as possible, e.g., by evaluating power series in closed form.

Solution: There are four factors contributing to G(x), one for each of the four variables. The factors corresponding to x 1 , x 2 , x 3 are (1 + x + x^2 + · · · ) = (1 − x)−^1 each, and the factor corresponding to x 4 is 1 + x^10 + x^20 + · · · = (1 − x^10 )−^1. Thus, G(x) = (1 − x)−^3 (1 − x^10 )−^1.

  1. Using the generating function obtained above, compute a 15 , the number of so- lutions to the above equation with r = 15. (Give a numerical answer, e.g., 571. You must derive this answer via generating functions. No credit will be given for brute force attempts, or attempts using combinatorial arguments of the type that came up in Chapter 4.)

Solution: Expanding the factors (1 − x)−^3 and (1 − x^10 )−^1 gives

G(x) =

k=

3 + k − 1 k

xk

1 + x^10 + x^20 +...

a 15 is the coefficient of x^15 in the above series, i.e.,

a 15 =

Problem 6

Find the coefficient of x^10 in the power series expansions of the following functions. (Your answer can be left in “raw” form.)

1 + 2x