how to solve $\int\frac{x^2}{x^2+1}dx$ by using series I want to solve $\int\frac{x^2}{x^2+1}dx$ by using series, but I did something wrong.
Correct solution:
\begin{align*}
\int\frac{x^2}{x^2+1}dx &amp;= \int\frac{(x^2+1)-1}{x^2+1}dx \\
&amp;= \int\left(1-\frac{1}{x^2+1}\right)dx\\
&amp;= x-\arctan(x)+C\\
&amp;= x-\left(x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}-\frac{x^{12}}{12}+\cdots\right)+C\\
&amp;= C+\frac{x^3}{3}-\frac{x^5}{5}+\frac{x^7}{7}-\frac{x^9}{9}+\frac{x^{12}}{12}-\cdots
\end{align*}
My wrong solution:
\begin{align*}
\int\frac{x^2}{x^2+1}dx &amp;= \int\frac{1}{1+(\frac{1}{x^2})}dx\\
&amp;= \int\frac{1}{1+u}dx\text{ ; }u=\frac{1}{x^2}\\
&amp;= \int\left(1-u+u^2-u^3+u^4-\cdots\right)dx\text{ ; }\frac{1}{x+1}=1-x+x^2-x^3+x^4-\cdots\\
&amp;= \int\left(1-\frac{1}{x^2}+\frac{1}{x^4}-\frac{1}{x^6}+\frac{1}{x^8}-\cdots\right)dx\\
&amp;= C+x+\frac{1}{x}-\frac{1}{3x^3}+\frac{1}{5x^5}-\frac{1}{7x^7}+\cdots\\
\end{align*}
What did I do wrong?
Why didn't I get the correct answer?
Both series are good, but for different domains, Note that when we use this form of binomial expansion:
$$(1+y)^{-1}$$
we require $|y|&lt;1$ and so in the first series it is valid for the domain of the arctan series, whilst the second one is valid for $|x|&gt;1$ which is why there is a difference.

One thing to note is when you integrate make sure it is wrt the correct variable. if you make a substitution $u=f(x)$ you must calculate $du$
$$\frac{x^2}{1+x^2}=1-\frac1{1+x^2},$$ which integrates as $x-\arctan x$.
Or, using Taylor (or a geometric summation),
$$1-1+x^2-x^4+x^6-\cdots$$
which integrates as
$$c+\frac{x^3}3-\frac{x^5}{5!}+\frac{x^7}{7!}-\cdots$$