<s>[INST] $\int_{0}^{\pi}|\sqrt2\sin x+2\cos x|dx$ $\int_{0}^{\pi}|\sqrt2\sin x+2\cos x|dx$
MyAttempt
$\int_{0}^{\pi}|\sqrt2\sin x+2\cos x|=\int_{0}^{\pi/2}\sqrt2\sin x+2\cos x dx+\int_{\pi/2}^{\pi}|\sqrt2\sin x+2\cos x| dx$
I could solve first integral but in second one,i could not judge the mod will take plus sign or minus sign or how to break it in further intervals?
 [/INST] We Can Write $\displaystyle \sqrt{2}\sin x+2\cos x = \sqrt{\left(\sqrt{2}\right)^2+2^2}\left\{\frac{\sqrt{2}}{\sqrt{6}}\sin x+\frac{2}{\sqrt{6}}\cos x\right\}$
$\displaystyle  = \sqrt{6}\left\{\sin x\cdot \frac{1}{\sqrt{3}}+\cos x\cdot \frac{2}{\sqrt{6}}\right\} = \sqrt{6}\left\{\sin x\cdot \cos \alpha+\cos x\cdot \sin \alpha\right\} = \sqrt{6}\cdot \sin (x+\alpha)$
Where $$\displaystyle \sin \alpha = \frac{2}{\sqrt{6}}$$ and $$\displaystyle \cos \alpha = \frac{1}{\sqrt{3}}$$ and $$\displaystyle \tan \alpha = \sqrt{2}$$ . So $\displaystyle \frac{\pi}{4}<\alpha <\frac{\pi}{3}$
So Integral Convert into $$\displaystyle \sqrt{6}\int_{0}^{\pi}\left|\sin (x+\alpha)\right|dx$$
Let $(x+\alpha) = t\;,$ Then $dx = dt$ and Changing Limit, we get
$$\displaystyle I = \sqrt{6}\int_{\alpha}^{\pi+\alpha}|\sin t|dt = \sqrt{6}\int_{\alpha}^{\pi}\sin tdt-\sqrt{6}\int_{\pi}^{\pi+\alpha}\sin tdt $$
So we get $$\displaystyle I = \sqrt{6}\left(1+\cos \alpha\right)+\sqrt{6}\left(-\cos \alpha +1\right) = 2\sqrt{6}$$
</s>