Exercise 17.

Consider bit strings with length \(l\) and weight \(k\) (so strings of \(l\) 0's and 1's, including \(k\) 1's). We know how to count the number of these for a fixed \(l\) and \(k\text{.}\) Now, we will count the number of strings for which the sum of the length and the weight is fixed. For example, let's count all the bit strings for which \(l+k = 11\text{.}\)

  1. Find examples of these strings of different lengths. What is the longest string possible? What is the shortest?

  2. How many strings are there of each of these lengths. Use this to count the total number of strings (with sum 11).

  3. The other approach: Let \(n = l+k\) vary. How many strings have sum \(n = 1\text{?}\) How many have sum \(n = 2\text{?}\) And so on. Find and explain a recurrence relation for the sequence \((a_n)\) which gives the number of strings with sum \(n\text{.}\)

  4. Describe what you have found above in terms of Pascal's Triangle. What pattern have you discovered?

in-context