<s>[INST] prove this ODE solution is genuine? Prove that the solution to:
$y'-2y\tan x=2x\sec x$ is $$y=\frac{2\left(x\sin\left(x\right)+\cos \left(x\right)\right)+C}{\cos^2\left(x\right)}$$
I have found the derivative: $$\frac{2x\cos^3\left(x\right)+\sin \left(2x\right)\left(2\left(x\sin \left(x\right)+\cos \left(x\right)\right)+C\right)}{\cos ^4\left(x\right)}$$
But cannot substitute derivative into original equation to prove
 [/INST] Treating it as a linear first order ODE, then proceed to find the integrating factor: $$\mu = e^{\int -2\tan xdx}= e^{2\ln (\cos x)}= \cos^2 x $$
$$\implies (y\cos^2x)' = 2x\sec x\cdot \cos^2x=2x\cos x$$
$$\implies y\cos^2x= \displaystyle \int 2x\cos xdx$$
$$ =  \int 2xd(\sin x)$$
$$= 2x\sin x- \int 2\sin xdx$$
$$= 2x\sin x+2\cos x+C$$
$$\implies y = \dfrac{2x\sin x+2\cos x +C}{\cos^2x}$$ as claimed above.
</s>