4.25.50 $$y''(x)+3 y'(x)+2 y(x)=\cos (a x)$$

ODE
$y''(x)+3 y'(x)+2 y(x)=\cos (a x)$ ODE Classiﬁcation

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 0.218637 (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.74 (sec), leaf count = 93

$\left [y \left (x \right ) = -\frac {-{\mathrm e}^{-x} \textit {\_C2} \,a^{4}+{\mathrm e}^{-2 x} \textit {\_C1} \,a^{4}-5 \,{\mathrm e}^{-x} \textit {\_C2} \,a^{2}+5 \,{\mathrm e}^{-2 x} \textit {\_C1} \,a^{2}+\cos \left (a x \right ) a^{2}-3 a \sin \left (a x \right )-4 \,{\mathrm e}^{-x} \textit {\_C2} +4 \,{\mathrm e}^{-2 x} \textit {\_C1} -2 \cos \left (a x \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))

Maple raw output

[y(x) = -(-exp(-x)*_C2*a^4+exp(-2*x)*_C1*a^4-5*exp(-x)*_C2*a^2+5*exp(-2*x)*_C1*a
^2+cos(a*x)*a^2-3*a*sin(a*x)-4*exp(-x)*_C2+4*exp(-2*x)*_C1-2*cos(a*x))/(a^4+5*a^
2+4)]