<s>[INST] Given the differential equation, how to solve the y function with x as the independent variable? $y\frac{dy}{dx} = x(y^4 + 2y^2 + 1)$
$y = 1$ when $x = 4$
I tired to integrate by substitution, but it doesn't seem to work out.
 [/INST] Notice, we have $$y\frac{dy}{dx}=x(y^4+2y^2+1)$$ $$\frac{y}{y^4+2y^2+1}dy=xdx$$ $$\frac{y}{(y^2+1)^2}dy=xdx$$ Now, integrating both the sides we have $$\int \frac{y}{(y^2+1)^2}dy=\int xdx$$ $$\frac{1}{2}\frac{(y^2+1)^{-1}}{-1}=\frac{x^2}{2}+c$$ $$-\frac{1}{2(y^2+1)}=\frac{x^2}{2}+c$$ Substituting $y=1$ & $x=4$, we get
$$\frac{-1}{2((1)^2+1)}=\frac{(4)^2}{2}+c\implies c=\frac{-31}{4}$$ Hence, the solution is  $$-\frac{1}{2(y^2+1)}=\frac{x^2}{2}-\frac{31}{4}$$ 
</s>