# How do i do this integral?

1. Aug 11, 2012

### XtremePhysX

1. The problem statement, all variables and given/known data

Evaluate

2. Relevant equations

$$I=\int_0^{\pi/2}x\cot(x)\,dx$$

3. The attempt at a solution

I tried IBP, didn't work at all.

2. Aug 11, 2012

### Vorde

That is a nasty integral, does it have to be an exact answer or can it be approximate?

3. Aug 11, 2012

### XtremePhysX

Exact. I did this but not sure if it is correct: $$I=\int_0^{\pi/2}x\cot(x)\,dx=\int_0^{\pi/2}(\pi/2-x)\tan(x)\,dx$$

4. Aug 11, 2012

### Vorde

No that's not a correct representation. $tan(\frac{\pi}{2}-x)$ is though, not sure if that helps however.

5. Aug 12, 2012

### XtremePhysX

If you add both of them, xcot(x) and (pi/2-x)tan(x) you get 2I and I think it is relatively easy from there. But I'm not sure if this is correct.

$$I=\int_0^{\pi/2}x\cot(x)\,dx=\int_0^{\pi/2}(\pi/2-x)\tan(x)\,dx\\ \Rightarrow 2I=\int_0^{\pi/2}\frac{2x\cos^2(x)+2(\pi/2-x)\sin^2(x)}{2\sin(x)\cos(x)}\, dx\\=\int_0^{\pi/2}\frac{2x\cos(2x)+\frac{\pi}{2}(1-\cos(2x))}{\sin(2x)}\,dx\\\Rightarrow 4I=\int_0^{\pi}\frac{x\cos(x)+\frac{\pi}{2}(1-\cos(x))}{\sin(x)}\, dx\\=\int_0^{\pi/2}x\cot(x)\,dx+\frac{\pi}{2}\int_0^{\pi/2}\csc(x)-\cot(x)\,dx+\int_{\pi/2}^\pi (x-\pi)\cot(x)\,dx+\frac{\pi}{2}\int_{\pi/2}^\pi\csc(x)+\cot(x)\,dx\\=2I+\pi\int_0^{\pi/2}\csc(x)-\cot(x)\,dx\\=2I-\pi\log|1+\cos(x)|]^{\pi/2}_0\\\Rightarrow I=\frac{\pi}{2}\log(2).$$

6. Aug 12, 2012

### gabbagabbahey

Yes it is: $\int_0^a f(x)dx = \int_0^a f(a-x)dx$ and $\cot \left( \frac{\pi}{2} - x \right) = \tan(x)$

Everything look fine up until your fifth line. Your last two terms should be $\int_{\frac{\pi}{2}}^{\pi}x \cot x dx = \int_0^{\frac{\pi}{2}} (x-\pi) \cot x dx$ and $\frac{\pi}{2} \int_{\frac{\pi}{2}}^{\pi} (\csc x - \cot x)dx = \frac{\pi}{2} \int_0^{\frac{\pi}{2}} (\csc x + \cot x)dx$, respectively.

7. Aug 12, 2012

### Vorde

You're totally right, been stumped all day to what I was doing wrong but I just figured it out. Sorry to the OP for saying incorrect stuff.

8. Aug 13, 2012

### XtremePhysX

It's all good =)