Let \(B_{10}\) be the set of all length-10 binary strings. So for example, (1, 0, 0, 1, 0, 1, 1, 1, 0, 1) is an element of the set \(B_{10}\). Now, consider that we randomly draw two strings from the set \(B_{10}\) with replacement:

\[ \begin{aligned} \mathbf{a} &= (a_1,\,a_2,\,a_3,\,...,\,a_{10})\in B_{10}\\ \mathbf{b} &= (b_1,\,b_2,\,b_3,\,...,\,b_{10})\in B_{10}. \end{aligned} \]

If we multiply the entries and add

\[ X=a_1b_1+a_2b_2+\cdots +a_{10}b_{10}, \]

what is the probability that the sum \(X\) is equal to \(k\), for each \(k=0,\,1,\,2,\,3,\,...,\,10\)?

  1. Derive a generic formula for \(P(X=k)\) that is a function of \(k\), but then plug into your formula and produce an \(11\times 2\) table listing the actual decimal numbers for each \(k\);
  2. Write a lil’ program in R that simulates 10,000 random trials of this phenomenon. Tally up the number of times you get each value of \(k\), and compare the empirical proportions to the actual probabilities in part a. In a large enough number of trials, they should be close by the law of large numbers, which we will study in a month or two.