Second order differential equation with non constant coefficients and using a given function $z$ I need a step by step solution for this:
$$-(x^4+2x^2+1)y''+4x(x^2+1)y'+(x^4-4x^2+3)y=0$$
Given tip: introduce this function: $z(x)=\frac{y}{1+x^2}$
 A: Since the OP has solved the problem, I will post a full solution:

The tip you are given is indeed useful. Write $y=(1+x^2)z$. Then by the product rule, one obtains:
$$y'=2xz+(1+x^2)z'$$
$$y''=2z+4xz'+(1+x^2)z''$$
Substituting this into the ODE, we obtain:
$$\small -(1+x^2)^2[2z+4xz'+(1+x^2)z'']+4x(1+x^2)[2xz+(1+x^2)z']+(x^4-4x^2+3)(1+x^2)z=0$$
Dividing by $1+x^2\neq 0$, we obtain:
$$-(1+x^2)[2z+4xz'+(1+x^2)z'']+4x[2xz+(1+x^2)z']+(x^4-4x^2+3)z=0$$
A lot of terms will cancel after expansion. Grouping derivatives of $z$ gives:
$$(x^4+2x^2+1)z+(-1-2x^2-x^4)z''=0$$
Multiplying by $-1$ and dividing by $x^4+2x^2+1=(1+x^2)^2\neq 0$, we obtain the simple ODE:
$$z''-z=0 \tag{*}$$
This is an easy second order linear homogeneous ODE with constant coefficients, hence one can easily find that the solution to this is, where $c_1$ and $c_2$ are arbitrary constants:
$$z(x)=c_1 e^{-x}+c_2e^x$$
Thus, the general solution for the ODE is given by:
$$y(x)=c_1(1+x^2)e^{-x}+c_2(1+x^2)e^x$$

Addendum: In case you were wondering where the motivation for this substitution comes from, it comes from the fact that a linear differential equation of the form:
$$y''+P(x)y'+Q(x)y=0$$
Can be reduced to the form:
$$z''+R(x)z=0$$
By the substitution:
$$\ln(y)=\ln(z)-\frac{1}{2}\int P(x)~dx \tag{**}$$
One can show that $R(x)$ is then given by:
$$R(x)=Q(x)-\frac{1}{2}P'(x)-\frac{1}{4}P^2(x)$$
Here, $P(x)=-\frac{4x}{1+x^2}$, so by $(**)$, this indeed suggests the substitution $y=(1+x^2)z$.
Note that in general it is not guaranteed that $R(x)$ takes a simple form. In the case of the differential equation we are solving, we got lucky and got $R(x)=-1$.
