$$\int \limits _0 ^\pi |\sin x + \cos x|\; dx$$
If I divide integral in two parts $\int\limits_0^{\frac{\pi}{2}}{(\sin x + \cos x)\,dx}$ and $\int\limits_{\frac{\pi}{2}}^\pi{(\sin x - \cos x)\,dx}$...I am getting $4$...Am I right?
$\endgroup$4 Answers
$\begingroup$Why do you split at $x=\pi/2$? You have to check where $\sin x + \cos x$ becomes negative on $[0,\pi]$ and that's not at $x=\pi/2$.
You want to split the integral so that you can lose the absolute value, but in order to do so you need to know where $\sin x + \cos x \ge 0$ and where $\sin x + \cos x \le 0$ on the given interval. This comes down to solving $\sin x + \cos x = 0$ for $x \in [0,\pi]$; does that help?
I'll add a hint to solve this equation: $$\cos x + \sin x = 0 \Leftrightarrow \sin x = -\cos x \Leftrightarrow \tan x = -1 \Leftrightarrow \cdots$$ Can you take it from here? You should end up with (b).
$\endgroup$ 8 $\begingroup$$$\sin x+\cos x=\sqrt2\sin(x+\frac\pi4)$$
There is a change of sign at $x+\frac\pi4=\pi$, hence you will split there:
$$\int_0^{3\pi/4}\sqrt2\sin(x+\frac\pi4)dx+\int_{3\pi/4}^\pi-\sqrt2\sin(x+\frac\pi4)dx.$$
$$-\sqrt2\cos\pi+\sqrt2\cos\frac\pi4+\sqrt2\cos\frac{5\pi}4-\sqrt2\cos\pi=2\sqrt2.$$
Note: the integrand has period $\pi$, so that you can shift the integration interval arbitrarily. In particular, staying in the positive range of the sine,
$$\int_{-\pi/4}^{3\pi/4}\sqrt2\sin(x+\frac\pi4)dx=-\sqrt2\cos\pi+\sqrt2\cos0=2\sqrt2.$$
$\endgroup$ $\begingroup$the function $|\sin x + \cos x| = \sqrt 2|\sin x+ \pi/4|$ is $\pi$-periodic and is symmetric about $x = \pi/2.$ use the fact $\int_0^{\pi/2} \sin x \, dx = 1.$ we can use three facts together to simplify $$\int_0^\pi |\sin x + \cos x|\,dx = 2\sqrt 2\int_{-\pi/4}^{\pi/4}\sin (x + \pi/4) = 2\sqrt 2. $$
$\endgroup$ $\begingroup$Though answers were already given, I'd like to suggest a different approach:
We see that the absolute value of $\cos(x) + \sin(x)$ is required.
Also, we are dealing with sinusoidal functions, which can be easily dealt with the square function, so:
$$
\begin{align}
\int\limits_0^\pi \lvert \cos(x) + \sin(x) \rvert &= \\
&= \int\limits_0^\pi \sqrt{\left(\cos(x) + \sin(x) \right)^2} \\
&= \int\limits_0^\pi \sqrt{\cos^2(x) + 2 \sin(x) \cos(x) + \sin^2(x) } \\
&= \int\limits_0^\pi \sqrt{1 + 2 \sin(x) \cos(x) } \\
&= \begin{bmatrix} \text{Sinusoidal identity:} \\ 2 \sin(x) \cos(x) = \sin(2x) \end{bmatrix} \\
&= \int\limits_0^\pi \sqrt{1 + \sin(2x) } \\
\end{align}
$$
Now we should notice the function that we're dealing with (omitting the root, insignificant):
Picture was taken from WA for 1 + sin(2x).
So we're performing a sum operation over the rooted sine-wave, treating all values as positive.
This is exactly like performing the same sum operation over the cosine function, with different limits - from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$ (due to phase shift symmetry):
$$
\begin{align} \int\limits_0^\pi \sqrt{1 + \sin(2x) } &= \\ &= \int\limits_{-\frac{\pi}{2}}^\frac{\pi}{2} \sqrt{1 + \cos(2x) } \\ &= \begin{bmatrix} \text{Sinusoidal identity:} \\ cos(2x) = 2 \cos^2(x) - 1 \end{bmatrix} \\ &= \int\limits_{-\frac{\pi}{2}}^\frac{\pi}{2} \sqrt{1 + 2 \cos^2(x) - 1 } \\ &= \sqrt{2} \, \int\limits_{-\frac{\pi}{2}}^\frac{\pi}{2} \cos(x) \\ &= 2\sqrt{2}
\end{align}
$$