Combinatorial identity [duplicate]

Find a formula for: $$\binom n0 + 2\binom n1 + 4\binom n2 + 8\binom n3 + \cdots + 2^{n-1}\binom n{n-1} + 2^n\binom nn$$ using a counting argument.

I just used the binomial t. to show it's $3^n$ but I can't find a combinatorial way. Any help?

-

marked as duplicate by user88595, amWhy, Najib Idrissi, Davide Giraudo, hardmathJun 8 at 13:21

Consider counting functions $f: \{1,2,\dots,n\} \to \{1,2,3\}$ which we know there are $3^n$ of. The binomial coefficient $\binom{n}{i}$ chooses elements not to send to $3$ and the $2^i$ counts the ways to sending these elements into $\{1,2\}$. This defines a function just by sending everything not chosen to 3.