Dividing numerator and denominator of integrand in definite integral I'm trying to solve the following definite integral $$\int_0^{\frac{\pi}{4}} \sqrt{\tan  x}\,dx$$
First, I made the substitution $u = \sqrt{\tan x}$
And arrived with: $$\int_0^1 \frac{2u^2}{u^4+1}\,du$$
When divided both numerator and denominator of the integrand by $u^2$ and with some manipulation I got
$$\int_0^1 \frac{1+\frac{1}{u^2}}{(u-\frac{1}{u})^2+2}+\frac{1-\frac{1}{u^2}}{(u+\frac{1}{u})^2-2}\, du$$
This integral could be solved easily with u sub, giving the result:
$$\left.\frac{1}{2\sqrt{2}} \ln\left|\frac{u^2-\sqrt{2}u+1}{u^2+\sqrt{2}u+1}\right|+\frac{1}{\sqrt{2}}\arctan\left(\frac{1}{\sqrt{2}}\left(u-\frac{1}{u}\right)\right)\ \right|_0^1$$
The integral however is not defined at $u=0$, my question is: Are we allowed to do this kind of manipulation to definite integrals with rational function, and will proceeding with improper integral yield the correct result?

I don't think the best thing to do is divide by $u^2$. I think this can solve your problem:
\begin{align*}
\int_0^1 \frac{2u^2}{u^4+1}\ du&=\frac{1}{\sqrt2}\int_0^1\frac{u}{u^2-\sqrt2u+1}\ du-\frac{1}{\sqrt2}\int_0^1\frac{u}{u^2+\sqrt2u+2}\ du\\[2mm]
&=\frac{1}{\sqrt2}\int_0^1\frac{u}{\left(u-\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\ du-\frac{1}{\sqrt2}\int_0^1\frac{u}{\left(u+\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\ du\\[2mm]
&=\frac{1}{2\sqrt 2}\ln\left|\frac{2x^2-2\sqrt2 x+2}{2x^2+2\sqrt2x+2}\right|-\frac{1}{\sqrt2}\arctan(\sqrt2x-1)+\frac{1}{\sqrt2}\arctan(\sqrt2x+1)\Big\vert_0^1\\[2mm]
&=\frac{\pi +\ln(3-2\sqrt 2)}{2\sqrt2}\\[2mm]
&\approx 0.487495
\end{align*}
