# I don't understand how I got the solution for this ODE wrong

I'm currently studying ODE's using the textbook Advanced Engineering Mathematics 10e (Kreyszig, 2019) and had a question regarding solving ODE's. In case anyone's wondering, this is exercise problem 6 on page 8.

Solve the ODE by integration or by remembering a differentiation formula.

$$y^{''} = -y$$

The solution that I got is $$y = \sin(x) + C$$, since to me it seemed obvious that if you differentiate $$y = \sin(x)$$ twice you get $$-\sin{x}$$, or $$-y$$. However, the solution that I've found here states that the solution is actually:

$$y = C_1\sin(x) + C_2\cos(x)$$

Perhaps this is due to the fact that my calculus background is relatively weak, but I'm having trouble understanding how I managed to get a solution that's drastically different from the correct one.

Would anybody be kind enough to help me understand this process? Thank you.

• You need to find all solutions. It is also obvious that $y=\cos x$ is a solution as well, and it is not included in your solution. – A.Γ. Oct 12 '19 at 7:19
• Note that not only is your solution incomplete (missing the cosine part), it's also incorrect if $C \neq 0$, since $y'' = -\sin x \neq -(\sin x + C) = -y$. – Hans Lundmark Oct 12 '19 at 8:57

The equation is linear, so with $$\sin x$$ a solution, also $$C\sin x$$ is a solution.
The equation is autonomous, thus invariant under time shifts. So also $$C\sin(x+D)$$ is a solution. This is especially true for $$D=\frac\pi2$$, so that also $$C\cos x$$ are solutions
By linearity, also $$C_1\cos x+C_2\sin x$$ are solutions. Note that these can also be expressed as the previous form $$C\sin(x+D)$$.
This can be solved by looking at the characteristic equation, which yields: $$y''=-y \implies r^2+1=0 \implies r=\pm i \implies y(t) = c_1\cos(t)+c_2\sin(t)$$