TITLE: Solve integral $\int^1_0 \frac{1-x^2}{{(1+x^2)}\sqrt{1+x^4}}dx$ using subsituition $\sqrt{1+x^4} = {(1+x^2)}\cos{\theta}$
QUESTION [6 upvotes]: Hi this question has been posed in my integration book where it has been asked to solve it using the given substitution or any other substitution, I've found identical question posted here {1} with different substitutions
The problem is when using the given substitution I end up with integral
$$\int^{\pi/4}_0 \frac{\sin{\theta}}{2x}d\theta $$
Solving for $x$ : $\sqrt{1+x^4} = {(1+x^2)}\cos{\theta}$
According to WolframAlpha: $$x = \frac{|\csc{\theta}||1 \pm \sqrt{\cos{2\theta}}|}{\sqrt{2}} $$
I do know the sign for x is $+ve$ so I'll take $+ve$ solutions after opening the modulus, I do not know which sign to prefer in  $ \pm \sqrt{\cos{2\theta}} $  term
Eitherway, I solved for both cases :
$$  \frac{1}{\sqrt{2}}\int^{\pi/4}_0\frac{\sin^2{\theta}}{1 + \sqrt{\cos{2\theta}}} d\theta -(I) $$
$$  \frac{1}{\sqrt{2}}\int^{\pi/4}_0\frac{\sin^2{\theta}}{1 - \sqrt{\cos{2\theta}}} d\theta -(II) $$
Which leads to :
$$  \frac{1}{\sqrt{2}}\int^{\pi/4}_0 1 \pm \sqrt{\cos{2\theta}} d\theta = \frac{\pi}{4\sqrt{2}}
\pm\frac{\Gamma(\frac{3}{4})^2}{2\sqrt{2}} $$
Here I cheated and used WolframAlpha as I was exhausted.
Both the cases lead to a similar answer with difference of a function unknown to me: $\pm\frac{\Gamma(\frac{3}{4})^2}{2\sqrt{2}}$
The correct answer is :
$$\frac{\pi}{4\sqrt{2}}$$
My main questions are:

What am I doing wrong?
How did author arrive at this ingenious  substitution $\sqrt{1+x^4} = {(1+x^2)}\cos{\theta}$ , this doesn't appear to me trial n' error kind of substitution, I have spent hours doing algebraic transformation on this and no matter how you procced and plug the variable your integrand will only have one of these terms only $2x$, $1-x^2$, $1+x^2$ and $ \sqrt{1+x^4}$ and $2x$ being the simplest.

Related question: How do I integrate the following? $\int{\frac{(1+x^{2})\mathrm dx}{(1-x^{2})\sqrt{1+x^{4}}}}$

REPLY [2 votes]: Let's begin with the substitution suggested in the question. We have $$\cos t=\frac{\sqrt{1+x^4}} {1+x^2}$$ ($\theta$ is replaced by $t$ to reduce burden of typing mathjax). Differentiating we get
\begin{align}
-\sin t \, dt&=\dfrac {(1+x^2)\cdot \dfrac{4x^3} {2\sqrt{1+x^4}} - 2x\sqrt{1+x^4}} {(1+x^2)^2} \, dx\notag \\
&=\dfrac {(1+x^2)\cdot \dfrac{2x^3} {\sqrt{1+x^4}} - 2x\sqrt{1+x^4}} {(1+x^2)^2} \, dx\notag \\
&= 2x\cdot\dfrac {(1+x^2)\cdot \dfrac{x^2} {\sqrt{1+x^4}} - \sqrt{1+x^4}} {(1+x^2)^2} \, dx\notag \\
&= 2x\dfrac { \dfrac{x^2(1+x^2)-(1+x^4)} {\sqrt{1+x^4}}} {(1+x^2)^2} \, dx\notag \\
&= 2x\dfrac { \dfrac{x^2-1} {\sqrt{1+x^4}}} {(1+x^2)^2} \, dx\notag \\
\implies \sin t \, dt&=\frac{2x(1-x^2)}{(1+x^2)^2\sqrt{1+x^4}}\, dx\notag\\
\end{align}
You need to double check your calculations as there is no cancellation in above to reduce the $(1+x^2)^2$ in denominator to $1+x^2$.
Next we note that $$\sin t =\frac{\sqrt {2}x}{1+x^2}$$ and therefore $$dt=\sqrt{2}\cdot\frac{1-x^2}{(1+x^2)\sqrt{1+x^4}}\,dx$$ or $$\frac{1-x^2}{(1+x^2)\sqrt{1+x^4}}\,dx=\frac{dt}{\sqrt{2}}$$ Integrating the above (noting that interval $[0,1]$ for $x$ maps to $[0,\pi/4]$ for $t$) we get $$I=\int_0^1\frac{1-x^2}{(1+x^2)\sqrt{1+x^4}}\,dx=\frac{1}{\sqrt {2}}\int_0^{\pi/4}\,dt=\frac{\pi}{4\sqrt{2}}$$