How can I integrate $(\tan x)^{1/2}$ People, I've been trying solve this problem but I always arrive in a complex equation, am I going at the right way ? 
$$ \int (\tan x)^{1/2}\, dx $$
 A: Substituting $t^2=\tan{x}$ gives $2t \, dt = \sec^{2}{x} \, dx = (1+t^4) \, dx $, so the integral is
$$ \frac{1}{2}\int \frac{dt}{1+t^4} $$
Now, this can be split into partial fractions using
$$ 1+t^4 = (1+\sqrt{2}t + t^2)(1-\sqrt{2}+t^2) $$
(don't feel bad if you didn't spot that: for a long time in the eighteenth century it was thought that this polynomial did not have a quadratic factorisation).
Now you just have to determine the partial fractions, and then it splits into things that you can do using arctangent and logarithms.

Okay, now we've found out where the problem is. Partial fractions are determined by making the guess
$$ \frac{1}{(1+\sqrt{2}t+t^2)(1-\sqrt{2}t+t^2)} = \frac{At+B}{1+\sqrt{2}t+t^2} + \frac{Ct+D}{1-\sqrt{2}+t^2}. $$
How do we arrive at this guess? You can show that the degrees of the numerators all have to be less than the degrees of the denominators in a case like this, so I have chosen the most general of this form. Now, we shall determine the constants. Multiply through by the denominator of the left-hand side:
$$ 1 = (At+B)(1-\sqrt{2}t+t^2) + (Ct+D)(1+\sqrt{2}t+t^2) $$
Now, both sides are polynomials in $t$. Therefore they are equal if and only if all the coefficients are the same (if you want a proof, think about the derivatives at $t=0$, for example). Hence we can consider each coefficient separately and obtain a different equation for each one: it will become apparent that these equations are enough to fix the coefficients. So, equating coefficients:
$$ \begin{align*}
1&: \quad 1 = B+D \\
t&: \quad 0 = A -\sqrt{2}B + C+\sqrt{2}D \\
t^2&: \quad 0 = -\sqrt{2}A + B +\sqrt{2}C + D \\
t^3&: \quad 0 = A+C \\
\end{align*} $$
Solving these equations gives
$$ A= \frac{1}{2\sqrt{2}} , \quad B = \frac{1}{2}, \quad C=-\frac{1}{2\sqrt{2}} \quad D= \frac{1}{2}, $$
so the partial fractions are
$$ \frac{1}{(1+\sqrt{2}t+t^2)(1-\sqrt{2}t+t^2)} = \frac{1}{2} \left( \frac{1+\frac{1}{\sqrt{2}}t}{1+\sqrt{2}t+t^2} + \frac{1-\frac{1}{\sqrt{2}}t}{1-\sqrt{2}+t^2} \right) $$

Lastly, to integrate a fraction of the form
$$ \frac{At+B}{t^2+2bt+c}, $$
notice that the derivative of the denominator is $2t+2b$, so
$$ \int \frac{At+B}{t^2+2bt+c} dt = \int \frac{A(t+b)+(B-Ab)}{t^2+2bt+c} dt \\
= \frac{A}{2}\int \frac{2t+2b}{t^2+2bt+c} \, dt + (B-Ab) \int \frac{dt}{t^2+2bt+c}.  $$
The first integrates to
$$ \frac{A}{2}\log{(t^2+2bt+c)}, $$
and the second can be brought into a form suitable for a tangent substitution:
$$ \int \frac{dt}{t^2+2bt+c} = \int \frac{dt}{(t+b)^2+(c-b^2)}, $$
and so has integral
$$ \frac{1}{\sqrt{c-b^2}}\arctan{\frac{t+b}{\sqrt{c-b^2}}}, $$
if $c>b^2$ (else, use a hyperbolic tangent substitution).
Putting all that together will give the result.
A: A nice and elegant $alternate$ approach would be two consider the integrals $I_1$ = $\sqrt{tanx} + \sqrt{cotx}$ and $I_2$ = $\sqrt{tanx} - \sqrt{cotx}$. Then the required integral is 1/2 ($I_1$ + $I_2$). I think at this stage it suffices to say that express these in terms of sin and cos and for $I_1$ put $sinx - cosx = t$. The answer not only comes in elegant form, but is also much simpler to arrive at.
A: HINT: let $x=arctg(u)\Rightarrow dx=\frac{du}{1+u^2}$
Therefore: $$\int (tan\:x)^{\frac{1}{2}}dx=\int{\frac{\sqrt{u}}{1+u^2}}du$$
