<s>[INST] How to find $\int_0^{2\pi} |a\cos(x)+b\sin(x)|dx$, where $a^2+b^2=1$ I need help to solve this integral:
$$\int_0^{2\pi} |a\cos(x)+b\sin(x)|dx$$  where $a^2+b^2=1$. I hope someone is able to help me.
 [/INST] Hint: Let $\phi$ be a number such that $a=\sin\phi$ and $b=\cos\phi$. You want to integrate $|\sin(x+\phi)|$. Maybe make the natural change of variable, or let the geometry guide you to the answer.
Remark: The "trick" above has a number of uses. The idea works even if $a^2+b^2\ne 1$. For suppose that $a^2+b^2\ne 0$. Note that 
$$a\cos x+b\sin x=\sqrt{a^2+b^2}\left(\frac{a}{\sqrt{a^2+b^2}}\cos x+\frac{b}{\sqrt{a^2+b^2}}\sin x\right).$$
Let $\phi$ be a number such that $a/\sqrt{a^2+b^2}=\sin \phi$ and $b/\sqrt{a^2+b^2}=\cos\phi$.
</s>