Transformation to a constant coefficient ODE methods
Introduction
Flow diagram
Transformation on the independent variable \(x\) method 1
Transformation on the independent variable \(x\) method 2
Transformation on the dependent variable (method 1) \(y=v\left ( x\right ) z\left ( x\right ) \)
Transformation on the dependent variable (method 2) \(y=v\left ( x\right ) x^{n}\)
Worked Examples on all above 4 methods

Introduction Starting with a second order linear ode in the following normal form

\begin{equation} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \tag {A}\end{equation}

The goal is to find a transformation that converts this ode to one with constant coefficients which is then easily solved. There are two transformations to try. One uses transformation on the independent variable \(x\) and the second is on the dependent variable \(y\). The transformation on the independent variable uses \(\tau =g\left ( x\right ) \) and the one on the dependent variable uses \(y=v\left ( x\right ) z\left ( x\right ) \) and \(y=v\left ( x\right ) x^{n}\) as special case.

Flow diagram The following is diagram of the algorithms.

Transformation on the independent variable \(x\) method 1 ode internal name "second_order_change_of_variable_on_x_method_1"

Given ode

\begin{equation} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \tag {A}\end{equation}

Let \(\tau =g\left ( x\right ) \) where \(\tau \) is the new independent variable. Applying this to (A) results in (details not shown)

\begin{equation} y^{\prime \prime }\left ( \tau \right ) +p_{1}\left ( \tau \right ) y^{\prime }\left ( \tau \right ) +q_{1}\left ( \tau \right ) y\left ( \tau \right ) =r_{1}\left ( \tau \right ) \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

The idea of the transformation is to determine if ode (1) can be solved instead of (A).

Let \(q_{1}=c^{2}\) where \(c\) is a constant then from (2)

\begin{align} \frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau ^{\prime } & =\frac {1}{c}\sqrt {q\left ( x\right ) }\tag {5}\\ \tau ^{\prime \prime } & =\frac {1}{2c}\frac {q^{\prime }\left ( x\right ) }{\sqrt {q\left ( x\right ) }} \tag {5A}\end{align}

Substituting (5,5A) in (2) finds \(p_{1}\left ( \tau \right ) \). If \(p_{1}\left ( \tau \right ) \) is a constant (does not depend on \(x\)) then (1) can be solved for \(y\left ( \tau \right ) \) and (A) is therefore solved for \(y\left ( x\right ) \).

Transformation on the independent variable \(x\) method 2 ode internal name "second_order_change_of_variable_on_x_method_2"

Given ode

\begin{equation} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \tag {A}\end{equation}

Let \(\tau =g\left ( x\right ) \) where \(\tau \) is the new independent variable. Applying this to (A) results in (details not shown)

\begin{equation} y^{\prime \prime }\left ( \tau \right ) +p_{1}\left ( \tau \right ) y^{\prime }\left ( \tau \right ) +q_{1}\left ( \tau \right ) y\left ( \tau \right ) =r_{1}\left ( \tau \right ) \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

The idea of the transformation is to determine if ode (1) can be solved instead of (A).

Let \(p_{1}=0\) then \(\tau \) is solved for from \(\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) =0\).

\[ \tau =\int e^{-\int pdx}dx \]

If this solution \(\tau \left ( x\right ) \) results in \(q_{1}\) above being a constant, then (1) can now be easily solved.

Transformation on the dependent variable (method 1) \(y=v\left ( x\right ) z\left ( x\right ) \) ode internal name "second_order_change_of_variable_on_y_method_1"

This is also called Liouville transformation. Book by Einar Hille, ordinary differential equations in the complex domain. Page 179. This method assumes that

\[ y=v\left ( x\right ) z\left ( x\right ) \]

Substituting this into (A) results in the following ode where the dependent variable is \(v\) and not \(y\)

\begin{equation} v^{\prime \prime }\left ( x\right ) +\left ( p+\frac {2}{z}z^{\prime }\left ( x\right ) \right ) v^{\prime }\left ( x\right ) +\frac {1}{z}\left ( z^{\prime \prime }\left ( x\right ) +pz^{\prime }\left ( x\right ) +qz\left ( x\right ) \right ) v\left ( x\right ) =\frac {r}{z} \tag {6}\end{equation}

Assuming that coefficient of \(v^{\prime }\) in (6) zero implies

\[ p+\frac {2}{z}z^{\prime }\left ( x\right ) =0 \]

Solving gives (where constant of integration is taken as one)

\begin{equation} z=e^{-\int \frac {p}{2}dx} \tag {6A}\end{equation}

With this choice (6) becomes

\[ v^{\prime \prime }+\frac {1}{z}\left ( z^{\prime \prime }+pz^{\prime }+qz\right ) v=\frac {r}{z}\]

Substituting \(z\) from (6A) into the above reduces it to (after some algebra) to

\begin{equation} v^{\prime \prime }+q_{1}v=r_{1} \tag {6B}\end{equation}

Where

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ r_{1} & =\frac {r}{z}\\ & =re^{\frac {1}{2}\int pdx}\end{align*}

\(q_{1}\) is called the Liouville ode invariant. If \(q_{1}\) is constant, or constant divided by \(x^{2}\), then the substitution \(y=\) \(v\left ( x\right ) z\left ( x\right ) \) used in the original original ode results in a constant coefficient ode. In \(y=\) \(v\left ( x\right ) z\left ( x\right ) \) the \(z\left ( x\right ) \) term is known from 6A and \(v\left ( x\right ) \) is the new unknown dependent variable.

The new ode will be in \(v\left ( x\right ) \) but with constant coefficients. Solving it for \(v\left ( x\right ) \) gives \(y\). Examples given below to illustrate this method.

Example 1

\begin{equation} y^{\prime \prime }+\frac {2}{x}y^{\prime }+y=\frac {1}{x} \tag {1}\end{equation}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then \(p=\frac {2}{x},q=1,r=\frac {1}{x}\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{-\int \frac {1}{x}dx}\\ & =e^{-\ln x}\\ & =\frac {1}{x}\end{align*}

Now we check if \(q_{1}\) is constant or a constant divided by \(x^{2}\).

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =1-\frac {1}{2}\left ( \frac {2}{x}\right ) ^{\prime }-\frac {1}{4}\left ( \frac {2}{x}\right ) ^{2}\\ & =1-\left ( -\frac {1}{x^{2}}\right ) -\frac {1}{4}\frac {4}{x^{2}}\\ & =1-\left ( -\frac {1}{x^{2}}\right ) -\frac {1}{4}\frac {4}{x^{2}}\\ & =1+\frac {1}{x^{2}}-\frac {1}{x^{2}}\\ & =1 \end{align*}

Since \(q_{1}\) is constant, then we can use the change of the variable \(y=v\left ( x\right ) z\left ( x\right ) \) which is

\[ y=\frac {v}{x}\]

Since \(z=\frac {1}{x}\). Substituting the above into the original ODE (1) gives

\begin{align*} \left ( \frac {v}{x}\right ) ^{\prime \prime }+\left ( \frac {2}{x}\left ( \frac {v}{x}\right ) ^{\prime }\right ) +\frac {v}{x} & =\frac {1}{x}\\ \left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) ^{\prime }+\frac {2}{x}\left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) +\frac {v}{x} & =\frac {1}{x}\\ \left ( \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\left ( \frac {v^{\prime }}{x^{2}}-2\frac {v}{x^{3}}\right ) \right ) +\frac {2}{x}\left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) +\frac {v}{x} & =\frac {1}{x}\\ \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\frac {v^{\prime }}{x^{2}}+2\frac {v}{x^{3}}+\frac {2v^{\prime }}{x^{2}}-\frac {2v}{x^{3}}+\frac {v}{x} & =\frac {1}{x}\\ \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\frac {v^{\prime }}{x^{2}}+\frac {2v^{\prime }}{x^{2}}+\frac {v}{x} & =\frac {1}{x}\\ \frac {v^{\prime \prime }}{x}+\frac {v}{x} & =\frac {1}{x}\\ v^{\prime \prime }+v & =1 \end{align*}

This is constant coefficient ODE which is easily solved. If the ode in \(v\left ( x\right ) \) did not come to be constant coefficient then we made a mistake. The solution is

\[ v=c_{1}\cos x+c_{2}\sin x+1 \]

Hence

\begin{align*} y & =\frac {v}{x}\\ & =c_{1}\frac {\cos x}{x}+c_{2}\frac {\sin x}{x}+\frac {1}{x}\end{align*}

Example 2

\begin{align} y^{\prime \prime }+\frac {2}{x}y^{\prime }-y & =0\tag {1}\\ y\left ( -\infty \right ) & =0\nonumber \\ y^{\prime }\left ( -1\right ) & =-e^{-1}\nonumber \end{align}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then \(p=\frac {2}{x},q=-1,r=0\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{-\int \frac {1}{x}dx}\\ & =e^{-\ln x}\\ & =\frac {1}{x}\end{align*}

Now we check if \(q_{1}\) is constant or a constant divided by \(x^{2}\).

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =-1-\frac {1}{2}\left ( \frac {2}{x}\right ) ^{\prime }-\frac {1}{4}\left ( \frac {2}{x}\right ) ^{2}\\ & =-1-\left ( -\frac {1}{x^{2}}\right ) -\frac {1}{4}\frac {4}{x^{2}}\\ & =-1-\left ( -\frac {1}{x^{2}}\right ) -\frac {1}{4}\frac {4}{x^{2}}\\ & =-1+\frac {1}{x^{2}}-\frac {1}{x^{2}}\\ & =0 \end{align*}

Since \(q_{1}\) is constant, then we can use the change of the variable \(y=v\left ( x\right ) z\left ( x\right ) \) which is

\[ y=\frac {v}{x}\]

Since \(z=\frac {1}{x}\). Substituting the above into the original ODE (1) gives

\begin{align*} \left ( \frac {v}{x}\right ) ^{\prime \prime }+\left ( \frac {2}{x}\left ( \frac {v}{x}\right ) ^{\prime }\right ) -\frac {v}{x} & =0\\ \left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) ^{\prime }+\frac {2}{x}\left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) -\frac {v}{x} & =0\\ \left ( \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\left ( \frac {v^{\prime }}{x^{2}}-2\frac {v}{x^{3}}\right ) \right ) +\frac {2}{x}\left ( \frac {v^{\prime }}{x}-\frac {v}{x^{2}}\right ) -\frac {v}{x} & =0\\ \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\frac {v^{\prime }}{x^{2}}+2\frac {v}{x^{3}}+\frac {2v^{\prime }}{x^{2}}-\frac {2v}{x^{3}}-\frac {v}{x} & =0\\ \frac {v^{\prime \prime }}{x}-\frac {v^{\prime }}{x^{2}}-\frac {v^{\prime }}{x^{2}}+\frac {2v^{\prime }}{x^{2}}-\frac {v}{x} & =0\\ \frac {v^{\prime \prime }}{x}-\frac {v}{x} & =0\\ v^{\prime \prime }-v & =0 \end{align*}

This is constant coefficient ODE which is easily solved. If the ode in \(v\left ( x\right ) \) did not come to be constant coefficient then we made a mistake. The solution is

\[ v=c_{1}e^{-x}+c_{2}e^{x}\]

Hence

\begin{align} y & =\frac {v}{x}\nonumber \\ & =c_{1}\frac {e^{-x}}{x}+c_{2}\frac {e^{x}}{x} \tag {2}\end{align}

Now we need to find \(c_{1},c_{2}\) from initial conditions. From (2),

\begin{equation} y^{\prime }=-c_{1}\frac {e^{-x}}{x}-c_{1}\frac {e^{-x}}{x^{2}}+c_{2}\frac {e^{x}}{x}-c_{2}\frac {e^{x}}{x^{2}} \tag {3}\end{equation}

Whenever we have \(\infty \) in the IC, we will replace it by \(u\). Hence the IC’s are now

\begin{align} y\left ( -u\right ) & =0\tag {4}\\ y^{\prime }\left ( -1\right ) & =-e^{-1}\nonumber \end{align}

Substituting IC into (2,3) gives two equations to solve for \(c_{1},c_{2}\)

\begin{align*} 0 & =-c_{1}\frac {e^{u}}{u}-c_{2}\frac {e^{-u}}{u}\\ -e^{-1} & =c_{1}e^{1}-c_{1}e^{1}-c_{2}e^{-1}-c_{2}e^{-1}=-2c_{2}e^{-1}\end{align*}

Solving the above two equations for \(c_{1},c_{2}\) gives

\begin{align*} c_{1} & =-\frac {e^{-u}}{2e^{u}}\\ c_{2} & =\frac {1}{2}\end{align*}

But

\[ \lim _{u\rightarrow \infty }\left ( -\frac {e^{-u}}{2e^{u}}\right ) =0 \]

Hence

\begin{align*} c_{1} & =0\\ c_{2} & =\frac {1}{2}\end{align*}

And the solution (2) becomes

\[ y=\frac {1}{2}\frac {e^{x}}{x}\]

Example 3

\begin{align} x^{2}y^{\prime \prime }-x\left ( x+2\right ) y^{\prime }+\left ( x+2\right ) y & =2x^{3}\nonumber \\ y^{\prime \prime }-\frac {x+2}{x}y^{\prime }+\frac {x+2}{x^{2}}y & =2x \tag {1}\end{align}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then \(p=-\frac {x+2}{x},q=\frac {\left ( x+2\right ) }{x^{2}},r=2x\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{\int \frac {x+2}{2x}dx}\\ & =xe^{\frac {x}{2}}\end{align*}

Now we check if Liouville ode invariant \(q_{1}\) is constant or a constant divided by \(x^{2}\).

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\frac {\left ( x+2\right ) }{x^{2}}-\frac {1}{2}\left ( xe^{\frac {x}{2}}\right ) ^{\prime }-\frac {1}{4}\left ( -\frac {x+2}{x}\right ) ^{2}\\ & =-\frac {1}{4}\end{align*}

Since \(q_{1}\) is constant, then we can use the change of the variable \(y=v\left ( x\right ) z\left ( x\right ) \) which is

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =v\left ( xe^{\frac {x}{2}}\right ) \end{align*}

Substituting the above into the original ODE (1) gives

\begin{align*} y^{\prime \prime }-\frac {x+2}{x}y^{\prime }+\frac {x+2}{x}y & =2x\\ \left ( v\left ( xe^{\frac {x}{2}}\right ) \right ) ^{\prime \prime }-\frac {x+2}{x}\left ( v\left ( xe^{\frac {x}{2}}\right ) \right ) ^{\prime }+\frac {x+2}{x^{2}}v\left ( xe^{\frac {x}{2}}\right ) & =2x \end{align*}

Carrying out the simplification gives

\[ 4v^{\prime \prime }-v=8e^{-\frac {x}{2}}\]

Which is constant coefficient ode. This is easily solved giving the solution

\[ v=c_{1}\sinh \left ( \frac {x}{2}\right ) +c_{2}\cosh \left ( \frac {x}{2}\right ) -2xe^{\frac {-x}{2}}\]

Hence

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =\left ( c_{1}\sinh \left ( \frac {x}{2}\right ) +c_{2}\cosh \left ( \frac {x}{2}\right ) -2xe^{\frac {-x}{2}}\right ) xe^{\frac {x}{2}}\end{align*}

Example 4

\begin{equation} y^{\prime \prime }-4xy^{\prime }+\left ( 4x^{2}-2\right ) y=0 \tag {1}\end{equation}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then \(p=-4x,q=\left ( 4x^{2}-2\right ) ,r=0\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{\int 2xdx}\\ & =e^{x^{2}}\end{align*}

Now we check if Liouville ode invariant \(q_{1}\) is constant or a constant divided by \(x^{2}\).

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( 4x^{2}-2\right ) -\frac {1}{2}\left ( -4x\right ) ^{\prime }-\frac {1}{4}\left ( -4x\right ) ^{2}\\ & =\left ( 4x^{2}-2\right ) +2-\frac {1}{4}\left ( 16x^{2}\right ) \\ & =4x^{2}-2+2-4x^{2}\\ & =0 \end{align*}

Since \(q_{1}\) is constant, then we can use the change of the variable \(y=v\left ( x\right ) z\left ( x\right ) \) which is

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =v\left ( e^{x^{2}}\right ) \end{align*}

Substituting the above into the original ODE (1) gives

\begin{align*} y^{\prime \prime }-4xy^{\prime }+\left ( 4x^{2}-2\right ) y & =0\\ \left ( ve^{x^{2}}\right ) ^{\prime \prime }-4x\left ( ve^{x^{2}}\right ) ^{\prime }+\left ( 4x^{2}-2\right ) ve^{x^{2}} & =0 \end{align*}

Carrying out the simplification gives

\[ v^{\prime \prime }=0 \]

Which is constant coefficient ode. This is easily solved giving the solution

\[ v=c_{1}+c_{2}x \]

Hence

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =\left ( c_{1}+c_{2}x\right ) e^{x^{2}}\end{align*}

Example 5

\begin{equation} x^{2}y^{\prime \prime }+3xy^{\prime }+y=0 \tag {1}\end{equation}

This is of course Euler ode, and we do not need to try this method as solving it as Euler ode is much simpler. But this is just for illustration for the case when the Liouville ode invariant comes out not a constant. In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then

\begin{equation} y^{\prime \prime }+\frac {3}{x}y^{\prime }+\frac {1}{x^{2}}y=0 \tag {1A}\end{equation}

Where now \(p=\frac {3}{x},q=\frac {1}{x^{2}},r=0\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{\frac {-3}{2}\int \frac {1}{x}dx}\\ & =\frac {1}{x^{\frac {3}{2}}}\end{align*}

Now we check if Liouville ode invariant \(q_{1}\) is constant.

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( \frac {1}{x^{2}}\right ) -\frac {1}{2}\left ( \frac {3}{x}\right ) ^{\prime }-\frac {1}{4}\left ( \frac {3}{x}\right ) ^{2}\\ & =\left ( \frac {1}{x^{2}}\right ) -\frac {3}{2}\left ( \frac {-1}{x^{2}}\right ) -\frac {1}{4}\left ( \frac {9}{x^{2}}\right ) \\ & =\frac {1}{x^{2}}+\frac {3}{2x^{2}}-\frac {9}{4x^{2}}\\ & =\frac {1}{4x^{2}}\end{align*}

Since \(q_{1}\) is not constant then the ode can not not converted to an ode in \(v\left ( x\right ) \) with constant coefficient.

Example 6

\begin{equation} xy^{\prime \prime }+2y^{\prime }-xy=0 \tag {1}\end{equation}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then

\begin{equation} y^{\prime \prime }+\frac {2}{x}y^{\prime }-y=0 \tag {1A}\end{equation}

Where now \(p=\frac {2}{x},q=-1,r=0\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{-\int \frac {1}{x}dx}\\ & =\frac {1}{x}\end{align*}

Now we check if Liouville ode invariant \(q_{1}\) is constant.

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( -1\right ) -\frac {1}{2}\left ( \frac {2}{x}\right ) ^{\prime }-\frac {1}{4}\left ( \frac {2}{x}\right ) ^{2}\\ & =-1-\left ( -\frac {1}{x^{2}}\right ) -\frac {1}{x^{2}}\\ & =-1+\frac {1}{x^{2}}-\frac {1}{x^{2}}\\ & =-1 \end{align*}

Since \(q_{1}\) is constant, then we can use the change of the variable \(y=v\left ( x\right ) z\left ( x\right ) \) which is

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =v\frac {1}{x}\end{align*}

Substituting the above into the original ODE (1A) gives

\begin{align*} y^{\prime \prime }+\frac {2}{x}y^{\prime }-y & =0\\ \left ( v\frac {1}{x}\right ) ^{\prime \prime }+\frac {2}{x}\left ( v\frac {1}{x}\right ) ^{\prime }-v\frac {1}{x} & =0 \end{align*}

Carrying out the simplification gives

\[ v^{\prime \prime }-v=0 \]

Which is constant coefficient ode. This is easily solved giving the solution

\[ v=c_{1}e^{x}+c_{2}e^{-x}\]

Hence

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =\left ( c_{1}e^{x}+c_{2}e^{-x}\right ) \frac {1}{x}\end{align*}

Example 7

\begin{equation} y^{\prime \prime }-\frac {1}{\sqrt {x}}y^{\prime }+\left ( \frac {1}{4x}+\frac {1}{4x^{\frac {3}{2}}}-\frac {2}{x^{2}}\right ) y=0 \tag {1}\end{equation}

In the form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=r\left ( x\right ) \) then \(p=-\frac {1}{\sqrt {x}},q=\left ( \frac {1}{4x}+\frac {1}{4x^{\frac {3}{2}}}-\frac {2}{x^{2}}\right ) ,r=0\). Hence (6A) is

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{\int \frac {1}{\sqrt {x}}dx}\\ & =e^{2\sqrt {x}}\end{align*}

Now we check if Liouville ode invariant \(q_{1}\) is constant.

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( \frac {1}{4x}+\frac {1}{4x^{\frac {3}{2}}}-\frac {2}{x^{2}}\right ) -\frac {1}{2}\left ( -\frac {1}{\sqrt {x}}\right ) ^{\prime }-\frac {1}{4}\left ( -\frac {1}{\sqrt {x}}\right ) ^{2}\\ & =-\frac {2}{x^{2}}\end{align*}

Not constant. Stop here. This can be solved using Kovacic algorithm.

Transformation on the dependent variable (method 2) \(y=v\left ( x\right ) x^{n}\) ode internal name "second_order_change_of_variable_on_y_method_2"

This transformation, if it works, changes the second order ode to an one with missing \(y\), which then can be solved as first order ode by reduction of order. This transformation does not necessarily changes the second order ode to one with constant coefficient like the above general transformation. But to an ode with missing \(y\).

This method assumes

\[ y=v\left ( x\right ) x^{n}\]

If this transformation changes the ode to one with missing \(y\), then it can be used. Substituting this in (A) results in the following ode where the dependent variable is now \(v\) and not \(y\)

\begin{align} x^{n}v^{\prime \prime }+\left ( 2x^{n-1}n+x^{n}p\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{n-2}+npx^{n-1}+qx^{n}\right ) v & =r\nonumber \\ v^{\prime \prime }+\left ( 2\frac {n}{x}+p\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{-2}+npx^{-1}+q\right ) v & =\frac {r}{x^{n}} \tag {7}\end{align}

If it happens that

\begin{equation} n\left ( n-1\right ) x^{-2}+npx^{-1}+q=0 \tag {7A}\end{equation}

For some integer or rational number \(n\), then (7) becomes

\begin{equation} v^{\prime \prime }+\left ( 2\frac {n}{x}+p\right ) v^{\prime }=\frac {r}{x^{n}} \tag {7B}\end{equation}

Which now can be solved using substitution \(u=v^{\prime }\).

\[ u^{\prime }+\left ( 2\frac {n}{x}+p\right ) u=\frac {r}{x^{n}}\]

Which is linear first order ode. Once \(u\) is found, then \(v\) is by found integration. Hence \(y\) is now found. To use this method, all what we need is to check if (7A) is true for some number \(n\). Typically one tries \(n=\pm 1\) first and if this does not work, then try to find other values. Example below shows how to apply this method.

Worked Examples on all above 4 methods

Example 1. \(xy^{\prime \prime }+2y^{\prime }-xy=0\) Trying change of variable on independent variable first.  Let \(\tau =g\left ( x\right ) \) where \(z\) will be the new independent variable. Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+py^{\prime }+qy & =r\\ p & =\frac {2}{x}\\ q & =-1\\ r & =0 \end{align*}

Applying \(\tau =g\left ( x\right ) \) transformation on the above ode gives

\begin{equation} y^{\prime \prime }\left ( \tau \right ) +p_{1}\left ( \tau \right ) y^{\prime }\left ( \tau \right ) +q_{1}\left ( \tau \right ) y\left ( \tau \right ) =r_{1}\left ( \tau \right ) \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau ^{\prime } & =\frac {1}{c}\sqrt {q} \tag {5}\end{align}

If \(p_{1}\) is constant using this \(\tau \) then (1) is a second order constant coefficient ode which can be solved easily. This ode has \(q=-1\), therefore from (3)

\[ \tau ^{\prime }=\frac {1}{c}\sqrt {-1}\]

Hence \(p_{1}\) becomes using (2)

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {0+\left ( 2x^{-1}\right ) \frac {1}{c}\sqrt {-1}}{\frac {-1}{c^{2}}}\\ & =-2x^{-1}\sqrt {-1}c \end{align*}

Which is not a constant. So this transformation failed.

Approach 2  Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be integrated. \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ & =\int e^{-\int 2x^{-1}dx}dx\\ & =\int x^{-2}dx\\ & =\frac {-1}{x}\end{align*}

Using this then \(q_{1}\) becomes

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {-1}{\left ( \frac {1}{x^{2}}\right ) ^{2}}\\ & =-x^{4}\\ & =-\frac {1}{\tau ^{4}}\end{align*}

Which is not constant and nor a constant divided by \(\tau ^{2}\). So this transformation did not work.

Trying change of variables on the dependent variable transformation (first method). This method assumes

\[ y=v\left ( x\right ) z\left ( x\right ) \]

Substituting this in the given ode results in new ode where the dependent variable is \(v\) and not \(y\) which can be found to be

\[ v^{\prime \prime }\left ( x\right ) +\left ( p+\frac {2}{z}z^{\prime }\left ( x\right ) \right ) v^{\prime }\left ( x\right ) +\frac {1}{z}\left ( z^{\prime \prime }\left ( x\right ) +pz^{\prime }\left ( x\right ) +qz\left ( x\right ) \right ) v\left ( x\right ) =\frac {r}{z}\]

Let \(p+\frac {2}{z}z^{\prime }\left ( x\right ) =0\). Solving gives \(z=e^{-\int \frac {p}{2}dx}\). With this choice the above ode becomes

\[ v^{\prime \prime }+\frac {1}{z}\left ( z^{\prime \prime }+pz^{\prime }+qz\right ) v=\frac {r}{z}\]

Applying \(z=e^{-\int \frac {p}{2}dx}\) to the above reduces it to

\begin{equation} v^{\prime \prime }+q_{1}v=r_{1} \tag {6}\end{equation}

Where

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ r_{1} & =re^{\frac {1}{2}\int pdx}\end{align*}

If \(q_{1}\) turns out to be constant or a constant divided by \(x^{2}\) with this choice of \(z\), then \(v\) is solved for from (6) and the solution to the original ode is obtained. Applying this method on the given ode gives

\begin{align*} z & =e^{-\int \frac {p}{2}dx}\\ & =e^{-\int x^{-1}dx}\\ & =e^{-\ln x}\\ & =x^{-1}\end{align*}

Hence

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =-1+\frac {2}{2}x^{-2}-\frac {1}{4}\left ( 2x^{-1}\right ) ^{2}\\ & =-1+x^{-2}-x^{-2}\\ & =-1 \end{align*}

Since \(q_{1}\) is constant, then this transformation works. Eq (6) now becomes

\[ v^{\prime \prime }-v=0 \]

The solution is

\[ v=c_{1}e^{-x}+c_{2}e^{x}\]

Therefore, since \(z=x^{-1}\) then

\begin{align*} y & =v\left ( x\right ) z\left ( x\right ) \\ & =\frac {1}{x}\left ( c_{1}e^{-x}+c_{2}e^{x}\right ) \end{align*}

This example shows that change of variable on the independent variable did not work, but change of variable on the dependent variable (general case) worked.

Trying change of variable on the dependent variable (second method). This method assumes that

\[ y=v\left ( x\right ) x^{n}\]

For some \(n\), This transformation changes the ode to an ode with a missing \(y\), which can be easily solved as two first order ode’s. Substituting this in (A) results in the following ode where the dependent variable is \(v\) and not \(y\)

\begin{equation} x^{n}v^{\prime \prime }+\left ( 2x^{n-1}n+x^{n}p\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{n-2}+npx^{n-1}+qx^{n}\right ) v=r \tag {7}\end{equation}

If it happens that

\begin{equation} \left ( n\left ( n-1\right ) x^{n-2}+npx^{n-1}+qx^{n}\right ) =0 \tag {7A}\end{equation}

For some \(n\), then (7) becomes

\begin{equation} x^{n}v^{\prime \prime }+\left ( 2x^{n-1}n+x^{n}p\right ) v^{\prime }=r \tag {7B}\end{equation}

Which can be solved using substitution \(u=v^{\prime }\) to give

\[ u^{\prime }+\frac {\left ( 2x^{n-1}n+x^{n}p\right ) }{x^{n}}u=r \]

Applying (7A) on this example ode gives

\begin{align*} \left ( n\left ( n-1\right ) x^{n-2}+n\left ( \frac {2}{x}\right ) x^{n-1}+\left ( -1\right ) x^{n}\right ) & =0\\ n\left ( n-1\right ) x^{n-2}+2nx^{n-2}-x^{n} & =0\\ \left ( n+n^{2}\right ) x^{n-2}-x^{n} & =0 \end{align*}

It is clear that there exists no integer or rational number \(n\) which makes the LHS above zero. Hence this special transformation did not work.

This is an example where only the change of variable on the dependent variable (general case) worked.

Example 2. Euler ODE \(x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +y\left ( x\right ) =0\) One way to solve Euler ODE 

\begin{equation} x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +y\left ( x\right ) =0 \tag {A}\end{equation}

Putting it in normal form gives

\[ y^{\prime \prime }\left ( x\right ) +\frac {1}{x}y^{\prime }\left ( x\right ) +\frac {1}{x^{2}}y\left ( x\right ) =0 \]

Hence

\begin{align*} p & =\frac {1}{x}\\ q & =\frac {1}{x^{2}}\\ r & =0 \end{align*}

Trying change of variable on the independent variable.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(\tau \), then \(p_{1}\) turns out to be constant, then (1) is now a second order constant coefficient ode which is easily solved. Applying (5) on the given ode gives

\begin{align*} \tau & =\frac {1}{c}\int \sqrt {x^{-2}}dx\\ & =\frac {1}{c}\ln x \end{align*}

Using the above on (2) gives

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =0 \end{align*}

Which is a constant. Hence this transformation worked.  Therefore(1) becomes (using \(q_{1}=c^{2}\) which is a constant \(c^{2}\))

\begin{align*} y^{\prime \prime }\left ( \tau \right ) +p_{1}y^{\prime }\left ( \tau \right ) +q_{1}y\left ( \tau \right ) & =r_{1}\\ y^{\prime \prime }\left ( \tau \right ) +c^{2}y\left ( \tau \right ) & =0 \end{align*}

The solution is

\[ y\left ( \tau \right ) =A\cos \left ( c\tau \right ) +B\sin \left ( c\tau \right ) \]

But \(\tau =\frac {1}{c}\ln x\). Hence the above becomes

\[ y\left ( x\right ) =A\cos \left ( \ln x\right ) +B\sin \left ( \ln x\right ) \]

In practice, this longer method is not needed to solve Euler ode \(x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +y\left ( x\right ) =0\) as that the substitution \(y=x^{r}\) works more easily. But the above method is more general. For example, using \(y=x^{r}\), then \(x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +y\left ( x\right ) =0\) becomes \(r\left ( r-1\right ) +r+1=0\). The roots \(r\) are \(i,-i\). Then the solution is linear combination of the basis solutions given by

\begin{align*} y & =Ax^{i}+Bx^{-i}\\ & =Ae^{\ln x^{i}}+Be^{\ln x^{-i}}\\ & =Ae^{i\ln x}+Be^{-i\ln x}\\ & =A\cos \left ( \ln x\right ) +B\sin \left ( \ln x\right ) \end{align*}

Where the last step used Euler relation to do the conversion. Another known transformation for Euler (which is not as simple as the above) is to use \(x=e^{t}\). Using this gives

\begin{equation} \frac {dx}{dt}=e^{t} \tag {2}\end{equation}

But \(\ln x=t\), hence

\begin{equation} \frac {dt}{dx}=\frac {1}{x} \tag {3}\end{equation}

To do this change of variable and obtain a new ode where now \(y\left ( x\right ) \) becomes \(y\left ( t\right ) \), then \(y^{\prime }\left ( x\right ) \) is changed to \(y^{\prime }\left ( t\right ) \) and \(y^{\prime \prime }\left ( x\right ) \) is changed \(y^{\prime \prime }\left ( t\right ) \). Using

\begin{equation} \frac {dy}{dx}=\frac {dy}{dt}\frac {dt}{dx} \tag {4}\end{equation}

Substituting (3) into (4) gives

\[ \frac {dy}{dx}=\frac {dy}{dt}\frac {1}{x}\]

But \(\frac {1}{x}=e^{-t}\). The above becomes

\begin{equation} \frac {dy}{dx}=e^{-t}\frac {dy}{dt} \tag {5}\end{equation}

Now \(y^{\prime \prime }\left ( x\right ) \) needs to change to \(y^{\prime \prime }\left ( t\right ) \). Since

\[ \frac {d^{2}y}{dx^{2}}=\frac {d}{dx}\left ( \frac {dy}{dx}\right ) \]

Substituting (5) into the above gives

\[ \frac {d^{2}y}{dx^{2}}=\frac {d}{dx}\left ( e^{-t}\frac {dy}{dt}\right ) \]

Dividing the numerator and denominator of \(\frac {d}{dx}\) by \(dt\) gives

\begin{align*} \frac {d^{2}y}{dx^{2}} & =\frac {\frac {d}{dt}}{\frac {dx}{dt}}\left ( e^{-t}\frac {dy}{dt}\right ) \\ & =\frac {dt}{dx}\frac {d}{dt}\left ( e^{-t}\frac {dy}{dt}\right ) \end{align*}

But from (3) \(\frac {dt}{dx}=\frac {1}{x}=e^{-t}\). Hence the above becomes

\[ \frac {d^{2}y}{dx^{2}}=e^{-t}\frac {d}{dt}\left ( e^{-t}\frac {dy}{dt}\right ) \]

Using the the product rule gives

\begin{align} \frac {d^{2}y}{dx^{2}} & =e^{-t}\left ( -e^{-t}\frac {dy}{dt}+e^{-t}\frac {d^{2}y}{dt^{2}}\right ) \nonumber \\ & =e^{-2t}\left ( -\frac {dy}{dt}+\frac {d^{2}y}{dt^{2}}\right ) \nonumber \\ & =e^{-2t}\left ( \frac {d^{2}y}{dt^{2}}-\frac {dy}{dt}\right ) \tag {6}\end{align}

Now \(y^{\prime }\left ( x\right ) \) and \(y^{\prime \prime }\left ( x\right ) \) have been converted to \(y^{\prime }\left ( t\right ) ,y^{\prime \prime }\left ( t\right ) \). Substituting (5,6) in the gives ode gives

\begin{align*} x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +y\left ( x\right ) & =0\\ x^{2}e^{-2t}\left ( \frac {d^{2}y}{dt^{2}}-\frac {dy}{dt}\right ) +xe^{-t}\frac {dy}{dt}+y\left ( t\right ) & =0 \end{align*}

But \(x=e^{t}\) and \(x^{2}=e^{2t}\). The above becomes

\begin{align*} \frac {d^{2}y}{dt^{2}}-\frac {dy}{dt}+\frac {dy}{dt}+y\left ( t\right ) & =0\\ \frac {d^{2}y}{dt^{2}}+y\left ( t\right ) & =0 \end{align*}

This is now constant coefficient ODE. The solution is

\[ y\left ( t\right ) =A\cos \left ( t\right ) +B\sin \left ( t\right ) \]

Since\(\ \ln x=t\), then the above becomes

\[ y\left ( x\right ) =A\cos \left ( \ln x\right ) +B\sin \left ( \ln x\right ) \]

This completes the solution.

Example 3. \(y^{\prime \prime }\sin ^{2}\left ( 2x\right ) +y^{\prime }\sin \left ( 4x\right ) -4y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =r\qquad \\ p & =\frac {\sin \left ( 4x\right ) }{\sin ^{2}\left ( 2x\right ) }\qquad \sin \left ( 2x\right ) \neq 0\\ q & =-\frac {4}{\sin ^{2}\left ( 2x\right ) }\end{align*}

Trying change of variable on the independent variable as above.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(\tau \), then \(p_{1}\) turns out to be constant, then it means (1) is second order constant coefficient ode. Applying this on the given ode (5) becomes

\begin{align*} \tau & =\frac {1}{c}\int \sqrt {-\frac {4}{\sin ^{2}\left ( 2x\right ) }}dx\\ & =\frac {2i}{c}\int \frac {1}{\sin \left ( 2x\right ) }dx\\ & =\frac {i}{c}\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) \end{align*}

Eq (2) now becomes

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =0 \end{align*}

Which is constant. Hence this transformation worked.  Therefore (1) becomes (since \(q_{1}=c^{2}\) is constant \(c^{2}\))

\begin{align*} y^{\prime \prime }\left ( \tau \right ) +p_{1}y^{\prime }\left ( \tau \right ) +q_{1}y\left ( \tau \right ) & =r_{1}\\ y^{\prime \prime }+c^{2}y & =0 \end{align*}

This gives

\[ y\left ( \tau \right ) =A\cos \left ( c\tau \right ) +B\sin \left ( c\tau \right ) \]

Using \(\tau =\frac {i}{c}\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) \) the above becomes

\[ y\left ( x\right ) =A\cos \left ( i\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) \right ) +B\sin \left ( i\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) \right ) \]

Simplifying using trig identities gives

\begin{align*} y\left ( x\right ) & =\frac {-iB\cos \left ( 2x\right ) +A}{\sin \left ( 2x\right ) }\\ & =\frac {B_{0}\cos \left ( 2x\right ) }{\sin \left ( 2x\right ) }+\frac {A}{\sin \left ( 2x\right ) }\\ & =B_{0}\cot \left ( 2x\right ) +A\csc (2x) \end{align*}

Approach 2  Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be integrated.  \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ \tau & =\int e^{-\int \frac {\sin \left ( 4x\right ) }{\sin ^{2}\left ( 2x\right ) }dx}dx\\ \tau & =\int \frac {1}{\sin \left ( 2x\right ) }dx \end{align*}

Using this gives

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {-\frac {4}{\sin ^{2}\left ( 2x\right ) }}{-\frac {1}{\frac {1}{\sin ^{2}\left ( 2x\right ) }}}\\ & =-4 \end{align*}

Which is a constant. Hence this transformation also works. Eq (1) now becomes

\begin{align*} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y & =r_{1}\\ y^{\prime \prime }\left ( \tau \right ) -4y\left ( \tau \right ) & =0\\ y\left ( \tau \right ) & =Ae^{-2\tau }+Be^{2\tau }\end{align*}

But \(\tau =\int \frac {1}{\sin \left ( 2x\right ) }dx=\frac {1}{2}\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) \), hence

\begin{align*} y\left ( x\right ) & =Ae^{-2\frac {1}{2}\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) }+Be^{2\frac {1}{2}\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) }\\ & =Ae^{-\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) }+Be^{\ln \left ( \csc \left ( 2x\right ) -\cot \left ( 2x\right ) \right ) }\\ & =\frac {A}{\csc \left ( 2x\right ) -\cot \left ( 2x\right ) }+B\csc \left ( 2x\right ) -\cot \left ( 2x\right ) \end{align*}

Which can be simplified to same solution shown in approach 1. This was an example where both sub methods of change of variable on the independent variable worked.

Example 4. \(\left ( 1-x^{2}\right ) y^{\prime \prime }-xy^{\prime }+y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =r\qquad \\ p & =\frac {-x}{\left ( 1-x^{2}\right ) }\qquad x\neq 1,x\neq -1\\ q & =\frac {1}{\left ( 1-x^{2}\right ) }\end{align*}

Trying change of variable on the independent variable as above.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(\tau \), then \(p_{1}\) turns out to be constant, then it means (1) is second order constant coefficient ode which is easily solved. Using the given ode (5) becomes

\begin{align*} \tau & =\frac {1}{c}\int \sqrt {\frac {1}{\left ( 1-x^{2}\right ) }}dx\\ & =\frac {i}{c}\ln \left ( x+\sqrt {x^{2}-1}\right ) \end{align*}

Hence (2) now becomes

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =0 \end{align*}

Which is constant. Hence this transformation worked.  Therefore the ode (1) becomes (since \(q_{1}=c^{2}\) is constant \(c^{2}\))

\begin{align*} y^{\prime \prime }\left ( \tau \right ) +p_{1}y^{\prime }\left ( \tau \right ) +q_{1}y\left ( \tau \right ) & =r_{1}\\ y^{\prime \prime }+c^{2}y & =0 \end{align*}

The solution is

\[ y\left ( \tau \right ) =A\cos \left ( c\tau \right ) +B\sin \left ( c\tau \right ) \]

Using \(\tau =\frac {i}{c}\ln \left ( x+\sqrt {x^{2}-1}\right ) \) the above becomes

\[ y\left ( x\right ) =A\cos \left ( i\ln \left ( x+\sqrt {x^{2}-1}\right ) \right ) +B\sin \left ( i\ln \left ( x+\sqrt {x^{2}-1}\right ) \right ) \]

Approach 2  Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be integrated.  \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ \tau & =\int e^{\int \frac {x}{\left ( 1-x^{2}\right ) }dx}dx\\ \tau & =\int \frac {1}{\sqrt {x-1}\sqrt {x+1}}dx \end{align*}

Therefore

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {\frac {1}{\left ( 1-x^{2}\right ) }}{\left ( \frac {1}{\sqrt {x-1}\sqrt {x+1}}\right ) ^{2}}\\ & =\frac {\frac {1}{\left ( 1-x^{2}\right ) }}{\frac {1}{\left ( x-1\right ) \left ( x+1\right ) }}\\ & =\frac {\frac {1}{\left ( 1-x^{2}\right ) }}{\frac {1}{x^{2}-1}}\\ & =-1 \end{align*}

Which is a constant. This transformation also worked. Eq (1) becomes

\begin{align*} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y & =r_{1}\\ y^{\prime \prime }\left ( \tau \right ) -y\left ( \tau \right ) & =0\\ y\left ( \tau \right ) & =Ae^{-\tau }+Be^{\tau }\end{align*}

Using \(\tau =\int \frac {1}{\sqrt {x-1}\sqrt {x+1}}dx=\ln \left ( x+\sqrt {x^{2}-1}\right ) \), \(\left ( x>1\right ) \) the above

\begin{align*} y\left ( x\right ) & =Ae^{-\tau }+Be^{\tau }\\ & =Ae^{-\ln \left ( x+\sqrt {x^{2}-1}\right ) }+Be^{\ln \left ( x+\sqrt {x^{2}-1}\right ) }\\ & =\frac {A}{x+\sqrt {x^{2}-1}}+B\left ( x+\sqrt {x^{2}-1}\right ) \end{align*}

This solution looks different from the solution found above using approach 1, but can be shown to be the same. This was an example where both methods of change of variable on the independent variable work.

Example 5. \(x^{2}y^{\prime \prime }-xy^{\prime }+\left ( -x^{2}-\frac {1}{4}\right ) y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =r\qquad \\ p & =\frac {-1}{x}\qquad x\neq 0\\ q & =-\frac {x^{2}+\frac {1}{4}}{x^{2}}\\ r & =0 \end{align*}

Trying change of variable on the independent variable as above.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(\tau \), then \(p_{1}\) turns out to be constant, then it means (1) is second order constant coefficient ode which is easily solved. Applying this on the given ode then (5)

\begin{align*} \tau & =\frac {1}{c}\int \sqrt {-\frac {x^{2}+\frac {1}{4}}{x^{2}}}dx\\ & =\frac {1}{2c}\sqrt {-4x^{2}-1}+\arctan \left ( \frac {1}{\sqrt {-4x^{2}-1}}\right ) \end{align*}

Hence (2) now becomes

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {\left ( 8x^{2}+4\right ) c}{\left ( -4x^{2}-1\right ) ^{\frac {3}{2}}}\end{align*}

Which is not constant. Therefore this transformation did not work.

Approach 2  Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be integrated.  \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ & =\int e^{\int \frac {1}{x}dx}dx\\ & =\int e^{\ln x}dx\\ & =\int xdx\\ & =\frac {x^{2}}{2}\end{align*}

Using this then \(q_{1}\) becomes

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {-\frac {x^{2}+\frac {1}{4}}{x^{2}}}{x^{2}}\\ & =-\frac {1}{x^{4}}\left ( x^{2}+\frac {1}{4}\right ) \end{align*}

Which is not constant. Trying change of variable on the dependent variable (first method). This method assumes

\[ y=v\left ( x\right ) z\left ( x\right ) \]

The Liouville ode invariant is

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =-\frac {x^{2}+\frac {1}{4}}{x^{2}}-\frac {1}{2}\frac {d}{dx}\left ( \frac {-1}{x}\right ) -\frac {1}{4}\left ( \frac {-1}{x}\right ) ^{2}\\ & =-\frac {1}{x^{2}}\left ( x^{2}+1\right ) \end{align*}

Which is not constant. Hence this method does not work. One way to solve this is as a Bessel ODE. I have many examples how to do this on my main page.

Example 6. \(\left ( x^{2}-1\right ) y^{\prime \prime }-2xy^{\prime }+2y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =r\qquad \\ p & =\frac {-2x}{x^{2}-1}\qquad x\neq \pm 1\\ q & =\frac {2}{x^{2}-1}\\ r & =0 \end{align*}

Trying change of variable on the independent variable as above.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(\tau \), then \(p_{1}\) turns out to be constant, then it means (1) is second order constant coefficient ode. Applying this on the given ode (5) becomes

\begin{align*} \tau & =\frac {1}{c}\int \sqrt {\frac {2}{x^{2}-1}}dx\\ & =\frac {1}{c}\sqrt {2}\ln \left ( x+\sqrt {x^{2}}-1\right ) \end{align*}

Hence (2) reduces to

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =-\frac {3\sqrt {2}cx}{\sqrt {\frac {1}{x^{2}-1}}\left ( 2x^{2}-2\right ) }\end{align*}

Which is not constant. This transformation did not work.

Approach 2  Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be easily integrated.  \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ & =\int e^{\int \frac {2x}{x^{2}-1}dx}dx\\ & =\int \left ( x^{2}-1\right ) dx \end{align*}

Hence \(q_{1}\) becomes

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {\frac {2}{x^{2}-1}}{\left ( x^{2}-1\right ) ^{2}}\\ & =\frac {2}{\left ( x^{2}-1\right ) ^{3}}\end{align*}

Which is not constant. This transformation did not work.

Trying change of variable on the dependent variable (first method). This method assumes that

\[ y=v\left ( x\right ) z\left ( x\right ) \]

The Liouville ode invariant is

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( \frac {2}{x^{2}-1}\right ) -\frac {1}{2}\frac {d}{dx}\left ( \frac {-2x}{x^{2}-1}\right ) -\frac {1}{4}\left ( \frac {-2x}{x^{2}-1}\right ) ^{2}\\ & =-\frac {3}{\left ( x^{2}-1\right ) ^{2}}\end{align*}

Which is not constant and not constant divided by \(x^{2}\). Hence this transformation also did not work.

Trying the Lagrange adjoint ode method. From above the adjoint ode is

\[ z^{\prime \prime }-\frac {d\left ( zp\right ) }{dx}+zq=0 \]

For some unknown function \(z\left ( x\right ) \). Hence it becomes

\begin{align*} z^{\prime \prime }-\frac {d}{dx}\left ( z\left ( \frac {-2x}{x^{2}-1}\right ) \right ) +z\left ( \frac {2}{x^{2}-1}\right ) & =0\\ z^{\prime \prime }-\left ( -\frac {2z^{\prime }x}{x^{2}-1}+\frac {4zx^{2}}{\left ( x^{2}-1\right ) ^{2}}-\frac {2z}{x^{2}-1}\right ) +z\left ( \frac {2}{x^{2}-1}\right ) & =0\\ z^{\prime \prime }+\frac {2x}{x^{2}-1}z^{\prime }-\frac {4x^{2}+4\left ( x^{2}-1\right ) }{\left ( x^{2}-1\right ) ^{2}}z & =0 \end{align*}

Clearly this is just as hard to solve as the original ode So this method does it work.

Trying integrating factor method. For this to work the condition is that \(\frac {1}{2}\left ( p^{\prime }+\frac {1}{2}p^{2}\right ) =q\). Applying this on the current ode gives

\begin{align*} \frac {1}{2}\left ( p^{\prime }+\frac {1}{2}p^{2}\right ) & =q\\ \frac {1}{2}\left ( \frac {d}{dx}\left ( \frac {-2x}{x^{2}-1}\right ) +\frac {1}{2}\left ( \frac {-2x}{x^{2}-1}\right ) ^{2}\right ) & =\frac {2}{x^{2}-1}\\ \frac {\left ( 2x^{2}+1\right ) }{\left ( x^{2}-1\right ) ^{2}} & =\frac {2}{x^{2}-1}\\ \frac {2x^{2}+1}{x^{2}-1} & =2 \end{align*}

Which is not true. Hence there is no integrating factor.

Trying transformation on the dependent variable (second method). This method assumes

\[ y=v\left ( x\right ) x^{n}\]

This works only if (7A) given in the introduction is satisfied.

\begin{equation} \left ( n\left ( n-1\right ) x^{n-2}+npx^{n-1}+qx^{n}\right ) =0 \tag {7A}\end{equation}

Applying this on the current ode example gives

\[ \left ( n\left ( n-1\right ) x^{n-2}+n\left ( \frac {-2x}{x^{2}-1}\right ) x^{n-1}+\left ( \frac {2}{x^{2}-1}\right ) x^{n}\right ) =0 \]

Trying \(n=1\) the above becomes

\[ \left ( \left ( \frac {-2x}{x^{2}-1}\right ) +\left ( \frac {2}{x^{2}-1}\right ) x\right ) =0 \]

Hence this transformation works for \(n=1\). Therefore \(y=v\left ( x\right ) x\). eq (7) in the introduction now reduces to

\begin{align} x^{n}v^{\prime \prime }+\left ( 2x^{n-1}n+x^{n}p\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{n-2}+npx^{n-1}+qx^{n}\right ) v & =r\tag {7}\\ v^{\prime \prime }+\frac {\left ( xp+2\right ) }{x}v^{\prime } & =0\nonumber \end{align}

Which now can be solved using substitution \(u=v^{\prime }\).

\[ u^{\prime }+\frac {\left ( xp+2\right ) }{x}u=r \]

Which is linear first order ode. Once \(u\) is found, then \(v\) is found by integration. Hence \(y\) is now found. Hence

\[ u^{\prime }-\frac {2}{x^{3}-x}u=0 \]

Which has the solution \(u=c_{1}\frac {x^{2}}{x^{2}-1}\). Hence \(v^{\prime }=c_{1}\frac {x^{2}}{x^{2}-1}\). Integrating gives \(v=c_{1}\left ( x+\frac {1}{x}\right ) +c_{2}\). Therefore \(y=xv=c_{1}\left ( x^{2}+1\right ) +c_{2}x\)

This was an example where only the transformation on the dependent second method \(y=v\left ( x\right ) x^{n}\) worked.

Example 7. \(xy^{\prime \prime }+\left ( x^{2}-1\right ) y^{\prime }+x^{3}y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =r\qquad \\ p & =\frac {x^{2}-1}{x}\qquad x\neq 0\\ q & =x^{2}\\ r & =0 \end{align*}

Trying change of variable on the independent variable as above.  Let \(\tau =g\left ( x\right ) \) where \(\tau \) will be the new independent variable. Applying this transformation results in

\begin{equation} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y=r_{1} \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau ^{\prime } & =\frac {1}{c}\sqrt {q} \tag {5}\end{align}

If \(p_{1}\) turns out to be constant with this \(\tau \) then it implies (1) is second order constant coefficient ode. Eq (5) becomes

\begin{align*} \tau ^{\prime } & =\frac {1}{c}\sqrt {x^{2}}\\ \tau ^{\prime \prime }\left ( x\right ) & =\frac {1}{2c}\frac {2x}{\sqrt {x^{2}}}\end{align*}

Hence from (2)

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {\frac {1}{2c}\frac {2x}{\sqrt {x^{2}}}+\left ( \frac {x^{2}-1}{x}\right ) \frac {1}{c}\sqrt {x^{2}}}{\left ( \frac {1}{c}\sqrt {x^{2}}\right ) ^{2}}\\ & =c \end{align*}

Which is a constant. Then (1) becomes second order of constant coefficient

\[ y^{\prime \prime }\left ( \tau \right ) +cy^{\prime }\left ( \tau \right ) +c^{2}y\left ( \tau \right ) =0 \]

Which has the solution

\[ y\left ( \tau \right ) =e^{-\frac {c\tau }{2}}\left ( A\sin \left ( \frac {c\sqrt {3}\tau }{2}\right ) +B\sin \left ( \frac {c\sqrt {3}\tau }{2}\right ) \right ) \]

But from earlier \(\tau =\frac {x^{2}}{2c}\). Hence the above becomes

\begin{align*} y\left ( x\right ) & =Ae^{-\frac {c\frac {x^{2}}{2c}}{2}}\sin \left ( \frac {c\sqrt {3}\frac {x^{2}}{2c}}{2}\right ) +Be^{-\frac {c\frac {x^{2}}{2c}}{2}}\sin \left ( \frac {c\sqrt {3}\frac {x^{2}}{2c}}{2}\right ) \\ & =e^{-\frac {x^{2}}{4}}\left ( A\sin \left ( \frac {\sqrt {3}x^{2}}{4}\right ) +B\sin \left ( \frac {\sqrt {3}x^{2}}{4}\right ) \right ) \end{align*}

Approach 2  

Let \(p_{1}=0\). If with this choice now \(q_{1}\) becomes constant or a constant divided by \(\tau ^{2}\) then (2) can be easily integrated.  \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ & =\int e^{-\int \frac {x^{2}-1}{x}dx}dx\\ & =\int xe^{-\frac {x^{2}}{2}}dx\\ & =-e^{-\frac {x^{2}}{2}}\end{align*}

Therefore

\begin{align*} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {x^{2}}{\left ( xe^{-\frac {x^{2}}{2}}\right ) ^{2}}\\ & =e^{x^{2}}\end{align*}

Which is not constant. Now it is checked to see if it is constant divided by \(\tau ^{2}\). Since \(\tau ^{2}=\left ( -e^{-\frac {x^{2}}{2}}\right ) ^{2}=\allowbreak e^{-x^{2}}\) then \(q_{1}=\frac {1}{\tau ^{2}}\). Therefore this approach also worked.

Eq (2) becomes

\begin{align} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y & =0\tag {1}\\ y^{\prime \prime }+\frac {1}{\tau ^{2}}y & =0\nonumber \\ \tau ^{2}y^{\prime \prime }+y & =0\nonumber \end{align}

Which is standard Euler ode which can be solved easily. Giving

\[ y\left ( \tau \right ) =A\sqrt {\tau }\cos \left ( \frac {\sqrt {3}}{2}\ln \left ( \tau \right ) \right ) +B\sqrt {\tau }\sin \left ( \frac {\sqrt {3}}{2}\ln \left ( \tau \right ) \right ) \]

But \(\tau =-e^{-\frac {x^{2}}{2}}\). Hence the above becomes

\[ y\left ( x\right ) =A\sqrt {-e^{-\frac {x^{2}}{2}}}\cos \left ( \frac {\sqrt {3}}{2}\ln \left ( -e^{-\frac {x^{2}}{2}}\right ) \right ) +B\sqrt {-e^{-\frac {x^{2}}{2}}}\sin \left ( \frac {\sqrt {3}}{2}\ln \left ( -e^{-\frac {x^{2}}{2}}\right ) \right ) \]

This looks different from the solution obtained in approach 1, but it verifies also as correct solution.  This is an example where change of independent variable using \(q_{1}=c^{2}\) works and also change of independent variable using \(p_{1}=0\) works as well.

Example 8. \(4x^{2}\sin \left ( x\right ) y^{\prime \prime }+\left ( -4x^{2}\cos x-4x\sin x\right ) y^{\prime }+\left ( 2x\cos x+3\sin x\right ) y=0\) Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y & =0\\ p & =\frac {-4x^{2}\cos x-4x\sin x}{4x^{2}\sin \left ( x\right ) }\qquad x\neq 0,\pi ,2\pi ,\cdots \\ q & =\frac {2x\cos x+3\sin x}{4x^{2}\sin \left ( x\right ) }\\ r & =0 \end{align*}

Applying transformation on the dependent variable second method \(y=v\left ( x\right ) x^{n}\) results in

\begin{align} x^{n}v^{\prime \prime }+\left ( 2nx^{n-1}+px^{n}\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{n-2}+px^{n-1}n+qx^{n}\right ) v & =0\nonumber \\ v^{\prime \prime }+\frac {\left ( 2nx^{n-1}+px^{n}\right ) }{x^{n}}v^{\prime }+\left ( \frac {n\left ( n-1\right ) x^{n-2}+px^{n-1}n+qx^{n}}{x^{n}}\right ) v & =0\nonumber \\ v^{\prime \prime }+\left ( 2nx^{-1}+p\right ) v^{\prime }+\left ( n\left ( n-1\right ) x^{-2}+px^{-1}n+q\right ) v & =0\nonumber \\ v^{\prime \prime }+\left ( 2nx^{-1}+p\right ) v^{\prime }+\left ( pnx^{-1}+q+\left ( n^{2}-n\right ) x^{-2}\right ) v & =0 \tag {1}\end{align}

Assuming the coefficient of \(v\left ( x\right ) \) above is zero. This gives

\[ pnx^{-1}+q+\left ( n^{2}-n\right ) x^{-2}=0 \]

Substituting the values for \(p,q\,\)in the above gives

\[ \left ( \frac {-4x^{2}\cos x-4x\sin x}{4x^{2}\sin \left ( x\right ) }\right ) nx^{-1}+\frac {2x\cos x+3\sin x}{4x^{2}\sin \left ( x\right ) }+\left ( n^{2}-n\right ) x^{-2}=0 \]

Solving for \(n\) shows that \(n=\frac {1}{2}\). Hence (1) now reduces to

\begin{align*} v^{\prime \prime }+\left ( x^{-1}+p\right ) v^{\prime } & =0\\ v^{\prime \prime }+\left ( \frac {1}{x}+\frac {-4x^{2}\cos x-4x\sin x}{4x^{2}\sin \left ( x\right ) }\right ) v^{\prime } & =0\\ v^{\prime \prime }+\left ( \frac {4x\sin x-4x^{2}\cos x-4x\sin x}{4x^{2}\sin x}\right ) v^{\prime } & =0\\ v^{\prime \prime }+\left ( \frac {-4x^{2}\cos x}{4x^{2}\sin x}\right ) v^{\prime } & =0\\ v^{\prime \prime }-\frac {\cos x}{\sin x}v^{\prime } & =0 \end{align*}

Let \(v^{\prime }=u,\) the above becomes

\[ u^{\prime }-\frac {\cos x}{\sin x}u=0 \]

Which is linear first order ode. It has the solution \(u=c_{1}\sin \left ( x\right ) \). Hence

\[ v^{\prime }=c_{1}\sin \left ( x\right ) \]

Integrating gives

\[ v=-c_{1}\cos \left ( x\right ) +c_{2}\]

Therefore

\begin{align*} y & =v\sqrt {x}\\ & =\left ( -c_{1}\cos \left ( x\right ) +c_{2}\right ) \sqrt {x}\end{align*}

This can also be written as

\[ y=\left ( c_{3}\cos \left ( x\right ) +c_{2}\right ) \sqrt {x}\]

Example 9  \(x^{2}y^{\prime \prime }-\left ( 2a-1\right ) xy^{\prime }+a^{2}y=0\) The above is standard Euler ode. But below shows how to apply these transformations if one did not know this.

Trying change of variable on independent variable first.  Let \(\tau =g\left ( x\right ) \) where \(z\) will be the new independent variable. Writing the ode in normal form gives

\begin{align*} y^{\prime \prime }+py^{\prime }+qy & =r\\ p & =\frac {\left ( 1-2a\right ) }{x}\\ q & =\frac {a^{2}}{x^{2}}\\ r & =0 \end{align*}

Applying \(\tau =g\left ( x\right ) \) transformation on the above ode gives

\begin{equation} y^{\prime \prime }\left ( \tau \right ) +p_{1}\left ( \tau \right ) y^{\prime }\left ( \tau \right ) +q_{1}\left ( \tau \right ) y\left ( \tau \right ) =r_{1}\left ( \tau \right ) \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\left ( x\right ) \tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( \tau \right ) & =\frac {q\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( \tau \right ) & =\frac {r\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ \tau ^{\prime } & =\frac {1}{c}\sqrt {q} \tag {5}\end{align}

If \(p_{1}\) is constant using this \(\tau \) then (1) is a second order constant coefficient ode which can be solved easily. This ode has \(q=\frac {a^{2}}{x^{2}}\), therefore from (5) assuming positive

\begin{align*} \tau ^{\prime } & =\frac {1}{c}\sqrt {\frac {a^{2}}{x^{2}}}\\ & =\frac {a}{cx}\end{align*}

Hence \(p_{1}\) becomes using (2)

\begin{align*} p_{1}\left ( \tau \right ) & =\frac {\tau ^{\prime \prime }\left ( x\right ) +p\tau ^{\prime }\left ( x\right ) }{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {\left ( 1-2a\right ) c}{x}\end{align*}

Which is not a constant. So this transformation failed.

Approach 2  Let \(p_{1}=0\). If with this choice \(q_{1}\) becomes a constant or a constant divided by \(\tau ^{2}\) then (2) can be integrated. \(p_{1}=0\) implies from (2) that

\begin{align*} \tau ^{\prime \prime }+p\tau ^{\prime } & =0\\ \tau & =\int e^{-\int pdx}dx\\ & =\int e^{-\int \frac {\left ( 1-2a\right ) }{x}dx}dx\\ & =\int x^{2a-1}dx\\ & =\frac {x^{2a}}{2a}\end{align*}

Using this then \(q_{1}\) becomes

\begin{align} q_{1} & =\frac {q}{\left ( \tau ^{\prime }\left ( x\right ) \right ) ^{2}}\nonumber \\ & =\frac {\left ( \frac {a^{2}}{x^{2}}\right ) }{\left ( x^{2a-1}\right ) ^{2}}\nonumber \\ & =\frac {a^{2}}{x^{2}x^{4a-2}}\nonumber \\ & =\frac {a^{2}}{x^{4a}} \tag {6}\end{align}

Which is not constant. But \(\tau ^{2}=\left ( \frac {x^{2a}}{2a}\right ) ^{2}=\frac {x^{4a}}{4a^{2}}\). Hence \(q_{1}=\frac {1}{4}\frac {1}{\tau ^{2}}\). Hence this transformation works. Eq (2) becomes

\begin{align} y^{\prime \prime }+p_{1}y^{\prime }+q_{1}y & =0\tag {1}\\ y^{\prime \prime }+\frac {1}{4}\frac {1}{\tau ^{2}}y & =0\nonumber \\ 4\tau ^{2}y^{\prime \prime }+y & =0\nonumber \end{align}

Which is standard Euler ode which can be solved easily. Giving

\[ y\left ( \tau \right ) =A\sqrt {\tau }+B\sqrt {\tau }\ln \left ( \tau \right ) \]

But \(\tau =\frac {x^{2a}}{2a}\). Hence the above becomes

\begin{align*} y\left ( x\right ) & =A\sqrt {\frac {x^{2a}}{2a}}+B\sqrt {\frac {x^{2a}}{2a}}\ln \left ( \frac {x^{2a}}{2a}\right ) \\ & =A\sqrt {\frac {x^{2a}}{2a}}+B\sqrt {\frac {x^{2a}}{2a}}\ln \left ( \frac {x^{2a}}{2a}\right ) \\ & =A_{1}x^{a}+B_{1}x^{a}\ln \left ( \frac {x^{2a}}{2a}\right ) \end{align*}

Example 10. Bessel ODE Given the ode

\begin{equation} y^{\prime \prime }\left ( x\right ) +\left ( 1-\frac {3}{4x^{2}}\right ) y\left ( x\right ) =0 \tag {A}\end{equation}

Trying change of variables on the dependent variable (first method).  In this method we assume

\[ y=v\left ( x\right ) z\left ( x\right ) \]

The ode is \(y^{\prime \prime }+py^{\prime }+qy=0\). Hence \(p=0,q=\left ( 1-\frac {3}{4x^{2}}\right ) \).  Therefore the Liouville ode invariant is

\begin{align*} q_{1} & =q-\frac {1}{2}p^{\prime }-\frac {1}{4}p^{2}\\ & =\left ( 1-\frac {3}{4x^{2}}\right ) \end{align*}

Since \(q_{1}\) is not constant, then this method does not work.

Trying change of variable on independent variable.

Let \(z=g\left ( x\right ) \) where \(z\) will be the new independent variable. In general, given an ode of the form

\[ y^{\prime \prime }\left ( x\right ) +p\left ( x\right ) y^{\prime }\left ( x\right ) +q\left ( x\right ) y\left ( x\right ) =r\left ( x\right ) \]

Then applying this transformation results in

\begin{equation} y^{\prime \prime }\left ( z\right ) +p_{1}\left ( z\right ) y^{\prime }\left ( z\right ) +q_{1}\left ( z\right ) y\left ( z\right ) =r_{1}\left ( z\right ) \tag {1}\end{equation}

Where

\begin{align} p_{1}\left ( z\right ) & =\frac {z^{\prime \prime }\left ( x\right ) +pz^{\prime }\left ( x\right ) }{\left ( z^{\prime }\left ( x\right ) \right ) ^{2}}\tag {2}\\ q_{1}\left ( z\right ) & =\frac {q}{\left ( z^{\prime }\left ( x\right ) \right ) ^{2}}\tag {3}\\ r_{1}\left ( z\right ) & =\frac {r}{\left ( z^{\prime }\left ( x\right ) \right ) ^{2}} \tag {4}\end{align}

Approach 1. Let \(q_{1}=c^{2}\) where \(c^{2}\) is some constant. This implies

\begin{align} \frac {q}{\left ( z^{\prime }\left ( x\right ) \right ) ^{2}} & =c^{2}\nonumber \\ z & =\frac {1}{c}\int \sqrt {q}dx \tag {5}\end{align}

If with this \(z\), then \(p_{1}\) turns out to be constant, then it means (1) is second order constant coefficient ode. Applying this on current ode then (5) becomes

\begin{align*} z & =\frac {1}{c}\int \sqrt {\left ( 1-\frac {3}{4x^{2}}\right ) }dx\\ & =\frac {1}{2c}\left ( \sqrt {4x^{2}-3}+\sqrt {3}\arctan \left ( \frac {\sqrt {3}}{\sqrt {4x^{2}-3}}\right ) \right ) \end{align*}

Hence (2) becomes

\begin{align*} p_{1}\left ( z\right ) & =\frac {z^{\prime \prime }\left ( x\right ) +pz^{\prime }\left ( x\right ) }{\left ( z^{\prime }\left ( x\right ) \right ) ^{2}}\\ & =\frac {6c}{\left ( 4x^{2}-3\right ) ^{\frac {3}{2}}}\end{align*}

Which is not a constant. So this transformation did not work.  So change of variable on both the dependent and independent variable does not work for this ode to convert it to one with constant coefficient. Trying converting it to standard Bessel ODE.  Using this change of variable on the dependent variable

\[ y=ux^{\frac {1}{2}}\]

To transform (A) to standard Bessel ODE

\[ x^{2}u^{\prime \prime }+xu^{\prime }+\left ( x^{2}-1\right ) u=0 \]

Since \(y=ux^{\frac {1}{2}}\) then

\begin{equation} \frac {dy}{dx}=\frac {du}{dx}x^{\frac {1}{2}}+u\frac {x^{\frac {-1}{2}}}{2} \tag {2A}\end{equation}

And

\begin{align} \frac {d^{2}y}{dx^{2}} & =\frac {d}{dx}\left ( \frac {du}{dx}x^{\frac {1}{2}}+u\frac {x^{\frac {-1}{2}}}{2}\right ) \nonumber \\ & =\frac {d}{dx}\left ( \frac {du}{dx}x^{\frac {1}{2}}\right ) +\frac {d}{dx}\left ( u\frac {x^{\frac {-1}{2}}}{2}\right ) \nonumber \\ & =\frac {d^{2}u}{dx^{2}}x^{\frac {1}{2}}+\frac {1}{2}\frac {du}{dx}x^{-\frac {1}{2}}+\frac {1}{2}\frac {du}{dx}x^{\frac {-1}{2}}-\frac {1}{4}ux^{-\frac {3}{2}}\nonumber \\ & =\frac {d^{2}u}{dx^{2}}x^{\frac {1}{2}}+\frac {du}{dx}x^{-\frac {1}{2}}-\frac {1}{4}ux^{-\frac {3}{2}} \tag {3A}\end{align}

Substituting (2A,3A) into (A) gives

\begin{align*} \frac {d^{2}u}{dx^{2}}x^{\frac {1}{2}}+\frac {du}{dx}x^{-\frac {1}{2}}-\frac {1}{4}ux^{-\frac {3}{2}}+\left ( 1-\frac {3}{4x^{2}}\right ) ux^{\frac {1}{2}} & =0\\ \frac {d^{2}u}{dx^{2}}x^{\frac {1}{2}}+\frac {du}{dx}x^{-\frac {1}{2}}-\frac {1}{4}ux^{-\frac {3}{2}}+ux^{\frac {1}{2}}-\frac {3}{4}ux^{-\frac {3}{2}} & =0\\ \frac {d^{2}u}{dx^{2}}x^{\frac {1}{2}}+\frac {du}{dx}x^{-\frac {1}{2}}-ux^{-\frac {3}{2}}+ux^{\frac {1}{2}} & =0 \end{align*}

Multiplying both side by \(x^{\frac {3}{2}}\) gives

\begin{align*} x^{2}\frac {d^{2}u}{dx^{2}}+x\frac {du}{dx}-u+ux^{2} & =0\\ x^{2}\frac {d^{2}u}{dx^{2}}+x\frac {du}{dx}-\left ( 1-x^{2}\right ) u & =0\\ x^{2}\frac {d^{2}u}{dx^{2}}+x\frac {du}{dx}+\left ( x^{2}-1\right ) u & =0 \end{align*}

Which is Bessel ode where order is \(n=1\). This has known standard solution. Once \(u\left ( x\right ) \) is known, then \(y\left ( x\right ) \) which is the solution to the original ODE (A) is now known also. There is a more general method and better method to find if second order ode can be transformed to Bessel ODE. See my main page for examples and description.