Find the generating function for the number of words, from the standard 26-letter alphabet, that have $k$ letter with exactly 1 A and at least 2 Bs. ($k$ will vary)
Workings:
For the time being I'm going to ignore $k$.
Exactly 1 A:
$x$
At least 2 Bs:
$(x^2 + x^3 + x^4 + ... x^{26})$
Letters C to Z:
$(1 + x + x^2 + ... x^{26})^{24}$
So
$g(x) = x(x^2)(1 + x + x^2 + ... + x^{24})(1 + x + x^2 + ... x^{26})^{24}$
Now I'm not sure how to deal with the varying $k$. Any help will be appreciated.
We need $k\geq3$.
The number of words of length $k$ with exactly one $A$ are $\binom{k}{1}25^{k-1}$ (choose the position for the $A$ and count all possibilities for the letters in the other positions).
the generating function of this sequence is
$$g_1(x):=\sum_{k=3}^{\infty}k25^{k-1}x^k=\frac{x}{25}\left(\frac{1}{1-25x}\right)'=\frac{x}{(1-25x)^2}-x+50x^2$$
The number of words with exactly one $A$ and exactly one $B$ is $2\binom{k}{2}24^{k-2}$ (choose the positions for the $A$ and the $B$ and count all possibilities for the letters in the other positions).
Its generating function is
$$g_2(x)=\sum_{k=3}^{\infty}k(k-1)24^{k-2}x^k=\frac{x^2}{24^2}\left(\frac{1}{1-24x}\right)''=\frac{2x^2}{(1-24x)^3}-2x^2$$
The number of words with exactly one $A$ and no $B$ is $\binom{k}{1}24^{k-1}$.
Its generating function is
$$g_3(x)=\sum_{k=3}^{\infty}k24^{k-1}x^k=\frac{x}{24}\left(\frac{1}{1-24x}\right)'=\frac{x}{(1-24x)^2}-x+48x^2$$
The number of words with exactly one $A$ and at least two $B$ is
$$a_k:=\binom{k}{1}25^{k-1}-2\binom{k}{2}24^{k-2}-\binom{k}{1}24^{k-1}=k25^{k-1}-k(k-1)24^{k-2}-k24^{k-1}$$
Now we sum $$\begin{align}f(x)&:=g_1(x)-g_2(x)-g_3(x)\\&=\frac{x}{(1-25x)^2}-x+50x^2-\frac{2x^2}{(1-24x)^3}+2x^2-\frac{x}{(1-24x)^2}+x-48x^2\\&=\frac{x}{(1-25x)^2}-\frac{2x^2}{(1-24x)^3}-\frac{x}{(1-24x)^2}+4x^2\end{align}$$