Solve $\sqrt{2}\sec x+\tan x=1$ 
Solve $\sqrt{2}\sec x+\tan x=1$

I understand it can be very easily solved by expanding in terms of $\sin x$ and $\cos x$, gives $x=2n\pi-\frac{\pi}{4}$. But, what if I do the following:
$$
\sqrt{2}\sec x+\tan x=1\\
\text{Differentiating}\implies\sqrt{2}\sec x\tan x+\sec^2 x=0\implies\sqrt{2}\tan x+\sec x=0
$$
Step 1
$$
\sec x=-\sqrt{2}\tan x=\frac{1-\tan x}{\sqrt{2}}\implies2\tan x=\tan x-1\implies\tan x=-1\\
\boxed{x=n\pi-\frac{\pi}{4}}
$$
Step 2
$$
\tan x=1-\sqrt{2}\sec x=\frac{-\sec x}{\sqrt{2}}\implies2\sec x-\sqrt{2}=\sec x\\
\implies\sec x=\sqrt{2}\implies\boxed{x=2n\pi\pm\frac{\pi}{4}}
$$
$$
x=n\pi-\frac{\pi}{4}\quad\&\quad x=2n\pi\pm\frac{\pi}{4}\\\implies \bigg[x=2n\pi-\frac{\pi}{4}\text{ or }x=2n\pi+\frac{3\pi}{4}\bigg]\quad\&\quad x=2n\pi\pm\frac{\pi}{4}\\
\implies \boxed{x=2n\pi-\frac{\pi}{4}}
$$
In my attempt why do I need Step 2 to get the complete solution ?
Can someone give a proper explanation to my attempt ?
 A: The differentiation step is invalid. Try to apply it to something like $x^2+1=2$. Differentiating should give $2x=0$, so $x=0$ has to be the solution. Clearly this isn't correct. The problem here is that you are trying to solve for a specific value of $x$; differentiating the two sides indicates that you are treating the quantities as functions, rather than the numbers they are.
It turns out that, by coincidence, $\sqrt{2} \tan\left(2n\pi - \frac{\pi}{4} \right) + \sec\left(2n\pi - \frac{\pi}{4} \right) = 0$, i.e. $\sqrt{2} \tan x + \sec x = 0$ does hold at the particular value of $x$ you want to find. As such, your manipulations are technically "valid" in that everything you say is true, but only because the answer that you are trying to find makes these expressions true. The argument, however, is circular, so the proof fails (you are starting by presuming what you want to show, i.e. $x = 2 \pi n - \frac{\pi}{4}$). If, for example, the original question were $\sqrt{2} \sec x + \tan x = 0$, it should be apparent that this method fails.
A: HINT
As noticed we can't use differentiation to obtain the result indeed in general
$$f'(x)=g'(x) \not \Rightarrow f(x)=g(x)$$
consider for example the simple case
$$2x+3=1 \to 2=0$$
I suggest to use tangent half-angle identities by $t = \tan \frac x2$ to obtain
$$\sqrt{2}\sec x+\tan x=1 \iff \sqrt{2}\frac{1+t^2}{1-t^2}+\frac{2t}{1-t^2}=1$$
