2.1002   ODE No. 1002

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


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


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

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 \]