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 ?
 A: Way back at the first line, you could say "$\cos x + \sin x$ is maximized at $x = \pi/4$, with value $\sqrt{2}$, so the right hand side is no more than 2; the left hand side, on the other hand, (for $\sin 2x $ positive, at least) is at least 2. To make these equal, you need either


*

*$\sin 2x = 1$ and $\cos x + \sin x = \sqrt{2}$ or

*$\sin 2x = -1$ and $\cos x + \sin x = -\sqrt{2}$
Now it's pretty easy to solve, and you don't need to mess with any cubics, etc. 
But you asked if your solution was right, so let me address that. Right at the point where you squared both sides, you introduced the possibility of spurious roots, where the two sides are negatives of each other, but their squares are equal. You need to check that this does not happen for either of the solutions where $\sin 2x = 1$ (it doesn't), and at that point, you'll be done. 
A: 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.$$
A: Avoid squaring whenever possible as it immediately introduces extraneous roots.
Method $\#1:$ Put $u=\dfrac{\cos x+\sin x}{\sqrt2}\implies2u^2=1+\sin2x$
$$\implies\dfrac2{2u^2-1}=2u\iff2u^3-u-1=0$$
Clearly, $u=1$ is a root. Please check for the other roots.
$\implies1=\dfrac{\cos x+\sin x}{\sqrt2}=\cos\left(x-\dfrac\pi4\right)$
$\implies x-\dfrac\pi4=2m\pi$ where $m$ is any integer.
Method $\#2:$
$\cos x+\sin x=\sqrt2\cos\left(x-\dfrac\pi4\right)$
$\sin2x=\cos2\left(x-\dfrac\pi4\right)=\left(\sqrt2\cos\left(x-\dfrac\pi4\right)\right)^2-1$
