How to solve this? I am having difficulty in the very last step of the problem. The general solution of $\vert\sin x\vert = \cos x$ is -
(A) $2n\pi+{\pi\over4}$, $n\in I$
(B) $2n\pi±{\pi\over4}$, $n\in I$
(C) $n\pi+{\pi\over4}$, $n\in I$
(D) None of these
So what I did was - I made a case for when sinx is greater than 0 and equated it to $\cos x$ to get $\tan x = 1$ which implies x = $\pi\over 4$. The other case was when $\cos x = -\sin x$. Here, x = $3\pi\over 4$. I don't understand how to proceed from here.
 A: $$\cos x=|\sin x|\ge0$$
If $\sin x<0, \cos x=-\sin x\iff\tan x=-1$
As $x$ will lie in the $4$th quadrant, $ x=2n\pi-\dfrac\pi4$
What if $\sin x\ge0?$
A: Using Weierstrass substitution with $t=\tan\dfrac x2,$
$$1-t^2=2|t|$$
For real $t, t^2=|t|^2$ $$\implies |t|^2-2|t|-1=0$$
$$\implies|t|=1\pm\sqrt2$$
As $|t|\ge0, |t|=\sqrt2+1=\csc\dfrac\pi4+\cot\dfrac\pi4=\cdots=\cot\dfrac\pi8=\tan\left(\dfrac\pi2-\dfrac\pi8\right)$
$$\iff\tan^2\dfrac x2=\tan^2\left(\dfrac\pi2-\dfrac\pi8\right)$$
$$\implies\dfrac x2=n\pi\pm\left(\dfrac\pi2-\dfrac\pi8\right)$$
A: $\cos x$ is positive in the first and fourth quadrant and in these, $|\tan x|$ is $1$ for $x=\pm\dfrac\pi4$. Add $2n\pi$.
A: We will solve $\sin^{2}(x) = \cos^{2}(x)$, which is obtained upon squaring the equation (so we do not have to deal with sign issues).
$$\sin^{2}(x) = \cos^{2}(x)$$
$$\cos^{2}(x) -\sin^{2}(x) = 0$$
$$\cos(2x) = 0$$
$$x = \frac{\pi}{4} + \pi n, \frac{3\pi}{4} + \pi n$$
$$x = \frac{\pi}{4} + 2\pi n, \frac{5\pi}{4} + 2\pi n, \frac{3\pi}{4} + 2\pi n, \frac{7\pi}{4} + 2\pi n$$
Here, we split into cases of $2\pi n$ periodicity to take advantage of the properties of $\sin$ and $\cos$.
Checking these solutions in the original equation $\vert \sin(x)\vert = \cos (x)$, we find that only $\frac{\pi}{4} + 2\pi n$ and $\frac{7\pi}{4} + 2\pi n$ work. $\frac{7\pi}{4} + 2\pi n$ is equivalent to $-\frac{\pi}{4} + 2\pi n$, so the answer is $\boxed{(\text{B})\ \pm\frac{\pi}{4} + 2\pi n.}$
You can do a sanity check by drawing a quick graph and seeing if the functions intersect in the general region of the conjectured solution.
