Artificial intelligent assistant

No. of ways to choose $n$ things from $n$ alike "a" things $n$ alike "b" things and $n$ different things. No. of ways to choose $n$ things from $n$ alike "a" things $n$ alike "b" things and $n$ different things. Answer is $(n+2)2^{n-1}$. But how to prove it..?

Assume that we are choosing n objects from $\\{a,\cdots,a,b,\cdots,b, c_{1},\cdots,c_{n}\\}$
where there are n a's and n b's.

If we choose k elements from $\\{a,\cdots,a,b,\cdots,b\\}$, there are $k+1$ ways to do this;

and then we still have to choose $n-k$ elements from $\\{c_1,\cdots,c_n\\}$,
which can be done in $\binom{n}{n-k}=\binom{n}{k}$ ways.

Therefore the total number of choices is given by $\displaystyle\sum_{k=0}^{n} (k+1)\binom{n}{k}$.

Since $\displaystyle(x+1)^n=\sum_{k=0}^n \binom{n}{k}x^k$, $\;\;\;\;\;\displaystyle x(x+1)^n=\sum_{k=0}^n \binom{n}{k}x^{k+1}$; so differentiating gives $(x+1)^{n-1}[(n+1)x+1]=\displaystyle\sum_{k=0}^{n} (k+1)\binom{n}{k}x^k$.

Now substituting $x=1$ gives that $\displaystyle\sum_{k=0}^{n} (k+1)\binom{n}{k}=2^{n-1}(n+2)$.

* * *

Another way to evalutate this would be to split up the sum as $\displaystyle\sum_{k=0}^{n} k\binom{n}{k}+\sum_{k=0}^n \binom{n}{k}$ to get $n2^{n-1}+2^n=2^{n-1}(n+2)$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 1a47ada82734c983838e3824d31cb608