#### Explain solution RD Sharma class 12 Chapter 19 Definite Integrals Exercise Revision Exercise question 31

Answer:  $2\sqrt{2}-2$

Hint: To solve this question we will split $\sin x.\cos x$ in two forms.                   $\left[\begin{array}{l} \because \sin x=\cos x \\ \tan x=1 \\ x=\frac{\pi}{4} \end{array}\right]$

Given:   $\int_{0}^{\frac{\pi}{2}}|\sin x-\cos x| d x$

Solution:

\begin{aligned} &\int_{0}^{\frac{\pi}{4}}(\sin x-\cos x) d x+\int_{\frac{\pi}{4}}^{\frac{\pi}{2}}(\sin x-\cos x) d x \\ & \end{aligned}

$=-[-\cos x-\sin x]_{0}^{\frac{\pi}{4}}+[-\cos x-\sin x]_{\frac{\pi}{4}}^{\frac{\pi}{2}}$                                                                $\left[\begin{array}{l} |x|=-x, x<0 \\ =x, x>0 \end{array}\right]$

\begin{aligned} &=-[\cos x-\sin x]_{0}^{\frac{\pi}{4}}-[\cos x+\sin x]_{\frac{\pi}{4}}^{\frac{\pi}{2}} \\ & \end{aligned}

$=\left(\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}\right)-(1+0)-\left[(0+1)-\left(\frac{1}{\sqrt{2}}+\frac{1}{\sqrt{2}}\right)\right] \\$

$=2 \sqrt{2}-2$