3.5.1.2 Example 2 \(\left ( x-2\right ) ^{2}y^{\prime \prime }+\left ( x-2\right ) y^{\prime }+y=x\)
This examples shows how to solve the Euler ode when coefficients have constant shift as in
this example. This method only work when the shift is the same on both coefficients
of \(y^{\prime \prime }\) and \(y^{\prime }\). We start by assuming \(X=x-2\) or \(x=X+2\). The ode becomes
\[ X^{2}y^{\prime \prime }+Xy^{\prime }+y=X+2 \]
In the above,
\(y\) is now a
function of
\(X\) and not
\(x\). We always start by solving
\(y_{h}\) from
\[ X^{2}y^{\prime \prime }+Xy^{\prime }+y=0 \]
As we did in the above
example, the solution is
\[ y_{h}\left ( X\right ) =c_{1}\cos \left ( \ln X\right ) +c_{2}\sin \left ( \ln X\right ) \]
Now we find the particular solution where now
\(f\left ( X\right ) =X+2\) and
not
\(x\). Hence the solution is
\[ y=y_{h}+y_{p}\]
\(y_{p}\) is found from variation of parameters as before.
\[ y_{p}=u_{1}y_{1}+u_{2}y_{2}\]
Where
\begin{align*} u_{1} & =-\int \frac {y_{2}f\left ( X\right ) }{aW}dX\\ u_{2} & =\int \frac {y_{1}f\left ( X\right ) }{aW}dX \end{align*}
Where \(f=X+2\) in this case, since this is the forcing function in the rhs of the original
ode and \(W\) is the wronskian which is \(\frac {1}{X}\) as was found in the first example. Hence \(u_{1},u_{2}\)
become
\begin{align*} u_{1} & =-\int \frac {\left ( X+2\right ) \sin \left ( \ln X\right ) }{X^{2}\left ( \frac {1}{X}\right ) }dX=-\int \frac {\left ( X+2\right ) \sin \left ( \ln X\right ) }{X}dX=2\cos \left ( \ln X\right ) +\frac {1}{2}X\cos \left ( \ln X\right ) -\frac {1}{2}X\sin \left ( \ln X\right ) \\ u_{2} & =\int \frac {\left ( X+2\right ) \cos \left ( \ln \left ( x\right ) \right ) }{X^{2}\left ( \frac {1}{X}\right ) }dX=\int \frac {\left ( X+2\right ) \cos \left ( \ln \left ( x\right ) \right ) }{X}dX=2\sin \left ( \ln X\right ) +\frac {1}{2}X\cos \left ( \ln X\right ) +\frac {1}{2}X\sin \left ( \ln X\right ) \end{align*}
Hence
\begin{align*} y_{p} & =u_{1}y_{1}+u_{2}y_{2}\\ & =\left ( 2\cos \left ( \ln X\right ) +\frac {1}{2}X\cos \left ( \ln X\right ) -\frac {1}{2}X\sin \left ( \ln X\right ) \right ) \cos \left ( \ln \left ( X\right ) \right ) +\left ( 2\sin \left ( \ln X\right ) +\frac {1}{2}X\cos \left ( \ln X\right ) +\frac {1}{2}X\sin \left ( \ln X\right ) \right ) \sin \left ( \ln X\right ) \\ & =2\cos ^{2}\left ( \ln X\right ) +\frac {1}{2}X\cos ^{2}\left ( \ln X\right ) -\frac {1}{2}X\sin \left ( \ln X\right ) \cos \left ( \ln \left ( X\right ) \right ) +2\sin ^{2}\left ( \ln X\right ) +\frac {1}{2}X\cos \left ( \ln X\right ) \sin \left ( \ln X\right ) +\frac {1}{2}X\sin ^{2}\left ( \ln X\right ) \\ & =2+\frac {1}{2}X \end{align*}
Therefore the solution is
\begin{align*} y\left ( X\right ) & =y_{h}+y_{p}\\ & =2+\frac {1}{2}X+c_{1}\cos \left ( \ln X\right ) +c_{2}\sin \left ( \ln X\right ) \end{align*}
The solution to the original ode is now found by replacing \(X=x-2\) which gives
\begin{align*} y\left ( x\right ) & =2+\frac {1}{2}\left ( x-2\right ) +c_{1}\cos \left ( \ln \left ( x-2\right ) \right ) +c_{2}\sin \left ( \ln \left ( x-2\right ) \right ) \\ & =1+\frac {1}{2}x+c_{1}\cos \left ( \ln \left ( x-2\right ) \right ) +c_{2}\sin \left ( \ln \left ( x-2\right ) \right ) \end{align*}