<s>[INST] Bernoulli's equation(differential equations) Solve the following equation:
$$\sec^2y\frac{dy}{dx}+x \tan y =x^3$$
I have tried like this:
Let, tan y  =z
$$\implies \sec^2 y\frac{dy}{dx}=\frac{dz}{dx}\\$$
$$\therefore \frac{dz}{dx}+zx=x^3\\$$
$$I.F.=e^{\int{xdx}}=e^{\frac{x^2}{2}}\\$$
$$\therefore ze^{\frac{x^2}{2}} =\int{x^3 e^{\frac{x^2}{2}}dx}\\$$
$$=2(\frac{x^2}{2} e^{\frac{x^2}{2}}-e^{\frac{x^2}{2}})+c\\$$
$$\therefore \tan y e^{\frac{x^2}{2}}=e^{\frac{x^2}{2}}(x^2-2)+c\\$$
$$\implies \tan y=x^2-2+ce^{\frac{-x^2}{2}}$$
But in my book the answer is:
$$\tan y=x^3-3x^2+6x-6+ce^{-x}$$
I can't understand where is my mistake..please check this..
 [/INST] $$(\tan y )'+x \tan y =x^3$$
Substitute $z=\tan y$
$$z'+xz=x^3$$
$$(ze^{x^2/2})'=x^3e^{x^2/2}$$
$$ze^{x^2/2}=\int x^3e^{x^2/2} dx$$
Substitute $u=\dfrac {x^2}2$
$$ze^{x^2/2}=2\int ue^{u} du$$
$$ze^{x^2/2}=2( ue^{u}.-e^u)+C $$
$$z=2(\frac {x^2}2-1)+Ce^{-x^2/2}$$
Finally:
$$ \boxed {\tan y= {x^2}-2+Ce^{-x^2/2}}$$
</s>