So the binomial theorem states $(1+x)^n = \sum^{n}_{k=0}$$n \choose k$$x ^ k$.
Now I understand that each term of the sum represents the number of ways to arrange 1 and $x$ out of $n$ choices, so there ends up being $k$ number of $x$'s.
I understand what happens when instead of a $1$ and $x$ there's an $a$ and $b$, if there's $k$ $a$'s, there's $n-k$ $b$'s.
I also understand what it means when $x = 1$, so the right hand side ends up being the summation of all the $n \choose k$, which means the left side equals the number of all subsets you can get from a set, $2^n$, which is already known/proved by this theorem.
Now what I don't get, is when $x$ is anything other than 1. What does it mean when $x = 2$ for example? What meaning does the left side $= 3^n$ have? What meaning does $\sum^{n}_{k=0}$$n \choose k$$2 ^ k$. have? I get to some extent it will just be what the polynomial equals when you plug in $x = 2$, but does it have any special meaning that has to do with subsets and size of sets, etc.?
Thanks!
Notice that $$\sum _{k=0}^n\binom{n}{k}2^k=\sum _{k=0}^n\binom{n}{n-k}2^{n-k}=\sum _{k=0}^n\binom{n}{k}2^{n-k}=\sum _{k=0}^n\binom{n}{k}\left (\sum _{l=0}^{n-k}\binom{n-k}{l}\right )=\sum _{k=0}^n\sum _{l=0}^{n-k}\binom{n}{k}\binom{n-k}{l}.$$
Check the right hand side of this line, this means choosing the positions for a first object(if, apriori, you know that you want $k$ of those) and then choosing the positions of a second object (if you know you want $l$ of them). Notice that there is a third object, that you will place in the rest $n-(k+l)$ positions.
This is why this is $3^n$ which encodes the ways to put $3$ kind of objects in $n$ slots.
What you say about $(a+b)^n$ is a little wrong in the sense that $a$ is like a box of objects with $a$ different types and $b$ is another box in which you have $b$ different types of objects. In the particular case of $3^n$ you have in the first box the type $1$ and in the second box the type $2$ and $3.$