ODE No. 1002

\[ y''(x)+y(x)=0 \] Mathematica : cpu = 0.0037368 (sec), leaf count = 16

DSolve[y[x] + Derivative[2][y][x] == 0,y[x],x]
 

\[\{\{y(x)\to c_1 \cos (x)+c_2 \sin (x)\}\}\] Maple : cpu = 0.007 (sec), leaf count = 13

dsolve(diff(diff(y(x),x),x)+y(x)=0,y(x))
 

\[y \left (x \right ) = \sin \left (x \right ) c_{1}+c_{2} \cos \left (x \right )\]

Hand solution

\[ y^{\prime \prime }+y=0 \]

Let \(y=e^{\lambda x}\), substitution in above gives

\begin {align*} \lambda ^{2}e^{\lambda x}+e^{\lambda x} & =0\\ \lambda ^{2}+1 & =0 \end {align*}

Hence \(\lambda =\pm i\), therefore the solution is

\begin {align*} y & =Ae^{ix}+Be^{-ix}\\ & =A\left ( \cos x+i\sin x\right ) +B\left ( \cos x-i\sin x\right ) \\ & =\cos x\left ( A+B\right ) +\sin x\left ( Ai-iB\right ) \\ & =\cos x\left ( A+B\right ) +\sin x\left ( i\left ( A-B\right ) \right ) \end {align*}

Let \(A+B=c_{1},i\left ( A-B\right ) =c_{2}\) hence

\[ y=c_{1}\cos x+c_{2}\sin x \]