<s>[INST] Partial fractions for $\left (\frac{z^2+1}{z^2-1} \right )^2$ I am trying to decompose this function: $$\left (\frac{z^2+1}{z^2-1}  \right )^2$$ into partial fractions.
What I've done up to now is this:
$$\frac{z^2+1}{(z-1)(z+1)}=\frac{A}{z-1}+\frac{B}{z+1}$$
Which doesn't give me the correct $A$ and $B$.
What is wrong with the not-squared experssion?
 [/INST] $$\frac{z^2+1}{z^2-1}=1+\frac{2}{z^2-1}=1+\frac{1}{z-1}-\frac{1}{z+1}\tag{1}$$
hence by squaring the previous line:
$$\left(\frac{z^2+1}{z^2-1}\right)^2 = 1+\frac{1}{(z-1)^2}+\frac{1}{(z+1)^2}+\frac{2}{z-1}-\frac{2}{z+1}-\frac{2}{z^2-1}\tag{2}$$
so, using $(1)$ again:
$$\left(\frac{z^2+1}{z^2-1}\right)^2 = 1+\frac{1}{(z-1)^2}+\frac{1}{(z+1)^2}+\frac{1}{z-1}-\frac{1}{z+1}.\tag{3}$$
</s>