# number of distinct terms in binomial expansion of $\left(x+x^{-1}+x^2+x^{-2}\right)^{15}$

Question -> How do I find the number of distinct terms in the binomial expansion of $$\left(x+\frac{1}{x}+x^2+\frac{1}{x^2}\right)^{15}$$

Solution I tried ->

$$\left(\frac{x^3+x+x^4+1}{x^{2}}\right)^{15}=x^{-30}\left(1+x+x^3+x^4\right)^{15}$$ is in the form of

$$x^{-30}\left(a_{0}+a_{1}x+....a_{60}x^{60}\right)$$ I did not understand which powers of $x$ are present and which are absent.

How do I find the number of distinct terms?

Since all of the coefficients are positive, this amounts to just verifying that each number is achievable by at least one combination of the terms. $a_k$ in your above has the combinatorial interpretation as the number of possible solutions to $(c_1,c_2,\dots,c_{15})$ where each $c_i\in\{0,1,3,4\}$ and $c_1+c_2+\dots+c_{15}=k$.

Using this interpretation, each of $a_0,a_1,\dots,a_{15}$ are obviously positive since for $k\in\{0,1,\dots,15\}$ one can come up with at least one arrangement as $(\underbrace{1,1,\dots,1,}_k~\underbrace{0,0,\dots,0}_{15-k})$. The same argument works for showing each of $a_{45},a_{46},\dots,a_{60}$ using instead $4$'s and $3$'s in place of the $0$'s and $1$'s.

Each of $a_{16},\dots,a_{27}$ can be seen to be positive since for $k\in\{16,\dots,27\}$ we can use $(4,4,4,4,\underbrace{1,1,1,\dots,1}_{k-16}~,\underbrace{0,0,\dots,0}_{27-k})$

We can also construct at least one arrangement for $28,29$ and $30$ as well using a few more $4$'s at the beginning. Finally by replacing $0$'s with $4$'s and vice versa, and $1$'s with $3$'s and vice versa, this gives arrangements for each of $30,\dots 45$ as well at no additional effort.

In the end this all proves that each coefficient $a_0,a_1,\dots,a_{60}$ are positive integers and so all sixty-one possible appear in the full expansion of $(1+x+x^3+x^4)^{15}$ and equivalently all sixty-one possible terms appear in the expansion of $(x+\frac{1}{x}+x^2+\frac{1}{x^2})^{15}$

A much more interesting and difficult question would have been if some of the signs were altered, as in $(x-\frac{1}{x}+x^2-\frac{1}{x^2})^{15}$ where for example the coefficient of the term for $x^0$ would be zero.

We can get any exponent from $0$ to $60$. Thus, there are $61$ distinct terms.

Consider $$\left(1+x+x^3+x^4\right)^{15}$$ For $0\le k\le30$, there is a way to get $x^k$ by $$\color{#C00}{1}^{15-k+2\lfloor k/3\rfloor}\color{#C00}{x}^{k-3\lfloor k/3\rfloor}\color{#C00}{x}^{\color{#C00}{3}\lfloor k/3\rfloor}$$ since $k-2\lfloor k/3\rfloor\le11$.

For $0\le k\le30$, there is a way to get $x^{60-k}$ by $$\color{#C00}{x}^{\color{#C00}{4}(15-k+2\lfloor k/3\rfloor)}\color{#C00}{x}^{\color{#C00}{3}(k-3\lfloor k/3\rfloor)}\color{#C00}{x}^{\lfloor k/3\rfloor}$$ since $k-2\lfloor k/3\rfloor\le11$.

In your final line you should be able to convince yourself that all the terms are there. As all the signs in your power are plus you can't have any cancellation that removes a term. You then just have to convince yourself that if you choose $15$ terms from $\{0,1,3,4\}$ with replacement you can get all the sums from $0$ through $60$. You can demonstrate that you can get $0$ through $8$ with two items, then just put in enough $0$s or $4$s to fill out.