TITLE: Dividing numerator and denominator of integrand in definite integral
QUESTION [6 upvotes]: 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?

REPLY [2 votes]: Previous answers did not address your question of whether your method is invalid due to division by zero. That is what I will address here.
There are two ways to evade the problem. The cheat way is to observe that meromorphic functions are closed under division except dividing by the everywhere-zero function, and we eliminate removable singularities. In this setting, multiplication by $u/u$ in your integral computation would not be a problem, because it is equivalent to multiplying by the constant-one function. You would also have to use the fact that if a meromorphic function $f$ on a domain $D ⊆ ℂ$ has an anti-derivative $g$, then $g{↾}(D{∖}S)$ is the unique anti-derivative of $f{↾}(D{∖}S)$ for any set $S$ of isolated points. So it does not matter if you cut off some isolated points and find the anti-derivative, because you can then extend it back (if the original function had an anti-derivative). This general fact is why you will never really encounter a problem with division by zero for sufficiently nice functions, even if the method as stated is technically wrong.
A more concrete way is to observe that $\int_0^1 f(u)\ du = \lim_{t→0^+} \int_t^1 f(u)\ du$ if the former exists, and so once you find $\int_t^1 f(u)\ du = g(t)$ for every $t∈ℝ^+$, you can then take limits, no problem.