ODE
\[ y''(x)+y(x)=\sin (a x) \sin (b x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.485967 (sec), leaf count = 159
\[\left \{\left \{y(x)\to \frac {a^4 c_2 \sin (x)-2 a^2 b^2 c_2 \sin (x)-a^2 \sin (a x) \sin (b x)-2 a^2 c_2 \sin (x)+c_1 \left (a^4-2 a^2 \left (b^2+1\right )+\left (b^2-1\right )^2\right ) \cos (x)-b^2 \sin (a x) \sin (b x)+\sin (a x) \sin (b x)-2 a b \cos (a x) \cos (b x)+b^4 c_2 \sin (x)-2 b^2 c_2 \sin (x)+c_2 \sin (x)}{(a-b-1) (a-b+1) (a+b-1) (a+b+1)}\right \}\right \}\]
Maple ✓
cpu = 0.121 (sec), leaf count = 82
\[ \left \{ y \left ( x \right ) =\sin \left ( x \right ) {\it \_C2}+\cos \left ( x \right ) {\it \_C1}+{\frac {- \left ( 1+a+b \right ) \left ( a+b-1 \right ) \cos \left ( x \left ( a-b \right ) \right ) +\cos \left ( x \left ( a+b \right ) \right ) \left ( a-b+1 \right ) \left ( a-b-1 \right ) }{2\,{a}^{4}+ \left ( -4\,{b}^{2}-4 \right ) {a}^{2}+2\,{b}^{4}-4\,{b}^{2}+2}} \right \} \] Mathematica raw input
DSolve[y[x] + y''[x] == Sin[a*x]*Sin[b*x],y[x],x]
Mathematica raw output
{{y[x] -> ((a^4 + (-1 + b^2)^2 - 2*a^2*(1 + b^2))*C[1]*Cos[x] - 2*a*b*Cos[a*x]*C
os[b*x] + C[2]*Sin[x] - 2*a^2*C[2]*Sin[x] + a^4*C[2]*Sin[x] - 2*b^2*C[2]*Sin[x]
- 2*a^2*b^2*C[2]*Sin[x] + b^4*C[2]*Sin[x] + Sin[a*x]*Sin[b*x] - a^2*Sin[a*x]*Sin
[b*x] - b^2*Sin[a*x]*Sin[b*x])/((-1 + a - b)*(1 + a - b)*(-1 + a + b)*(1 + a + b
))}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+y(x) = sin(a*x)*sin(b*x), y(x),'implicit')
Maple raw output
y(x) = sin(x)*_C2+cos(x)*_C1+(-(1+a+b)*(a+b-1)*cos(x*(a-b))+cos(x*(a+b))*(a-b+1)
*(a-b-1))/(2*a^4+(-4*b^2-4)*a^2+2*b^4-4*b^2+2)