Evaluate $\int_0^{2\pi} |x \cos(\theta)+y \sin(\theta)|\, d\theta$ I am required to prove that $\displaystyle \int_0^{2\pi} |x \cos(\theta)+y \sin(\theta)|\, d\theta= 4\sqrt{x^2+y^2}$, $\ x$ and $y$ are real. 
I let $\sin\theta = \frac yz$, $\cos\theta=\frac xz$, where $z$ is supposedly complex. 
Then i managed to show that $x\cos\theta + y\sin\theta = z$, so i am left with integrating $|z|$ (which is the area of a circle?) 
I am stuck here since the RHS of what i am supposed to prove, doesn't have pi inside. 
Please advise, thanks!!
 A: Since $x=r\cos\alpha$ and $y=r\sin\alpha$ for some $\alpha$ with $r=\sqrt{x^2+y^2}$, the integral is
$$
r\int_0^{2\pi}|\cos(\theta-\alpha)|\mathrm d\theta=r\int_0^{2\pi}|\cos(\theta)|\mathrm d\theta=4r\int_0^{\pi/2}\cos(\theta)\mathrm d\theta=4r\,\left[\sin(\theta)\right]_0^{\pi/2}=4r.
$$
A: Note that $x$ and $y$ are fixed real numbers.
The way to do this is to set $x=r\sin\phi$, $y=r\cos\phi$ so that $x^2+y^2=r^2$ and $\phi = \arctan {\frac x y}$.
Then the integrand becomes $\left|r\sin (\theta + \phi)\right|$. The factor $r$ can be extracted, and since the integral is around the unit circle, you need double the integral for the interval over which $sin (\theta + \phi) \geq 0$.
A: Put $x=r\cos t$ and $y=r\sin t=>r=\sqrt{x^2+y^2}$    and $t=tan^{-1}\frac{y}{x}$
$\displaystyle \int_0^{2\pi} |x \cos(\theta)+y \sin(\theta)|\, d\theta$
$=\sqrt{x^2+y^2}\displaystyle \int_0^{2\pi} | \cos(\theta -t)|\, d\theta$ assuming x,y are independent of $\theta$
Now $\cos x<0$ for $\frac{\pi}{2}<x<\frac{3\pi}{2}$ and $\cos x≥0$, elsewhere
As the given range is 0 to $2\pi$ and $\cos(2\pi s+x)=\cos x$ for integral s, we can safely break the definite integral into the 4 quadrants i.e.,
$\displaystyle \int_0^{2\pi} | \cos(\theta -t)|\, d\theta$
$=\displaystyle \int_t^{\frac{\pi}{2}+t} \cos(\theta -t)\, d\theta$
$+\displaystyle \int_{\frac{\pi}{2}+t}^{\pi+t} (-\cos(\theta -t))\, d\theta$
$+\displaystyle \int_{\pi+t}^{\frac{3\pi}{2}+t}(-\cos(\theta -t))\, d\theta$
$+\displaystyle \int_{\frac{3\pi}{2}+t}^{2\pi+t} \cos(\theta -t)\, d\theta$
$=\sin(\theta-t)|_t^{\frac{\pi}{2}+t}$
$-\sin(\theta-t)|_{\frac{\pi}{2}+t}^{\pi+t}$
$-\sin(\theta-t)|_{\pi+t}^{\frac{3\pi}{2}+t}$
$+\sin(\theta-t)|_{\frac{3\pi}{2}+t}^{2\pi+t}$
$=(1-0)-(0-1)-(0-1)+(1-0)=4$
$\displaystyle \int_0^{2\pi} |x \cos(\theta)+y \sin(\theta)|\, d\theta=4\sqrt{x^2+y^2}$
