<s>[INST] Expressing the $n$–th derivative of $y=\frac{1}{(1+x^2)^2}$ In an attempt to find a way to express the n-th derivative of $y=\frac{1}{(1+x^2)^2}$ using the binomial theorem I got stuck in the last computation.
I'll explain what I did:
$$f(x)=\frac{1}{(1+x^2)^2}=\frac{1}{(x+i)^2(x-i)^2}=\\
\frac{i}{4}\left( \frac{1}{x+i} \right)-\frac{1}{4}\left( \frac{1}{(x+i)^2} \right)-\frac{i}{4}\left( \frac{1}{x-i} \right)-\frac{1}{4}\left( \frac{1}{(x-i)^2} \right)$$
Then I used $y=\frac{1}{ax+b} \Rightarrow y_{n}=\frac{(-1)^nn!a^n}{(ax+b)^{n+1}}$ and $y=\frac{1}{(ax+b)^2} \Rightarrow y_{n}=\frac{(-1)^n(n+1)!a^n}{(ax+b)^{n+2}}$ to get:
$$\frac{(-1)^n}{4}\left( in!\left( \frac{(x-i)^{n+1}-(x+i)^{n+1}}{(x^2+1)^{n+1}} \right)-(n+1)!\left( \frac{(x-i)^{n+2}+(x+i)^{n+2}}{(x^2+1)^{n+2}} \right) \right)$$
Then I stopped for a second and I analized $(x-i)^{n+1}-(x+i)^{n+1}$ and $(x-i)^{n+2}+(x+i)^{n+2}$ using the binomial theorem:
-
$(x-i)^{n+1}-(x+i)^{n+1}$ = $$\sum_{k=0}^{n+1}\binom{n+1}{k}x^{n+1-k}\cdot i^k((-1)^k-1)$$
$i^k((-1)^k-1) =0$ for $k=2n$ ,whereas for $k=2n+1$ $\longrightarrow$$-2i(-1)^{\frac{k-1}{2}}$
-
$(x-i)^{n+2}+(x+i)^{n+2}$ = $$\sum_{k=0}^{n+2}\binom{n+2}{k}x^{n+2-k}\cdot i^k((-1)^k+1)$$
$i^k((-1)^k+1) =0$ for $k=2n+1$ , whereas for $k=2n$ $\longrightarrow$$2(-1)^{\frac{k}{2}}$.
And now I got stuck sorting out the indeces $n,k$ of summations; what I obtain is:
$$\frac{d^n}{dx^n}(f(x))=\\
 \frac{(-1)^nn!}{2(x^2+1)^{n+1}}\cdot \sum_{k=1}^{n+1}\binom{n+1}{k}x^{n+1-k}(-1)^{\frac{k-1}{2}} - \frac{(-1)^n(n+1)!}{2(x^2+1)^{n+2}}\cdot \sum_{k=2}^{n+2}\binom{n+2}{k}x^{n+2-k}(-1)^{\frac{k}{2}}$$
But testing it I can see it’s wrong.
Can anyone help me please sorting the $n,k$ indices and perhaps have a look at my computations also?
Thank you
 [/INST] The analysis and the result stated in OPs answer are sound (+1). Since I also did already the calculation, here it is together with a few hints.

We obtain
\begin{align*}
&\color{blue}{D^n}\color{blue}{f(x)}\\
&=\frac{i}{4}(-1)^nn!\frac{(x-i)^{n+1}-(x+i)^{n+1}}{\left(x^2+1\right)^{n+1}}\\
&\qquad-\frac{1}{4}(-1)^n(n+1)!\frac{(x-i)^{n+2}+(x+i)^{n+2}}{\left(x^2+1\right)^{n+2}}\tag{1}\\
&=\frac{i(-1)^nn!}{4\left(x^2+1\right)^{n+1}}\sum_{k=0}^{n+1}\binom{n+1}{k}x^{n+1-k}i^k\left((-1)^k-1\right)\\
&\qquad-\frac{i(-1)^n(n+1)!}{4\left(x^2+1\right)^{n+2}}\sum_{k=0}^{n+2}\binom{n+2}{k}x^{n+2-k}i^k\left((-1)^k+1\right)\tag{2}\\
&=-\frac{(-1)^{n}n!}{4\left(x^2+1\right)^{n+1}}\sum_{k\geq 0}\binom{n+1}{2k+1}x^{n-2k}(-1)^k(-2)\\
&\qquad-\frac{(-1)^n(n+1)!}{4\left(x^2+1\right)^{n+2}}\sum_{k\geq 0}\binom{n+2}{2k}x^{n+2-2k}(-1)^k\cdot 2\tag{3}\\
&\,\,\color{blue}{=\frac{(-1)^nn!}{2\left(x^2+1\right)^{n+2}}\left(\left(x^2+1\right)\sum_{k\geq 0}\binom{n+1}{2k+1}(-1)^kx^{n-2k}\right.}\\
&\qquad\qquad\qquad\qquad\color{blue}{-\left.(n+1)\sum_{k\geq 0}\binom{n+2}{2k}(-1)^kx^{n+2-2k}\right)}\tag{4}
\end{align*}

Comment:

*

*In (2) we apply the binomial theorem and collect terms with equal power.


*In (3) we observe that in the left-hand sum terms with even powers vanish. We take odd indices $k\to 2k+1$ only. Note we take the index range $k\geq 0$ which is admissible, since $\binom{n}{k}=0$ if $k>n$. In the right-hand sum terms with odd powers vanish and we take even indices $k\to 2k$ only.


*In (4) we simplify further by factoring out the common denominator $\left(x^2+1\right)^{n+2}$.
Note: The answer stated by @Turing is nice and correct. We observe there is just one common denominator $(x-i)^{n+2}(x+i)^{n+2}=\left(x^2+1\right)^{n+2}$. We could think to also transform (1) this way to get another binomial expansion which is somewhat different to (4).
</s>