<s>[INST] Number of terms in the expansion of $\left(1+\frac{1}{x}+\frac{1}{x^2}\right)^n$ 
Number of terms in the expansion of $$\left(1+\frac{1}{x}+\frac{1}{x^2}\right)^n$$ 

$\bf{My\; Try::}$ We can write $$\left(1+\frac{1}{x}+\frac{1}{x^2}\right)^n=\frac{1}{x^{2n}}\left(1+x+x^2\right)^n$$
Now we have to calculate number of terms in $$(1+x+x^2)^n$$ and divided each term by $x^{2n}$
So $$(1+x+x^2)^n = \binom{n}{0}+\binom{n}{1}(x+x^2)+\binom{n}{2}(x+x^2)^2+......+\binom{n}{n}(x+x^2)^n$$
and divided each term by $x^{2n}$
So we get number of terms $\displaystyle  = 1+2+3+.....+n+1 = \frac{(n+1)(n+2)}{2}$
Is my solution is Right, If not then how can i calculate it
actually i don,t have solution of that question.
Thanks
 [/INST] The number of terms in the expansion of $$\left(1+\frac1{x}+\frac1{x^2}\right)^n=\dfrac{(1+x+x^2)^n}{x^{2n}}$$
will be same as in $(1+x+x^2)^n$
As $a^3-b^3=(a-b)(a^2+ab+b^2),$
$$(1+x+x^2)^n=\left(\dfrac{1-x^3}{1-x}\right)^n =(1-x^3)^n(1-x)^{-n}$$
The highest & the lowest power of $x$ in $(1+x+x^2)^n$ are $0,2n$ respectively.
Clearly, all the terms present in $1\cdot(1-x)^{-n}$ (using Binomial Series expansion) as in $(1-x^3)^n(1-x)^{-n}$
</s>