\[ -\sin (a x) \sin (b x)+y''(x)+y(x)=0 \] ✓ Mathematica : cpu = 0.549023 (sec), leaf count = 1163
\[\left \{\left \{y(x)\to c_1 \cos (x)+c_2 \sin (x)+\frac {-\cos (x) \cos ((a-b-1) x) a^3+\cos (x) \cos ((a-b+1) x) a^3+\cos (x) \cos ((a+b-1) x) a^3-\cos (x) \cos ((a+b+1) x) a^3+\sin (x) \sin ((a-b-1) x) a^3+\sin (x) \sin ((a-b+1) x) a^3-\sin (x) \sin ((a+b-1) x) a^3-\sin (x) \sin ((a+b+1) x) a^3-b \cos (x) \cos ((a-b-1) x) a^2-\cos (x) \cos ((a-b-1) x) a^2+b \cos (x) \cos ((a-b+1) x) a^2-\cos (x) \cos ((a-b+1) x) a^2-b \cos (x) \cos ((a+b-1) x) a^2+\cos (x) \cos ((a+b-1) x) a^2+b \cos (x) \cos ((a+b+1) x) a^2+\cos (x) \cos ((a+b+1) x) a^2+b \sin (x) \sin ((a-b-1) x) a^2+\sin (x) \sin ((a-b-1) x) a^2+b \sin (x) \sin ((a-b+1) x) a^2-\sin (x) \sin ((a-b+1) x) a^2+b \sin (x) \sin ((a+b-1) x) a^2-\sin (x) \sin ((a+b-1) x) a^2+b \sin (x) \sin ((a+b+1) x) a^2+\sin (x) \sin ((a+b+1) x) a^2+b^2 \cos (x) \cos ((a-b-1) x) a-2 b \cos (x) \cos ((a-b-1) x) a+\cos (x) \cos ((a-b-1) x) a-b^2 \cos (x) \cos ((a-b+1) x) a-2 b \cos (x) \cos ((a-b+1) x) a-\cos (x) \cos ((a-b+1) x) a-b^2 \cos (x) \cos ((a+b-1) x) a-2 b \cos (x) \cos ((a+b-1) x) a-\cos (x) \cos ((a+b-1) x) a+b^2 \cos (x) \cos ((a+b+1) x) a-2 b \cos (x) \cos ((a+b+1) x) a+\cos (x) \cos ((a+b+1) x) a-b^2 \sin (x) \sin ((a-b-1) x) a+2 b \sin (x) \sin ((a-b-1) x) a-\sin (x) \sin ((a-b-1) x) a-b^2 \sin (x) \sin ((a-b+1) x) a-2 b \sin (x) \sin ((a-b+1) x) a-\sin (x) \sin ((a-b+1) x) a+b^2 \sin (x) \sin ((a+b-1) x) a+2 b \sin (x) \sin ((a+b-1) x) a+\sin (x) \sin ((a+b-1) x) a+b^2 \sin (x) \sin ((a+b+1) x) a-2 b \sin (x) \sin ((a+b+1) x) a+\sin (x) \sin ((a+b+1) x) a+b^3 \cos (x) \cos ((a-b-1) x)-b^2 \cos (x) \cos ((a-b-1) x)-b \cos (x) \cos ((a-b-1) x)+\cos (x) \cos ((a-b-1) x)-b^3 \cos (x) \cos ((a-b+1) x)-b^2 \cos (x) \cos ((a-b+1) x)+b \cos (x) \cos ((a-b+1) x)+\cos (x) \cos ((a-b+1) x)+b^3 \cos (x) \cos ((a+b-1) x)+b^2 \cos (x) \cos ((a+b-1) x)-b \cos (x) \cos ((a+b-1) x)-\cos (x) \cos ((a+b-1) x)-b^3 \cos (x) \cos ((a+b+1) x)+b^2 \cos (x) \cos ((a+b+1) x)+b \cos (x) \cos ((a+b+1) x)-\cos (x) \cos ((a+b+1) x)-b^3 \sin (x) \sin ((a-b-1) x)+b^2 \sin (x) \sin ((a-b-1) x)+b \sin (x) \sin ((a-b-1) x)-\sin (x) \sin ((a-b-1) x)-b^3 \sin (x) \sin ((a-b+1) x)-b^2 \sin (x) \sin ((a-b+1) x)+b \sin (x) \sin ((a-b+1) x)+\sin (x) \sin ((a-b+1) x)-b^3 \sin (x) \sin ((a+b-1) x)-b^2 \sin (x) \sin ((a+b-1) x)+b \sin (x) \sin ((a+b-1) x)+\sin (x) \sin ((a+b-1) x)-b^3 \sin (x) \sin ((a+b+1) x)+b^2 \sin (x) \sin ((a+b+1) x)+b \sin (x) \sin ((a+b+1) x)-\sin (x) \sin ((a+b+1) x)}{4 (a-b-1) (a-b+1) (a+b-1) (a+b+1)}\right \}\right \}\] ✓ Maple : cpu = 0.128 (sec), leaf count = 82
\[\left \{y \left (x \right ) = c_{1} \cos \left (x \right )+c_{2} \sin \left (x \right )+\frac {-\left (a +b +1\right ) \left (a +b -1\right ) \cos \left (\left (a -b \right ) x \right )+\left (a -b +1\right ) \left (a -b -1\right ) \cos \left (\left (a +b \right ) x \right )}{2 a^{4}+2 b^{4}+\left (-4 b^{2}-4\right ) a^{2}-4 b^{2}+2}\right \}\]
\begin {equation} y^{\prime \prime }+y=\sin ax\sin bx\tag {1} \end {equation} We start by solving the homogeneous equation \[ y^{\prime \prime }+y=0 \] Let \(y=e^{\lambda x}\), substitution in above gives\begin {align*} \lambda ^{2}e^{\lambda x}+e^{\lambda x} & =0\\ \lambda ^{2}+1 & =0 \end {align*}
Hence \(\lambda =\pm i\), therefore the solution is\begin {align*} y_{h} & =Ae^{ix}+Be^{-ix}\\ & =A\left ( \cos x+i\sin x\right ) +B\left ( \cos x-i\sin x\right ) \\ & =\cos x\left ( A+B\right ) +\sin x\left ( Ai-iB\right ) \\ & =\cos x\left ( A+B\right ) +\sin x\left ( i\left ( A-B\right ) \right ) \end {align*}
Let \(A+B=c_{1},i\left ( A-B\right ) =c_{2}\) hence\begin {align*} y_{h} & =c_{1}\cos x+c_{2}\sin x\\ & =y_{h}=c_{1}y_{1}+c_{2}y_{2} \end {align*}
Now we solve for the particular solution using variation of parameters.
\[ y_{p}=u_{1}y_{1}+u_{2}y_{2}\]
Wonskian is
\[ W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} \cos x & \sin x\\ -\sin x & \cos x \end {vmatrix} =\cos ^{2}x+\sin ^{2}x=1 \]
Hence, using \(f=\sin ax\sin bx\), which is the RHS of the ODE, and noting that \(a_{0}\) is the coefficient of \(y^{\prime \prime }\) which is one here, then
\begin {align*} u_{1} & =\int \frac {-y_{2}}{W}\frac {f}{a_{0}}dx=-\int \sin x\sin \left ( ax\right ) \sin \left ( bx\right ) dx\\ & =-\frac {1}{4}\left ( \frac {\cos \left ( \left ( a-b-1\right ) x\right ) }{a-b-1}-\frac {\cos \left ( \left ( a-b+1\right ) x\right ) }{a-b+1}-\frac {\cos \left ( \left ( a+b-1\right ) x\right ) }{a+b-1}+\frac {\cos \left ( \left ( a+b+1\right ) x\right ) }{a+b+1}\right ) \end {align*}
And
\begin {align*} u_{2} & =\int \frac {y_{1}}{W}\frac {f}{a_{0}}dx=-\int \cos x\sin \left ( ax\right ) \sin \left ( bx\right ) dx\\ & =\frac {1}{4}\left ( \frac {\sin \left ( \left ( a-b-1\right ) x\right ) }{a-b-1}+\frac {\sin \left ( \left ( a-b+1\right ) x\right ) }{a-b+1}-\frac {\sin \left ( \left ( a+b-1\right ) x\right ) }{a+b-1}-\frac {\sin \left ( \left ( a+b+1\right ) x\right ) }{a+b+1}\right ) \end {align*}
Since \(y_{p}=u_{1}\left ( x\right ) \cos x+u_{2}\left ( x\right ) \sin x\) then\begin {align*} y_{p} & =-\frac {1}{4}\left ( \frac {\cos \left ( \left ( a-b-1\right ) x\right ) }{a-b-1}-\frac {\cos \left ( \left ( a-b+1\right ) x\right ) }{a-b+1}-\frac {\cos \left ( \left ( a+b-1\right ) x\right ) }{a+b-1}+\frac {\cos \left ( \left ( a+b+1\right ) x\right ) }{a+b+1}\right ) \cos x\\ & +\frac {1}{4}\left ( \frac {\sin \left ( \left ( a-b-1\right ) x\right ) }{a-b-1}+\frac {\sin \left ( \left ( a-b+1\right ) x\right ) }{a-b+1}-\frac {\sin \left ( \left ( a+b-1\right ) x\right ) }{a+b-1}-\frac {\sin \left ( \left ( a+b+1\right ) x\right ) }{a+b+1}\right ) \sin x\\ & \\ & =\frac {1}{4}\left ( -\frac {\cos ^{2}\left ( \left ( a-b-1\right ) x\right ) }{a-b-1}+\frac {\sin ^{2}\left ( \left ( a-b-1\right ) x\right ) }{a-b-1}\right ) +\frac {1}{4}\left ( \frac {\cos ^{2}\left ( \left ( a-b+1\right ) x\right ) }{a-b+1}+\frac {\sin ^{2}\left ( \left ( a-b+1\right ) x\right ) }{a-b+1}\right ) \\ & +\frac {1}{4}\left ( \frac {\cos ^{2}\left ( \left ( a+b-1\right ) x\right ) }{a+b-1}-\frac {\sin ^{2}\left ( \left ( a+b-1\right ) x\right ) }{a+b-1}\right ) +\frac {1}{4}\left ( -\frac {\cos ^{2}\left ( \left ( a+b+1\right ) x\right ) }{a+b+1}-\frac {\sin ^{2}\left ( \left ( a+b+1\right ) x\right ) }{a+b+1}\right ) \\ & \\ & =\frac {1}{4}\left ( -\frac {\cos ^{2}\left ( \left ( a-b-1\right ) x\right ) }{a-b-1}+\frac {\sin ^{2}\left ( \left ( a-b-1\right ) x\right ) }{a-b-1}\right ) +\frac {1}{4}\left ( \frac {1}{a-b+1}\right ) \\ & +\frac {1}{4}\left ( \frac {\cos ^{2}\left ( \left ( a+b-1\right ) x\right ) }{a+b-1}-\frac {\sin ^{2}\left ( \left ( a+b-1\right ) x\right ) }{a+b-1}\right ) -\frac {1}{4}\left ( \frac {1}{a+b+1}\right ) \end {align*}
Let \(a-b-1=\alpha ,a+b-1=\beta \) then
\begin {align*} y_{p} & =\frac {1}{4}\left ( \frac {\sin ^{2}\left ( \alpha x\right ) -\cos ^{2}\left ( \alpha x\right ) }{\alpha }\right ) +\frac {1}{4}\left ( \frac {\cos ^{2}\left ( \beta x\right ) -\sin ^{2}\left ( \beta x\right ) }{\beta }\right ) +\frac {1}{4}\left ( \frac {1}{\alpha +2}\right ) -\frac {1}{4}\left ( \frac {1}{\beta +2}\right ) \\ & =\frac {1}{4}\left ( \frac {\sin ^{2}\left ( \alpha x\right ) -\cos ^{2}\left ( \alpha x\right ) }{\alpha }+\frac {\cos ^{2}\left ( \beta x\right ) -\sin ^{2}\left ( \beta x\right ) }{\beta }+\frac {1}{\alpha +2}-\frac {1}{\beta +2}\right ) \end {align*}
Therefore, the full solution is \begin {align*} y & =y_{h}+y_{p}\\ & =c_{1}\cos x+c_{2}\sin x+\frac {1}{4}\left ( \frac {\sin ^{2}\left ( \alpha x\right ) -\cos ^{2}\left ( \alpha x\right ) }{\alpha }+\frac {\cos ^{2}\left ( \beta x\right ) -\sin ^{2}\left ( \beta x\right ) }{\beta }+\frac {1}{\alpha +2}-\frac {1}{\beta +2}\right ) \end {align*}
I made mistake. Need to go over it again. I do not see it now. Maple does not verify.
restart; ode:=diff(diff(y(x),x),x)+y(x)-sin(a*x)*sin(b*x)=0; alpha:=a-b-1; beta:=a+b-1; yp:=1/4*(1/alpha* (sin(alpha*x)^2-cos(alpha*x)^2)+1/beta* (cos(beta*x)^2-sin(beta*x)^2))+(1/4)*(1/(alpha+2)-1/(beta+2)); y0:=yp+_C1*sin(x)+_C2*cos(x); not zero