<s>[INST] The following equation to solve :$ \tan x+\cot x=\sqrt{2}(\cos x+\sin x)$ The following equation to solve :
$$ \tan x+\cot x=\sqrt{2}(\cos x+\sin x)$$
My try:
$$\frac{2}{\sin 2x}=\sqrt{2}(\cos x+\sin x)$$
$$\left(\frac{2}{\sin 2x}\right)^2=(\sqrt{2}(\cos x+\sin x))^2$$
$$\left(\frac{2}{\sin 2x}\right)^2=2(1+\sin 2x)$$
$$2\sin^2 2x +2\sin ^3 2x=4$$
$$2\sin^2 2x +2\sin ^3 2x-4=0$$
$t=\sin 2x$
$$2t^3+2t^2-4=(t-1)(t^2+2t+4)$$
$$\sin 2x =1\\$$
is it right ?
 [/INST] Excluding $\sin x\cos x=0$, you can rewrite 
$$\sqrt2(\cos x+\sin x)\sin x\cos x=1$$
or
$$\sin\left(x+\frac\pi4\right)\sin(2x)=1.$$
For this product to be $1$, both factors must be $1$ or $-1$.
Then
$$x+\frac\pi4=k\pi+\frac\pi2,\\2x=l\pi+\frac\pi2,$$
where $k$ and $l$ have the same parity. Then as $l=2k$, $l$ and $k$ are even and
$$x=2n\pi+\frac\pi4.$$
</s>