Final Exam Review I


On this webpage I denote (n choose k) by (n | k) and (n multi-choose k) by ((n | k)). These are not standard symbols: use the vertical notation in your own writing.

See the Old Notes.


Final Review Problems I.   See also Midterm Review Problems.

  1. Basic enumeration of combinations.
    Count how many ways to choose k elements of n kinds: the elements may be ordered or not, with repeats or not. The example gives the case k = 2, n = 3.
    1. Ordered list, repeats allowed: (1,1) (1,2) (1,3) (2,1) (2,2) (2,3) (3,1) (3,2) (3,3)
    2. Ordered list, no repeats: (1,2) (1,3) (2,1) (2,3) (3,1), (3,2)
    3. Ordered list, each of the n kinds appearing at least once: no such if k < n. Hint: Use PIE with A = {lists from (a)}.
    4. Unordered set, no repeats: {1,2} {1,3} {2,3}
    5. Unordered multi-set, repeats allowed: {1,1} {1,2} {1,3} {2,2} {2,3} {3,3}
    6. Unordered multi-set, each kind appearing at least once.
      Hint: Use bins-and-beans correspondence in which you remove one element of each kind.

  2. Counting solutions of n1 + n2 + n3 = 10.
    1. Count the triples of whole numbers n1,n2,n3 ≥ 0  satisfying the equation n1 + n2 + n3 = 10. 
      Example: 6 + 0 + 4 . Hint: Put 2 bin-dividers between 10 beans.
    2. Same, but with n1,n2,n3 ≥ 1. Hint: Interpret this also in terms of bins-and-beans.
    3. Extra Credit: Same, but suppose the numbers are rolls of the dice, so that each 1 ≤ ni ≤ 6. Hint: PIE, combined with the previous solution.

  3. Re-do the above problem using generating functions.
    1. Let ak be the number of triples of whole numbers n1,n2,n3 ≥ 0  satisfying the equation n1 + n2 + n3 = k. 
      Hint: Evaluate f(x) = ∑k≥0 akxk using the Product Principle, performing an algebraic substitution on the logical expression:
      (n1 = 0 or n1 = 1 or n1 = 2 or ...) and (n2 = 0 or ....) and (n3 = 0 or ...)
      Compare a10 with your answer above.
    2. Same, but with n1,n2,n3 ≥ 1.
    3. Extra Credit: Same, but with 1 ≤ ni ≤ 6. Hint: Expand the top, and take each term over the denominator.

  4. Give a formula for the sequence {pk}k≥0 defined by the recurrence:   pk = 3pk−1 − 2pk−2   for k ≥ 2, where p0 and p1 are arbitrary given constants.
    Hint: You can check your answer by computing pk directly in the case p0 = p1 = 1 (work out some values by hand), and comparing with your general answer.


Answers

1a. Product Principle: nk

   b. Product Principle (Basic Prob 2): nk = n(n−1)⋅⋅⋅(n−k+1)

   c. PIE: A = {ordered list, any repeats}, Ai = {lists with element i missing} for i = 1,...,n.
       #Agood = nk − (n | 1) (n−1)k + (n | 2) (n−2)k − ⋅⋅⋅ + (−1)n−1 (n | n−1) 1k .

   d. Basic Prob 3: (n | k) = nk / k! = n! / k!(n−k)!

   e. Basic Prob 4 (bins-and-beans correspondence, Notes 9/5):

       ((n | k)) = (k+n−1 | n−1) = (k+n−1 | k)

   f. Correspondence: remove 1 element of each kind, leaving k−n elements to choose arbitrarily.
       ((n | k−n)) = (k−1 | k−n) = (k−1 | n−1)

2a. This is the Multiplicity Transform of multisets (Notes 9/5): ((3 | 10)) = (10+3-1 | 3-1) = (12 | 2) = 66.

   b. ((3 | 10−3)) = (9 | 2) = 36.

   c. Ans: 27.

3a. Problem: Let ak be the number of solutions to n1 + n2 + n3 = k with n1, n2, n3 ≥ 0. Determine ak by evaluating f(x) = ∑k≥0 akxk.
Solution: The cases counted by the coefficients ak cannot be easily factored into a sequence of choices, but consider all choices of (n1,n2,n3) without specifying the sum k:

choose (n1,n2,n3)   ⇔   (n1 = 0 or n1 = 1 or n1 = 2 or ...) and (n2 = 0 or ....) and (n3 = 0 or ...)

To turn this into a generating function, replace the left side by f(x);   "or" by + ,   "and" by × ,    "ni = m" by xm (since this choice contributes m to the sum n1+n2+n3):

f(x) = ∑k≥0 akxk = (x0 + x1 + x2 + ...) (x0 + ...)(x0 + ...)
= (1 + x1 + x2 + ...)3 = ( 1/(1-x) )3 = ∑k≥0 ((3 | k)) xk .

Hence ak = ((3 | k)) = (k+3-1 | 3-1) = (k+2)(k+1)/2 , and in particular a10 = 66.

3b. Problem: Now let bk be the number of solutions to n1 + n2 + n3 = k with n1, n2, n3 ≥ 1. Determine bk by evaluating g(x) = ∑k≥0 bkxk.
Solution: By the same reasoning,

g(x) = ∑k≥0 bkxk = (x1 + x2 + ...) (x1 + ...)(x1 + ...)
= ( x (1 + x1 + x2 + ...) )3 = x3( 1/(1-x) )3
= ∑k≥0 ((3 | k)) xk+3 = ((3 | 0)) x3 + ((3 | 1)) x4 + ((3 | 2)) x5 + ...
= ∑k≥3 ((3 | k-3)) xk
Hence bk = ((3 | k−3)) = (k−3+3-1 | 3-1) = (k−1)(k−2)/2.

4. Turning the recurrence into an equation for f(x) = ∑k≥0 pkxk, we get:

f(x) =
(p1−3p0)x + p0

1 − 3x + 2x2
.
Find roots of the denominator:   1 − 3x + 2x2 = 0 when x = 1 and x = 1/2, we may write:
f(x)  =  A/(1−x) + B/(1−2x)  =  ∑k≥0 A xk + ∑k≥0 2B xk ,
and we may compute A, B by:
(p1−3p0)x + p0 = A(1 − 3x + 2x2)/(1 − x) + B(1 − 3x + 2x2)/(1 − 2x) = A(1 − 2x) + B(1 − x).
Substituting x = 1 and x = 1/2 gives: A = 2p0 − p1  , B = p1 − p0 . Collecting xk terms, we find:
pk  =  2p0 − p1  +  2k (p1 − p0) .
For the special case p0 = p1 = 1, the recurrence clearly works out as pk = 1, which agrees with our general formula.