ODE
\[ y''(x)+3 y'(x)+2 y(x)=\cos (a x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.0239404 (sec), leaf count = 54
\[\left \{\left \{y(x)\to \frac {3 a \sin (a x)-\left (a^2-2\right ) \cos (a x)}{a^4+5 a^2+4}+c_1 e^{-2 x}+c_2 e^{-x}\right \}\right \}\]
Maple ✓
cpu = 0.085 (sec), leaf count = 81
\[ \left \{ y \left ( x \right ) ={\frac { \left ( -{\it \_C1}\,{a}^{4}-5\,{\it \_C1}\,{a}^{2}-4\,{\it \_C1} \right ) {{\rm e}^{-2\,x}}+ \left ( {a}^{4}{\it \_C2}+5\,{a}^{2}{\it \_C2}+4\,{\it \_C2} \right ) {{\rm e}^{-x}}-\cos \left ( ax \right ) {a}^{2}+3\,a\sin \left ( ax \right ) +2\,\cos \left ( ax \right ) }{{a}^{4}+5\,{a}^{2}+4}} \right \} \] Mathematica raw input
DSolve[2*y[x] + 3*y'[x] + y''[x] == Cos[a*x],y[x],x]
Mathematica raw output
{{y[x] -> C[1]/E^(2*x) + C[2]/E^x + (-((-2 + a^2)*Cos[a*x]) + 3*a*Sin[a*x])/(4 +
5*a^2 + a^4)}}
Maple raw input
dsolve(diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = cos(a*x), y(x),'implicit')
Maple raw output
y(x) = ((-_C1*a^4-5*_C1*a^2-4*_C1)*exp(-2*x)+(_C2*a^4+5*_C2*a^2+4*_C2)*exp(-x)-c
os(a*x)*a^2+3*a*sin(a*x)+2*cos(a*x))/(a^4+5*a^2+4)