<s>[INST] How to solve $\iiint_T \frac{x}{\sqrt{x^2+y^2}}\,dx\,dy\,dz$? I need to solve the integral $$\iiint_T \frac{x}{\sqrt{x^2+y^2}}\,dx\,dy\,dz\,,$$ where $T$ is the domain blocked by the cylinder $x^2+y^2=2x$, the cone $z=\sqrt{x^2+y^2}+1$ and plane $z=0$.
The solution:

In order to understand exactly the relationship between $\theta $ and $ r $, we will look at the equation of the cylinder. The domain $T$ is blocked by a cylinder, so in $T$ there is $(x-1)^2 + y^2 \leq1 $. We will place the change of variables and we will get:
$$
\geq (r\cos\theta -1)^2+r^2\sin^2\theta =1+r^2-2r\cos\theta
$$
So $r\leq 2\cos\theta$.

I really struggle to understand the solution. Why, in order to find the constraint on $r$, did they have to perform inequality on the cylinder equation? Is it possible to explain the solution?
 [/INST] In $T$, you have $0<z<\sqrt{x^2+y^2}+1$ and then
$$\iiint_T \frac{x}{\sqrt{x^2+y^2}}\,dx\,dy\,dz=\iint_D\int_0^{\sqrt{x^2+y^2}+1}\frac{x}{\sqrt{x^2+y^2}}\,dz\,dx\,dy=$$
$$\iint_D\frac{x(\sqrt{x^2+y^2}+1)}{\sqrt{x^2+y^2}}\,dx\,dy=\iint_D x+\frac{x}{\sqrt{x^2+y^2}}\,dx\,dy$$
where $D$ is the projection of $T$ over $XY$ plane, that is, $x^2+y^2-2x\leq0$ or $(x-1)^2+y^2\leq1$. Working on polars coordinates
$$\int_{-\pi/2}^{\pi/2}\int_0^{2\cos(\theta)}\left(r\cos(\theta)+\cos(\theta)\right)r\,dr\,d\theta=\int_{-\pi/2}^{\pi/2} \frac{8 \cos ^4(\theta)}{3}+2 \cos ^3(\theta)\,d\theta=\boxed{\frac{8}{3}+\pi}$$
</s>