Originally Posted by

**awkward** Hi Milagros,

Soroban has given you an excellent solution already, but here is a generating function approach since that seems to be what you are looking for.

First, let

$\displaystyle a_r$ = the number of ways to form a binary string of length 50 with exactly r ones, and let

$\displaystyle f(x) = \sum a^r x^r$.

We know

$\displaystyle a_r = \binom{50}{r}$,

so by the binomial theorem,

$\displaystyle f(x) = (1 + x)^{50}$.

Now let

$\displaystyle b_r$ = the number of ways to form a binary string of length 50 with exactly r ones, all at the end. There is only one such string, so

$\displaystyle b_r = 1$

and

$\displaystyle g(x) = \sum b_r x^r = 1 + x + x^2 + \dots + x^{50} = \frac{1-x^{51}}{1-x}$

Now the number of ways to form a binary string of length 50 and another string of length 50 with all the one's at the end, containing a total of r ones, is

$\displaystyle \sum a_r b_{50-r}$

which has the generating function $\displaystyle f(x) \cdot g(x)$.

So the answer to the original question is the coefficient of $\displaystyle x^{10}$

in

$\displaystyle \frac{(1+x)^{50} \cdot (1-x^{51})}{1-x}$

which I think probably reduces, in the end, to the same answer given by Soroban (but I haven't checked it).