ODE
\[ -\left (a^2+1\right ) y(x)+y''(x)-2 \tan (x) y'(x)=\sin (x) \] ODE Classification
[[_2nd_order, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.182743 (sec), leaf count = 62
\[\left \{\left \{y(x)\to \frac {1}{2} \sec (x) \left (2 c_1 e^{-\sqrt {a^2} x}+\frac {c_2 e^{\sqrt {a^2} x}}{\sqrt {a^2}}-\frac {\sin (2 x)}{a^2+4}\right )\right \}\right \}\]
Maple ✓
cpu = 0.253 (sec), leaf count = 148
\[ \left \{ y \left ( x \right ) ={\frac {- \left ( \cosh \left ( ax \right ) -\sinh \left ( ax \right ) \right ) {{\rm e}^{-ax}} \left ( ia-2 \right ) {{\rm e}^{-2\,x \left ( i-a \right ) }}+ \left ( ia+2 \right ) \left ( \cosh \left ( ax \right ) -\sinh \left ( ax \right ) \right ) {{\rm e}^{-ax}}{{\rm e}^{2\,x \left ( i+a \right ) }}- \left ( \sinh \left ( ax \right ) +\cosh \left ( ax \right ) \right ) \left ( \left ( ia+2 \right ) {{\rm e}^{-2\,ix}}+ \left ( -ia+2 \right ) {{\rm e}^{2\,ix}} \right ) {{\rm e}^{-ax}}+8\,a \left ( {a}^{2}+4 \right ) \left ( \cosh \left ( ax \right ) {\it \_C1}+{\it \_C2}\,\sinh \left ( ax \right ) \right ) }{8\,\cos \left ( x \right ) a \left ( {a}^{2}+4 \right ) }} \right \} \] Mathematica raw input
DSolve[-((1 + a^2)*y[x]) - 2*Tan[x]*y'[x] + y''[x] == Sin[x],y[x],x]
Mathematica raw output
{{y[x] -> (Sec[x]*((2*C[1])/E^(Sqrt[a^2]*x) + (E^(Sqrt[a^2]*x)*C[2])/Sqrt[a^2] -
Sin[2*x]/(4 + a^2)))/2}}
Maple raw input
dsolve(diff(diff(y(x),x),x)-2*diff(y(x),x)*tan(x)-(a^2+1)*y(x) = sin(x), y(x),'implicit')
Maple raw output
y(x) = 1/8*(-(cosh(a*x)-sinh(a*x))*exp(-a*x)*(I*a-2)*exp(-2*x*(I-a))+(I*a+2)*(co
sh(a*x)-sinh(a*x))*exp(-a*x)*exp(2*x*(I+a))-(sinh(a*x)+cosh(a*x))*((I*a+2)*exp(-
2*I*x)+(-I*a+2)*exp(2*I*x))*exp(-a*x)+8*a*(a^2+4)*(cosh(a*x)*_C1+_C2*sinh(a*x)))
/cos(x)/a/(a^2+4)