# Error in my method of integrating $\int_{0}^{\pi/4} \sqrt{\tan x}dx$? [duplicate]

I got this challenge question on brilliant.org: $\int_{0}^{\pi/4}\sqrt{\tan x} dx$

I first used, $\int_{0}^{\pi/4}\sqrt{\tan(\pi/4-x)} dx$ which simplifies: $\int_{0}^{\pi/4}\sqrt{\frac{1-\tan x}{1+\tan x}} dx$

Then, I used Weierstrass's substitution by using $t=\tan(\frac{x}{2})$ and $dx=\frac{2}{1+t^2}$ and simplified: $2\int_{0}^{\tan(\pi/8)}\frac{1-t}{(1+t)(1+t^2)} dx$

After some manipulation, I calculated the integral to be $I=2\ln(\tan(\frac{x}{2}))-\ln(1+t^2)+c$ and $I(\pi/4)-I(0)=0.53$

But Desmos tells something different:

Have I done something wrong? I have rechecked a few times. But I find no error!

## marked as duplicate by Guy Fsone, José Carlos Santos, Matthew Conroy, Nosrati, jdodsNov 19 '17 at 20:32

• – Robert Z Nov 18 '17 at 16:41
• What happened to the square root in the step where you expanded $\tan(\pi/4-x)$? – Hans Lundmark Nov 18 '17 at 16:41
• Where did you put the squaroot after you change of variable? – Guy Fsone Nov 18 '17 at 16:42
• @GuyFsone Do the algebra – Partha Sarker Nov 18 '17 at 16:44
• @HansLundmark I edited. And I chose $t=tan(\frac{x}{2})$ – Partha Sarker Nov 18 '17 at 16:47

With $x\mapsto \pi/4-x$ you get $$\int_0^{\pi/4}\sqrt{\tan x}\,dx = \int_0^{\pi/4}\sqrt{\tan(\pi/4-x)}\,dx = \int_0^{\pi/4}\sqrt{\frac{1-\tan x}{1+\tan x}}\,dx$$ If $t=\tan(x/2)$, we have $\tan x=2t/(1-t^2)$, so $$\frac{1-\tan x}{1+\tan x}= \frac{1-\dfrac{2t}{1-t^2}}{1+\dfrac{2t}{1-t^2}}= \frac{1-2t-t^2}{1+2t-t^2}$$ which bears no similarity with your computation.
with $$t=\sqrt{\tan(x)}$$ we get $$2tdt=(1+\tan(x)^2)dx=(1+t^4)dx$$ thus $$dx=\frac{2dt}{1+t^4}dt$$ not that $$\tan(x)'=\frac{1}{\cos(x)^2}=\frac{\sin(x)^2+\cos(x)^2}{\cos(x)^2}$$
• I chose $t=tan(\frac{x}{2})$. – Partha Sarker Nov 18 '17 at 16:46