1.1 problem 1

Internal problem ID [6108]

Book: Elementary differential equations. Rainville, Bedient, Bedient. Prentice Hall. NJ. 8th edition. 1997.
Section: CHAPTER 8. Nonhomogeneous Equations: Undetermined Coefficients. Exercises Page 142
Problem number: 1.
ODE order: 2.
ODE degree: 1.

CAS Maple gives this as type [[_2nd_order, _linear, _nonhomogeneous]]

Solve \begin {gather*} \boxed {y^{\prime \prime }+y+\cos \relax (x )=0} \end {gather*}

Solution by Maple

Time used: 0.001 (sec). Leaf size: 18

dsolve(diff(y(x),x$2)+y(x)=-cos(x),y(x), singsol=all)
 

\[ y \relax (x ) = c_{2} \sin \relax (x )+\cos \relax (x ) c_{1}-\frac {\sin \relax (x ) x}{2} \]

Solution by Mathematica

Time used: 0.051 (sec). Leaf size: 27

DSolve[y''[x]+y[x]==-Cos[x],y[x],x,IncludeSingularSolutions -> True]
 

\begin{align*} y(x)\to \left (-\frac {1}{2}+c_1\right ) \cos (x)-\frac {1}{2} (x-2 c_2) \sin (x) \\ \end{align*}