<s>[INST] Unable to represent the function as a power series Assuming I have this function below :
$$f(x) =  \frac{(x-1)}{x^2+1}$$
How do I represent it as a power series ?
The only solution that I know is when using the geometric series :
$\sum_{k=1}^\infty q^k = \frac{1}{1-q}$ but this is not possible in our case .
 [/INST] $$\frac{x-1}{x^2+1}=\frac{x}{x^2+1}-\frac{1}{x^2+1}$$
Integrate
$$\int\left(\frac{x}{x^2+1}-\frac{1}{x^2+1}\right)\,dx=\frac{1}{2}\log(1+x^2)+\arctan x+C$$
Series for these functions are known, we get
$$\frac{1}{2}\log(1+x^2)-\arctan x+C=\frac{x^{10}}{10}-\frac{x^9}{9}-\frac{x^8}{8}+\frac{x^7}{7}+\frac{x^6}{6}-\frac{x^5}{5}-\frac{x^4}{4}+\frac{x^3}{3}+\frac{x^2}{2}-x+O(x^{11})+C$$
Now differentiate all terms
$$\frac{x-1}{x^2+1}=-1 + x + x^2 - x^3 - x^4 + x^5 + x^6 - x^7 - x^8 + x^9+O(x^{10})$$
bonus
$$\frac{x-1}{x^2+1}=\sum _{n=0}^{\infty } a_n x^n;\quad a_n=3 n^2+n+3-4 \left\lfloor \frac{1}{4} \left(3 n^2+n+4\right)\right\rfloor $$
</s>