<s>[INST] How to integrate $\int_{1}^{3} {\frac{x^2 - 1}{x^4 + 1}}\, dx$ $$\int_{1}^{3} {\frac{x^2 - 1}{x^4 + 1}}\, dx$$
Well, I can simplify the numerator:
$$\int_{1}^{3} {\frac{(x - 1)(x+1)}{x^4 + 1}}\, dx$$
But I have no idea how to simplify the denumenator:
$$\ x^4+1=? \ $$
How to solve this integral?
 [/INST] We will first compute the integral without bounds. Start off by rewriting the integral using partial fractions:
$$\int \frac{-2\sqrt{2}x - 2}{4(x^2 + \sqrt{2}x + 1)} + \frac{2 - 2\sqrt{2}x}{4(-x^2 + \sqrt{2}x - 1)} \ \mathrm{d}x.$$
Note that we can split this into two integrals to get
$$\int \frac{-2\sqrt{2}x - 2}{4(x^2 + \sqrt{2}x + 1)}\ \mathrm{d}x + \int \frac{2 - 2\sqrt{2}x}{4(-x^2 + \sqrt{2}x - 1)} \ \mathrm{d}x.$$
Factoring out the constants on both sides, we obtain
$$\frac{1}{2\sqrt{2}} \int \frac{\sqrt{2} - 2x}{-x^2 + \sqrt{2}x - 1}\ \mathrm{d}x +
\frac{1}{4} \int \frac{-2\sqrt{2}x - 2}{x^2 + \sqrt{2}x +1} \ \mathrm{d}x.$$
Now, make the change of variable
$$ u = -x^2 + \sqrt{2}x - 1 \qquad \therefore \qquad \mathrm{d}u = (\sqrt{2} - 2x)\mathrm{d}x.$$
Hence, rewriting the integrand, we have
$$\frac{1}{2\sqrt{2}} \int \frac{1}{u}\ \mathrm{d}u +
\frac{1}{4} \int -\frac{\sqrt{2}(2x + \sqrt{2})}{x^2 + \sqrt{2}x +1} \ \mathrm{d}x,$$
which is the same as writing
$$\frac{1}{2\sqrt{2}} \int \frac{1}{u}\ \mathrm{d}u -
\frac{1}{2\sqrt{2}} \int \frac{2x + \sqrt{2}}{x^2 + \sqrt{2}x +1} \ \mathrm{d}x.$$
We can do a similar change of variable here by letting
$$ s = x^2 + \sqrt{2}x + 1 \qquad \therefore \qquad \mathrm{d}s = (\sqrt{2} + 2x)\mathrm{d}x.$$
This gives
$$\frac{1}{2\sqrt{2}} \int \frac{1}{u}\ \mathrm{d}u -
\frac{1}{2\sqrt{2}} \int \frac{1}{s} \ \mathrm{d}s.$$
It is now easy to integrate both sides and substitute $u$ and $s$ back after integration. You should obtain
$$ \int \frac{x^2 - 1}{x^4+1} \ \mathrm{d}x = 
\frac{1}{2\sqrt{2}} \left[\log(-x^2 + \sqrt{2}x - 1) - \log(x^2 + \sqrt{2}x + 1)\right] + C,$$
for some constant $C$. It now remains to integrate from $1$ to $3$, which should be a straightforward task from here.
</s>