home

PDF (letter size)

Comparing solving ODE problems using Variation of parameters and Green’s function methods

Nasser M. Abbasi

December 15, 2018   Compiled on January 29, 2024 at 3:14am

Contents

1 Problem 1 (boundary value)
1.1 Variation of parameters solution
1.2 Green function solution
2 Problem 2 (boundary value)
2.1 Variation of parameters solution
2.2 Green function solution
3 Problem 3 (Initial value problem)
3.1 Variation of parameters solution
3.2 Green function solution

1 Problem 1 (boundary value)

Solve \(y^{\prime \prime }+\frac {1}{4}y=\sin 2x\) with \(y\left ( 0\right ) =0,y\left ( \pi \right ) =0\)

1.1 Variation of parameters solution

Solutions to\(\ y^{\prime \prime }+\frac {1}{4}y=0\) are \(y_{1}\left ( x\right ) =\cos \left ( \frac {x}{2}\right ) \) and \(y_{2}\left ( x\right ) =\sin \left ( \frac {x}{2}\right ) \). Hence Wronskian is \(W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} \cos \left ( \frac {x}{2}\right ) & \sin \left ( \frac {x}{2}\right ) \\ -\frac {1}{2}\sin \left ( \frac {x}{2}\right ) & \frac {1}{2}\cos \left ( \frac {x}{2}\right ) \end {vmatrix} \), therefore \(W=\frac {1}{2}\). Hence the particular solution is \begin {align} y_{p}\left ( x\right ) & =-y_{1}\left ( x\right ) \int \frac {y_{2}\left ( x\right ) f\left ( x\right ) }{W}dx+y_{2}\left ( x\right ) \int \frac {y_{1}\left ( x\right ) f\left ( x\right ) }{W}dx\nonumber \\ & =-2\cos \left ( \frac {x}{2}\right ) \int \sin \left ( \frac {x}{2}\right ) \sin \left ( 2x\right ) dx+2\sin \left ( \frac {x}{2}\right ) \int \cos \left ( \frac {x}{2}\right ) \sin \left ( 2x\right ) dx\tag {1A}\\ & =-2\cos \left ( \frac {x}{2}\right ) \left ( \frac {1}{3}\sin \left ( \frac {3x}{2}\right ) -\frac {1}{5}\sin \left ( \frac {5x}{2}\right ) \right ) +2\sin \left ( \frac {x}{2}\right ) \left ( \frac {8}{3}\cos ^{2}\left ( \frac {x}{2}\right ) -\frac {16}{5}\cos ^{2}\left ( \frac {x}{2}\right ) \right ) \nonumber \end {align}

Which is equivalent (using trig relations) to \(y_{p}\left ( x\right ) =-\frac {4}{15}\sin \left ( 2x\right ) \). Hence the complete solution is \[ y\left ( x\right ) =C_{1}\cos \left ( \frac {x}{2}\right ) +C_{2}\sin \left ( \frac {x}{2}\right ) -\frac {4}{15}\sin \left ( 2x\right ) \] Boundary condition \(y\left ( 0\right ) =0\) gives\[ 0=C_{1}\] Hence solution becomes\[ y\left ( x\right ) =C_{2}\sin \left ( \frac {x}{2}\right ) -\frac {4}{15}\sin \left ( 2x\right ) \] Boundary condition \(y\left ( \pi \right ) =0\) gives\begin {align*} 0 & =C_{2}\sin \left ( \frac {\pi }{2}\right ) -\frac {4}{15}\sin \left ( 2\pi \right ) \\ & =C_{2} \end {align*}

Hence solution is\[ y\left ( x\right ) =-\frac {4}{15}\sin \left ( 2x\right ) \]

1.2 Green function solution

The solution \(y_{2}\left ( x\right ) =\sin \left ( \frac {x}{2}\right ) \) satisfies the left side boundary condition \(y\left ( 0\right ) =0\) and the solution \(y_{1}\left ( x\right ) =\cos \left ( \frac {x}{2}\right ) \) satisfies the right side boundary condition \(y\left ( \pi \right ) =0\). Therefore the Green function is\[ G\left ( x,x_{0}\right ) =\left \{ \begin {array} [c]{cc}A\sin \left ( \frac {x}{2}\right ) & 0<x<x_{0}\\ B\cos \left ( \frac {x}{2}\right ) & x_{0}<x<\pi \end {array} \right . \] Where \(A,B\) depend on \(x_{0}\) and not on \(x\). By continuity of \(G\) over \(x=x_{0}\) the above gives\begin {align} A\sin \left ( \frac {x_{0}}{2}\right ) & =B\cos \left ( \frac {x_{0}}{2}\right ) \nonumber \\ A & =B\frac {\cos \left ( \frac {x_{0}}{2}\right ) }{\sin \left ( \frac {x_{0}}{2}\right ) }\tag {1} \end {align}

Taking derivative of \(G\) at \(x=x_{0}\) gives\[ G^{\prime }\left ( x,x_{0}\right ) =\left \{ \begin {array} [c]{cc}\frac {1}{2}A\cos \left ( \frac {x_{0}}{2}\right ) & 0<x<x_{0}\\ \frac {-1}{2}B\sin \left ( \frac {x_{0}}{2}\right ) & x_{0}<x<\pi \end {array} \right . \] The jump discontinuity condition gives\[ \frac {-1}{2}B\sin \left ( \frac {x_{0}}{2}\right ) -\frac {1}{2}A\cos \left ( \frac {x_{0}}{2}\right ) =\frac {-1}{p\left ( x\right ) }\] Where \(p\left ( x\right ) \) comes from writing the original ODE in Sturm Liouville form, which is \(-\left ( py^{\prime }\right ) ^{\prime }+\frac {1}{4}y=0\). Therefore \(p=-1\) and the above becomes\begin {equation} \frac {-1}{2}B\sin \left ( \frac {x_{0}}{2}\right ) -\frac {1}{2}A\cos \left ( \frac {x_{0}}{2}\right ) =1\tag {2} \end {equation} Substituting (1) into (2) gives\begin {align*} \frac {-1}{2}B\sin \left ( \frac {x_{0}}{2}\right ) -\frac {1}{2}\left ( B\frac {\cos \left ( \frac {x_{0}}{2}\right ) }{\sin \left ( \frac {x_{0}}{2}\right ) }\right ) \cos \left ( \frac {x_{0}}{2}\right ) & =1\\ \frac {-1}{2}B\sin \left ( \frac {x_{0}}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) -\frac {1}{2}\left ( B\cos \left ( \frac {x_{0}}{2}\right ) \right ) \cos \left ( \frac {x_{0}}{2}\right ) & =\sin \left ( \frac {x_{0}}{2}\right ) \\ \frac {-B}{2}\left ( \sin \left ( \frac {x_{0}}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) +\cos \left ( \frac {x_{0}}{2}\right ) \cos \left ( \frac {x_{0}}{2}\right ) \right ) & =\sin \left ( \frac {x_{0}}{2}\right ) \\ \frac {-B}{2}\left ( \sin ^{2}\left ( \frac {x_{0}}{2}\right ) +\cos ^{2}\left ( \frac {x_{0}}{2}\right ) \right ) & =\sin \left ( \frac {x_{0}}{2}\right ) \\ B & =-2\sin \left ( \frac {x_{0}}{2}\right ) \end {align*}

Hence \begin {align*} A & =-2\sin \left ( \frac {x_{0}}{2}\right ) \frac {\cos \left ( \frac {x_{0}}{2}\right ) }{\sin \left ( \frac {x_{0}}{2}\right ) }\\ & =-2\cos \left ( \frac {x_{0}}{2}\right ) \end {align*}

Therefore Green function becomes\[ G\left ( x,x_{0}\right ) =-2\left \{ \begin {array} [c]{cc}\cos \left ( \frac {x_{0}}{2}\right ) \sin \left ( \frac {x}{2}\right ) & 0<x<x_{0}\\ \sin \left ( \frac {x_{0}}{2}\right ) \cos \left ( \frac {x}{2}\right ) & x_{0}<x<\pi \end {array} \right . \] Here comes an important step, we now flip the \(x,x_{0}\) above to be\[ G\left ( x_{0},x\right ) =-2\left \{ \begin {array} [c]{cc}\cos \left ( \frac {x}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) & 0<x_{0}<x\\ \sin \left ( \frac {x}{2}\right ) \cos \left ( \frac {x_{0}}{2}\right ) & x<x_{0}<\pi \end {array} \right . \] We need to do this, since integration below over \(x_{0}\) and we would like the answer to be as function of \(x\) and not \(x_{0}\). Hence the solution is\begin {align*} y\left ( x\right ) & =\int _{0}^{\pi }G\left ( x_{0},x\right ) f\left ( x_{0}\right ) dx_{0}\\ & =\int _{0}^{x}G\left ( x_{0},x\right ) f\left ( x_{0}\right ) dx_{0}+\int _{x}^{\pi }G\left ( x_{0},x\right ) f\left ( x_{0}\right ) dx_{0}\\ & =-2\int _{0}^{x}\cos \left ( \frac {x}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) \sin \left ( 2x_{0}\right ) dx_{0}-2\int _{x}^{\pi }\sin \left ( \frac {x}{2}\right ) \cos \left ( \frac {x_{0}}{2}\right ) \sin \left ( 2x_{0}\right ) dx_{0}\\ & =-2\cos \left ( \frac {x}{2}\right ) \int _{0}^{x}\sin \left ( \frac {x_{0}}{2}\right ) \sin \left ( 2x_{0}\right ) dx_{0}-2\sin \left ( \frac {x}{2}\right ) \int _{x}^{\pi }\cos \left ( \frac {x_{0}}{2}\right ) \sin \left ( 2x_{0}\right ) dx_{0}\\ & =-\frac {8}{15}\cos \left ( x\right ) \sin \left ( x\right ) \\ & =-\frac {4}{15}\sin \left ( 2x\right ) \end {align*}

Which is the same as Variation of parameters solution.

2 Problem 2 (boundary value)

This is the same as the above problem, but with different forcing function. Solve \(y^{\prime \prime }+\frac {1}{4}y=\frac {x}{2}\) with \(y\left ( 0\right ) =0,y\left ( \pi \right ) =0\)

2.1 Variation of parameters solution

Solutions to\(\ y^{\prime \prime }+\frac {1}{4}y=0\) are \(y_{1}\left ( x\right ) =\cos \left ( \frac {x}{2}\right ) \) and \(y_{2}\left ( x\right ) =\sin \left ( \frac {x}{2}\right ) \). Hence Wronskian is \(W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} \cos \left ( \frac {x}{2}\right ) & \sin \left ( \frac {x}{2}\right ) \\ -\frac {1}{2}\sin \left ( \frac {x}{2}\right ) & \frac {1}{2}\cos \left ( \frac {x}{2}\right ) \end {vmatrix} \), therefore \(W=\frac {1}{2}\). Hence the particular solution is \begin {align} y_{p}\left ( x\right ) & =-y_{1}\left ( x\right ) \int \frac {y_{2}\left ( x\right ) f\left ( x\right ) }{W}dx+y_{2}\left ( x\right ) \int \frac {y_{1}\left ( x\right ) f\left ( x\right ) }{W}dx\nonumber \\ & =-2\cos \left ( \frac {x}{2}\right ) \int \sin \left ( \frac {x}{2}\right ) \frac {x}{2}dx+2\sin \left ( \frac {x}{2}\right ) \int \cos \left ( \frac {x}{2}\right ) \frac {x}{2}dx\tag {1A}\\ & =2x\nonumber \end {align}

Hence the complete solution is \[ y\left ( x\right ) =C_{1}\cos \left ( \frac {x}{2}\right ) +C_{2}\sin \left ( \frac {x}{2}\right ) +2x \] Boundary condition \(y\left ( 0\right ) =0\) gives\[ 0=C_{1}\] Hence solution becomes\[ y\left ( x\right ) =C_{2}\sin \left ( \frac {x}{2}\right ) +2x \] Boundary condition \(y\left ( \pi \right ) =0\) gives\begin {align*} 0 & =C_{2}\sin \left ( \frac {\pi }{2}\right ) +2\pi \\ -2\pi & =C_{2} \end {align*}

Hence solution is\[ y\left ( x\right ) =-2\pi \sin \left ( \frac {x}{2}\right ) +2x \]

2.2 Green function solution

We already found the Green function for the operator \(y^{\prime \prime }+\frac {1}{4}y=0\) with same boundary conditions. So we only need to do the convolution integral now. This is the advantage of using Green function. Once we find it for same operator with same BC, we can use it to find solution when the forcing function changes, by just doing the final convolution integration. The hard work of finding Green function only needs to be done once.

Using\[ G\left ( x_{0},x\right ) =-2\left \{ \begin {array} [c]{cc}\cos \left ( \frac {x}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) & 0<x_{0}<x\\ \sin \left ( \frac {x}{2}\right ) \cos \left ( \frac {x_{0}}{2}\right ) & x<x_{0}<\pi \end {array} \right . \] Hence the solution is\begin {align*} y\left ( x\right ) & =\int _{0}^{\pi }G\left ( x_{0},x\right ) f\left ( x_{0}\right ) dx_{0}\\ & =\int _{0}^{x}G\left ( x_{0},x\right ) f\left ( x_{0}\right ) dx_{0}+\int _{x}^{\pi }G\left ( x,x_{0}\right ) f\left ( x_{0}\right ) dx_{0}\\ & =-2\int _{0}^{x}\cos \left ( \frac {x}{2}\right ) \sin \left ( \frac {x_{0}}{2}\right ) \frac {x_{0}}{2}dx_{0}-2\int _{x}^{\pi }\sin \left ( \frac {x}{2}\right ) \cos \left ( \frac {x_{0}}{2}\right ) \frac {x_{0}}{2}dx_{0}\\ & =-2\cos \left ( \frac {x}{2}\right ) \int _{0}^{x}\sin \left ( \frac {x_{0}}{2}\right ) \frac {x_{0}}{2}dx_{0}-2\sin \left ( \frac {x}{2}\right ) \int _{x}^{\pi }\cos \left ( \frac {x_{0}}{2}\right ) \frac {x_{0}}{2}dx_{0}\\ & =-2\pi \sin \left ( \frac {x}{2}\right ) +2x \end {align*}

Which is the same as Variation of parameters solution.

3 Problem 3 (Initial value problem)

Green’s function can also be used to solve initial value problem. Solve \(y^{\prime \prime }+\omega ^{2}y=\sin \left ( t\right ) \) with \(y\left ( 0\right ) =0,y^{\prime }\left ( 0\right ) =0.\)

3.1 Variation of parameters solution

Solutions to\(\ y^{\prime \prime }\left ( t\right ) +\omega ^{2}y\left ( t\right ) =0\) are \(y_{1}\left ( x\right ) =\cos \left ( \omega t\right ) \) and \(y_{2}\left ( x\right ) =\sin \left ( \omega t\right ) \). Hence Wronskian is \(W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} \cos \left ( \omega t\right ) & \sin \left ( \omega t\right ) \\ -\omega \sin \left ( \omega t\right ) & \omega \cos \left ( \omega t\right ) \end {vmatrix} \), therefore \(W=\omega \). Hence the particular solution is \begin {align} y_{p}\left ( t\right ) & =-y_{1}\left ( t\right ) \int \frac {y_{2}\left ( t\right ) f\left ( t\right ) }{W}dt+y_{2}\left ( t\right ) \int \frac {y_{1}\left ( t\right ) f\left ( t\right ) }{W}dt\nonumber \\ & =-\frac {\cos \left ( \omega t\right ) }{\omega }\int \sin \left ( \omega t\right ) \sin \left ( t\right ) dt+\frac {\sin \left ( \omega t\right ) }{\omega }\int \cos \left ( \omega t\right ) \sin \left ( t\right ) dt\tag {1A}\\ & =\frac {\sin \left ( t\right ) }{\omega ^{2}-1}\nonumber \end {align}

Hence the complete solution is \[ y\left ( t\right ) =C_{1}\cos \left ( \omega t\right ) +C_{2}\sin \left ( \omega t\right ) +\frac {\sin \left ( t\right ) }{\omega ^{2}-1}\] Boundary condition \(y\left ( 0\right ) =0\) gives\[ 0=C_{1}\] Hence solution becomes\begin {align*} y\left ( t\right ) & =C_{2}\sin \left ( \omega t\right ) +\frac {\sin \left ( t\right ) }{\omega ^{2}-1}\\ y^{\prime }\left ( t\right ) & =\omega C_{2}\cos \left ( \omega t\right ) +\frac {\cos \left ( t\right ) }{\omega ^{2}-1} \end {align*}

Boundary condition \(y^{\prime }\left ( t\right ) =0\) gives\begin {align*} 0 & =\omega C_{2}+\frac {1}{\omega ^{2}-1}\\ \frac {1}{\omega \left ( 1-\omega ^{2}\right ) } & =C_{2} \end {align*}

Hence solution is\[ y\left ( t\right ) =\frac {1}{\omega \left ( 1-\omega ^{2}\right ) }\sin \left ( \omega t\right ) +\frac {\sin \left ( t\right ) }{\omega ^{2}-1}\]

3.2 Green function solution

The main difference between initial value and boundary value for using Green function, is that in boundary value, we set it up as

\[ G\left ( t,t_{0}\right ) =\left \{ \begin {array} [c]{cc}C_{1}y_{1}\left ( t\right ) & 0<t<t_{0}\\ C_{2}y_{2}\left ( t\right ) & t_{0}<t<\infty \end {array} \right . \] Where \(y_{1}\left ( t\right ) ,y_{2}\left ( t\right ) \) are the corresponding basis for the solutions of homogeneous ODE \(y^{\prime \prime }\left ( t\right ) +\cdots =0\). Since this ODE will have 2 solution basis, we select the one which satisfies the left boundary and call it \(y_{1}\left ( t\right ) \) and select the one which satisfies the right boundary and call it \(y_{2}\left ( t\right ) \) and now we only have to find \(C_{1},C_{2}\) which depends on \(t_{0}\) by using continuity and jump discontinuity condition on \(G\).

In initial value problem, we can’t do this, since all conditions are on one end. Instead We write the Green function as\[ G\left ( t,t_{0}\right ) =\left \{ \begin {array} [c]{cc}C_{1}y_{1}\left ( t\right ) +C_{2}y_{2}\left ( t\right ) & 0<t<t_{0}\\ C_{3}y_{1}\left ( t\right ) +C_{4}y_{2}\left ( t\right ) & t_{0}<t<\infty \end {array} \right . \] And then find \(C_{1},C_{2}\) both from the initial conditions. If initial conditions are homogeneous, like this in problem, then we will find that \(C_{1}=0\) and also \(C_{2}=0\) as expected. And we end up with Green function that looks like\[ G\left ( t,t_{0}\right ) =\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ C_{3}y_{1}\left ( t\right ) +C_{4}y_{2}\left ( t\right ) & t_{0}<t<\infty \end {array} \right . \] Where we now solve for \(C_{3},C_{4}\) which depends on \(t_{0}\) by using continuity and jump discontinuity condition on \(G\) as before. The above will result if the the initial conditions are zero as in this case. So we start from the above form and now find \(C_{3},C_{4}\).

Since \(y_{1}\left ( t\right ) =\cos \left ( \omega t\right ) ,y_{2}\left ( t\right ) =\sin \left ( \omega t\right ) \), then \(G\) becomes\begin {equation} G\left ( t,t_{0}\right ) =\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ C_{3}\cos \left ( \omega t\right ) +C_{4}\sin \left ( \omega t\right ) & t_{0}<t<\infty \end {array} \right . \tag {1A} \end {equation} continuity conditions on \(G\) gives\begin {equation} C_{3}\cos \left ( \omega t_{0}\right ) +C_{4}\sin \left ( \omega t_{0}\right ) =0 \tag {1} \end {equation} Taking derivative at \(t=t_{0}\) gives\[ G^{\prime }\left ( t,t_{0}\right ) =\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ -\omega C_{3}\sin \left ( \omega t\right ) +\omega C_{4}\cos \left ( \omega t\right ) & t_{0}<t<\infty \end {array} \right . \] Jump discontinuity gives\begin {equation} -\omega C_{3}\sin \left ( \omega t_{0}\right ) +\omega C_{4}\cos \left ( \omega t_{0}\right ) =\frac {-1}{p\left ( t_{0}\right ) }=1 \tag {2} \end {equation} Since \(p\left ( t_{0}\right ) =-1\) by looking at the ODE. Solving (1,2) for \(C_{3},C_{4}\). From (1)\[ C_{3}=-C_{4}\frac {\sin \left ( \omega t_{0}\right ) }{\cos \left ( \omega t_{0}\right ) }\] From (2)\begin {align*} -\omega \left ( -C_{4}\frac {\sin \left ( \omega t_{0}\right ) }{\cos \left ( \omega t_{0}\right ) }\right ) \sin \left ( \omega t_{0}\right ) +\omega C_{4}\cos \left ( \omega t_{0}\right ) & =1\\ \omega C_{4}\left ( \frac {\sin \left ( \omega t\right ) }{\cos \left ( \omega t_{0}\right ) }\sin \left ( \omega t_{0}\right ) +\cos \left ( \omega t_{0}\right ) \right ) & =1\\ \omega C_{4}\left ( \sin \left ( \omega t_{0}\right ) \sin \left ( \omega t_{0}\right ) +\cos \left ( \omega t_{0}\right ) \cos \left ( \omega t_{0}\right ) \right ) & =\cos \left ( \omega t_{0}\right ) \\ \omega C_{4} & =\cos \left ( \omega t_{0}\right ) \\ C_{4} & =\frac {\cos \left ( \omega t_{0}\right ) }{\omega } \end {align*}

Hence \(C_{3}\) becomes\begin {align*} C_{3} & =-\left ( \frac {\cos \left ( \omega t_{0}\right ) }{\omega }\right ) \frac {\sin \left ( \omega t_{0}\right ) }{\cos \left ( \omega t_{0}\right ) }\\ & =-\frac {\sin \left ( \omega t_{0}\right ) }{\omega } \end {align*}

Therefore (1A) becomes\begin {align*} G\left ( t,t_{0}\right ) & =\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ -\frac {\sin \left ( \omega t_{0}\right ) }{\omega }\cos \left ( \omega t\right ) +\frac {\cos \left ( \omega t_{0}\right ) }{\omega }\sin \left ( \omega t\right ) & t_{0}<t<\infty \end {array} \right . \\ & =\frac {1}{\omega }\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ -\sin \left ( \omega t_{0}\right ) \cos \left ( \omega t\right ) +\cos \left ( \omega t_{0}\right ) \sin \left ( \omega t\right ) & t_{0}<t<\infty \end {array} \right . \end {align*}

Using \(\sin A\cos B-\cos A\sin B=\sin \left ( A-B\right ) \) the above becomes, using \(\sin \left ( \omega t\right ) \cos \left ( \omega t_{0}\right ) -\cos \left ( \omega t\right ) \sin \left ( \omega t_{0}\right ) \,\), where \(A=\omega t,B=\omega t_{0}\) \[ G\left ( t,t_{0}\right ) =\frac {1}{\omega }\left \{ \begin {array} [c]{cc}0 & 0<t<t_{0}\\ \sin \left ( \omega \left ( t-t_{0}\right ) \right ) & t_{0}<t<\infty \end {array} \right . \] So, we finally found the Green function. The solution is now found using convolution \begin {align*} y\left ( t\right ) & =\int _{0}^{t}G\left ( t,t_{0}\right ) f\left ( t_{0}\right ) dt_{0}\\ & =\frac {1}{\omega }\int _{0}^{t}\sin \left ( \omega \left ( t-t_{0}\right ) \right ) \sin \left ( t_{0}\right ) dt_{0}\\ & =\frac {1}{\omega \left ( 1-\omega ^{2}\right ) }\sin \left ( \omega t\right ) +\frac {\sin \left ( t\right ) }{\omega ^{2}-1} \end {align*}

Which is the same answer using variation of parameters.

To add more problems...