<s>[INST] Finding coefficient of $x^{111}$ in $P=(1+x)+2(1+x)^2+3(1+x)^3+\ldots+1000(1+x)^{1000}$ 
Find the coefficient of $x^{111}$ in $P=(1+x)+2(1+x)^2+3(1+x)^3+\ldots+1000(1+x)^{1000}$.


Here is what I did. It is an AGP. So we can write it as follows.
$$\begin{aligned}P&=(1+x)\frac{\mathrm d}{\mathrm dx}\sum_{r=1}^{1000}(1+x)^r=\sum_{r=1}^{1000}r(1+x)^{r}\\ &= (1+x)\frac{\mathrm d}{\mathrm dx}\left[\frac{1+x}{x}\left((1+x)^{1000}-1\right)\right]\\ &= (1+x)\left[\frac{1001(1+x)^{1000}}{x}-\frac{(1+x)^{1001}}{x^2}+\frac{1}{x^2}\right]\\ &= \frac{1001}{x}\cdot(1+x)^{1001}-\frac{1}{x^2}\cdot(1+x)^{1002}+\frac{1+x}{x^2}\end{aligned}$$
So as per this expression, the coefficient of $x^{111}$ should be $1001\cdot {1001 \choose 112}-{1002\choose 113}$. But the given answer is $1000\cdot{1001\choose 112}-{1001\choose 113}$. Can somebody spot where the mistake is? Thanks.
 [/INST] No, you did not make any mistake. Both your answer and the given answer are correct.
$$\begin{aligned}
&\left(1001\cdot {1001 \choose 112}-{1002\choose 113}\right)-\left(1000\cdot{1001\choose 112}-{1001\choose 113}\right)\\
&={1001 \choose 112}+{1001\choose 113}-{1002\choose 113}\\
&=0
\end{aligned}$$
</s>