<s>[INST] Finding the complete Taylor expansion of $\frac{1}{1+z^2}$ around $z=0$. For an exercise, I need to find the complete Taylor expansion for $(1+z^2)^{-1}$ around $z=0$. I have tried decomposing first $(1+z^2)^{-1}$ into partial fractions. Since $1+z^2=0$ gives $z=\pm i$, the partial fractions are:
$$\frac{1}{1+z^2} = \frac{1}{(z+i)(z-i)} = \frac{i}{2(z+i)} - \frac{i}{2(z-i)} = \frac{i}{2} \Big{(}\frac{1}{z+i} - \frac{1}{z-i}\Big{)}$$
Therefore, my idea was to find the much easier Taylor expansion of both fractions, and add them together. I have worked out each Taylor expansion, since the $n$-th derivative of each of the fractions can be easily found:
$$\frac{1}{z+i}=\sum_{n=0}^\infty -i^{n+1}z^n, \hspace{25px} \frac{1}{z-i}=\sum_{n=0}^\infty \frac{-z^n}{i^{n+1}}$$
Typing each sum in WolframAlpha returns the original fraction, so I think they are okay. Now, I replace both sums into the partial fractions:
$$\frac{1}{1+z^2} = \frac{i}{2} \Big{(}\sum_{n=0}^\infty -i^{n+1}z^n - \sum_{n=0}^\infty \frac{-z^n}{i^{n+1}}\Big{)}$$
But I always get a sum that does not return the correct Taylor expansion for $1/(1+z^2)$. Where am I getting this wrong?
 [/INST] Since $\frac{1}{1+z^2} = \frac{1}{1-(-z^2)}$, the Taylor expansion around $z = 0$ (i.e., the Maclaurin series) would be the sum of an infinite Geometric series, i.e.,
$$\frac{1}{1+z^2} = \sum_{n=0}^{\infty}\left(-z^2\right)^n \tag{1}\label{eq1A}$$
with this being convergent for $|z^2| \lt 1$.
Regarding your work, since $\frac{1}{z+i} = \frac{i}{iz - 1} = \frac{-i}{1 - iz} = -i\left(\frac{1}{1-(iz)}\right)$, you get
$$\frac{1}{z+i} = -i\sum_{n=0}^{\infty}(iz)^n = \sum_{n=0}^{\infty}-i^{n+1}z^n 
\tag{2}\label{eq2A}$$
This matches what you got. Next, $\frac{1}{z-i} = \frac{i}{iz + 1} = \frac{i}{1 - (-iz)} = i\left(\frac{1}{1-(-iz)}\right)$, you get
$$\frac{1}{z-i} = i\sum_{n=0}^{\infty}(-iz)^n = \sum_{n=0}^{\infty}(-1)^n i^{n+1}z^n \tag{3}\label{eq3A}$$
With your terms, note
$$\begin{equation}\begin{aligned}
\frac{-1}{i^{n+1}} & = \frac{-i^{n+1}}{i^{2n+2}} \\
& = \frac{-i^{n+1}}{(i^{2})^{n+1}} \\
& = \frac{-i^{n+1}}{(-1)^{n+1}} \\
& = \frac{-(-1)^{n+1}i^{n+1}}{\left((-1)^{n+1}\right)^2} \\
& = -(-1)(-1)^{n}i^{n+1} \\
& = (-1)^{n}i^{n+1}
\end{aligned}\end{equation}\tag{4}\label{eq4A}$$
As you can see, it matches what I got, so there's nothing wrong there. However, I believe my version is easier to deal with. With the difference of \eqref{eq2A} and \eqref{eq3A}, note the even terms in \eqref{eq3A} have $i^{n+1}z^n$, so this doubles the term in \eqref{eq2A}, while the odd terms are the same and, thus, cancel out. In summary, you then get
$$\begin{equation}\begin{aligned}
\frac{1}{1+z^2} & = \frac{i}{2}\left(\sum_{n=0}^{\infty}-i^{n+1}z^n - \sum_{n=0}^{\infty}(-1)^n i^{n+1}z^n\right) \\
& = \frac{i}{2}\left(\sum_{n=0}^{\infty}(-1 - (-1)^n)i^{n+1}z^n\right) \\
& = \frac{i^2}{2}\left(\sum_{n=0}^{\infty}(-1 - (-1)^n)i^{n}z^n\right) \\
& = \frac{-1}{2}\left(\sum_{n=0}^{\infty}(-2)i^{2n}z^{2n}\right) \\
& = \sum_{n=0}^{\infty}i^{2n}z^{2n} \\
& = \sum_{n=0}^{\infty}(i^2z^2)^n \\
& = \sum_{n=0}^{\infty}(-z^2)^n
\end{aligned}\end{equation}\tag{5}\label{eq5A}$$
As you can see, this matches \eqref{eq1A}. As such, what you did was correct & I don't know why you think you weren't getting the correct result. If it was just due to the expression being different, as I show it simplifies to the same thing.
</s>