Question:
If $\sin x+\cos x=a$, find the value of $|\sin x-\cos x|$.
Solution:
Given: $\sin x+\cos x=a$
Now,
$(\sin x+\cos x)^{2}+(\sin x-\cos x)^{2}=\sin ^{2} x+\cos ^{2} x+2 \sin x \cos x+\sin ^{2} x+\cos ^{2} x-2 \sin x \cos x$
$\Rightarrow(\sin x+\cos x)^{2}+(\sin x-\cos x)^{2}=2\left(\sin ^{2} x+\cos ^{2} x\right)$
$\Rightarrow(\sin x+\cos x)^{2}+(\sin x-\cos x)^{2}=2$
$\therefore a^{2}+(\sin x-\cos x)^{2}=2$
$\Rightarrow(\sin x-\cos x)^{2}=2-a^{2}$
$\Rightarrow \sqrt{(\sin x-\cos x)^{2}}=\sqrt{2-a^{2}}$
$\Rightarrow|\sin x-\cos x|=\sqrt{2-a^{2}} \quad\left(\sqrt{x^{2}}=|x|\right)$
Thus, the required value is $\sqrt{2-a^{2}}$.