Solve: $\sin \theta + \cos \theta = \sqrt{2}$
$\sin \theta + \cos \theta = \sqrt{2}$
i.e. $\;$ $\dfrac{1}{\sqrt{2}} \sin \theta + \dfrac{1}{\sqrt{2}} \cos \theta = 1$ $\;\;\; \cdots \; (1)$
i.e. $\;$ $\cos \left(\dfrac{\pi}{4}\right) \sin \theta + \sin \left(\dfrac{\pi}{4}\right) \cos \theta = 1$
i.e. $\;$ $\sin \left(\dfrac{\pi}{4} + \theta\right) = 1$
[Principal value of $\sin \theta$ is in $\left[- \dfrac{\pi}{2}, \dfrac{\pi}{2}\right]$ $\;$ i.e. $\;$ in first or fourth quadrants.]
$\because \;$ $\sin \left(\dfrac{\pi}{4} + \theta\right) = 1$ is positive
$\implies$ $\sin \left(\dfrac{\pi}{4} + \theta\right) = \sin \left(\dfrac{\pi}{2}\right)$
$\implies$ $\dfrac{\pi}{4} + \theta = n \pi + \left(-1\right)^n \left(\dfrac{\pi}{2}\right)$
$\therefore \;$ $\theta = n \pi + \left(-1\right)^n \left(\dfrac{\pi}{2}\right) - \dfrac{\pi}{4}, \;\;\; n \in Z$
OR
Equation $(1)$ can also be written as
$\cos \left(\dfrac{\pi}{4}\right) \; \cos \theta + \sin \left(\dfrac{\pi}{4}\right) \; \sin \theta = 1$
i.e. $\;$ $\cos \left(\theta - \dfrac{\pi}{4}\right) = 1$ $\;\;\;$ [i.e. $\;$ $\cos \left(\theta - \dfrac{\pi}{4}\right)$ is positive]
$\left\{\text{Principal value of } \cos x \text{ lies in } \left[0, \pi\right] \text{ i.e. in first or second quadrants} \right\}$
$\therefore \;$ We have $\cos \left(\theta - \dfrac{\pi}{4}\right) = 1 = \cos 0$
i.e. $\;$ $\theta - \dfrac{\pi}{4} = 2 m \pi \pm 0$
i.e. $\;$ $\theta = 2 m \pi + \dfrac{\pi}{4}, \;\;\; m \in Z$