# Calculate the expansion of $(x+y+z)^n$

The question that I have to solve is an answer on the question "How many terms are in the expansion?".

Depending on how you define "term" you can become two different formulas to calculate the terms in the expansion of $(x+y+z)^n$.

Working with binomial coefficients I found that the general relation is $\binom{n+2}{n}$. However I'm having some difficulty providing proof for my statement.

The other way of seeing "term" is just simply as the amount of combinations you can take out of $(x+y+z)^n$ which would result into $3^n$.

Depending on what is the right interpretation, how can I provide proof for it?

-

For the non-trivial interpretation, you're looking for non-negative solutions of $a + b + c = n$ (each of these corresponds to a term $x^a y^b z^c$). Code each of these solutions as $1^a 0 1^b 0 1^c$, for example $(2,3,5)$ would be coded as $$110111011111.$$ Now it should be easy to see why the answer is $\binom{n+2}{n}$.

-

If you foil, every term will be of the type $x^iy^jz^{n-i-j}$, and oviously $0 \leq i, j \leq n$ and $i+j \leq n$.

You can get $i$ $x's$ from $n$ brackets in $\binom{n}{i}$ ways, and you can get $j$ $y's$ from the reminding $n-i$ brackets in $\binom{n-i}{j}$ ways. This leads to

$$(x+y+z)^n = \sum_{0 \leq i+j \leq n} \frac{n!}{i! j! (n-i-j)!} x^iy^jz^{n-i-j} \,.$$

The question you ask is actually much simpler:

How many terms of the type $x^iy^jz^{n-i-j}$ are there?

i.e. How many $i,j$ verify the relation $0 \leq i \leq n, 0 \leq j \leq n$ and $i+j \leq n$.

For each $i$ you have $n-i+1$ choices for $j$ so your answer is $\sum_{i=0}^n (n-i+1)$. You don't need the more general binomial formula for this.

-

It can never be $3^n$. As you can see for $(a+b)^n$ contains just $n+1$ terms. Note that we have to keep the sum of powers in each of the combinations of $x,y,z$ to $n$, so it will be reduced.

Now replace $a$ and $b$ by $x$ and $(y+z)$ respectively. So total number of terms should be $1+2+3+\cdots+(n+1)=\dfrac{(n+1)(n+2)}{2}$.

-
sorry! From the OP (before edited by @Hardy), I missed that you have actually figured out the number of terms. –  Tapu Oct 29 '11 at 21:04
It is a useful point of view to say that there are $3^n$ terms taking into account multiplicities. –  Phira Oct 29 '11 at 21:53
@Phira, I believe I have explained well in which sense it can never be. –  Tapu Oct 30 '11 at 3:46