# Counting strings, need to under stand how this worked

Question

Let $N_4 = \{1, 2, ..., 4\}$. Calculate the number of strings on the set $N_4$ that are of length $8$. Calculate the number of strings on the set $N_4$ that are of length $8$ and contain exactly five ones.

For the first part of the question, for each of the $8$ positions in the string we have a choice of $4$ digits. Using the product rule, the number of different possible strings is $= 4^8 = 65536$.

The task of creating a string from the set $N_4$ of length $8$ with $5$ ones may be partitioned into two tasks:

Select the position of the ones this can be done in $C(8,5) = 56$ different ways. (THIS IS THE STEP I DON"T UNDERSTAND)

(AND THIS TOO) Select the digits that go into the remaining $3$ positions $= 3^3 = 27$ different ways.

We now apply the product rule to obtain the solution $= 1512$.

Hence, the solutions are:
$65536$
$1512$

• Please read this tutorial on how to typeset mathematics on this site. – N. F. Taussig Aug 6 '16 at 22:33