<s>[INST] Reduction of Order via Substitution 
Suppose $u_1=\sin{x^2}$ is a solution of 
  $$xu''-u'+4x^3u=0\Rightarrow u''-x^{-1}u'+4x^2u=0 \ \ \  \ \ \ \ \ \ \ \ \ \ (1)$$
  I am trying to find a second, linearly independent, solution (say $u_2$) to the above equation using reduction of order.

Now, using the formula 
$$u_2=u_1\int\frac{dx}{u^2_1\text{exp}\left(\int p(x)\ dx\right)} \ \ \ \ ,\ p(x)=-x^{-1}$$
I have found that $$u_2=\frac{\sin{x^2}}{2}\int \text{cosec}^2x \ dx=-\frac{\cos{x^2}}{2}$$
Now I tried to replicate this using the substitution $u_2=u_1v(x)$.
After finding the first and second derivatives of this equation and substituting into $(1)$, I get
$$v''\sin{x^2}+v'\left(4x\cos{x^2}-x^{-1}\sin{x^2}\right)=0$$
Letting $w=v'$,
$$\frac{dw}{dx}\sin{x^2}+w\left(4x\cos{x^2}-x^{-1}\sin{x^2}\right)=0$$
I tried to simplify this using the integrating factor
$$\text{exp}\left(\int 4x\cos{x^2}-x^{-1}\sin{x^2} \ dx\right)$$ but could not compute it.
How can I solve this problem using my suggested substitution?
 [/INST] The ODE for $w$ is actually separable: 
\begin{align*}
\sin(x^2)\frac{dw}{dx} + \left(4x\cos(x^2) - \frac{\sin(x^2)}{x}\right)w & = 0 \\
\int \frac{1}{w}\, dw & = \int \frac{1}{\sin(x^2)}\left(\frac{\sin(x^2)}{x} - 4x\cos(x^2)\right)\, dx \\
\int\frac{1}{w}\, dw & = \int\frac{1}{x} - 4x\cot(x^2)\, dx \\
\end{align*}
Making a change of variable $s = x^2$ on the second integrand, we obtain
\begin{align*}
\int\frac{1}{w}\, dw & = \int \frac{1}{x}\, dx - 2\int\cot(s)\, ds \\
\ln|w| & = \ln|x| - 2\ln|\sin(x^2)| + C
\end{align*}
You may then exponentiate each side and get 
$$ |w| = e^C\frac{|x|}{\sin^2(x^2)} = \frac{A|x|}{\sin^2(x^2)}. $$
</s>