TITLE: Show that $f$ is the zero function if$f''(x)+f(x)=0$ and $f(0)=f'(0)=0$
QUESTION [5 upvotes]: Suppose that $f''(x)+f(x)=0$ for all x, and $f(0)=f'(0)=0$. 
Note: we know $f^{(n)}$ (i.e. nth derivative of $f$) is continuous for all n. 
Note: $f$ can be complex. 
Note: I want to use this to prove Euler's formula $e^{ix}=\cos x+i\sin x$.
I started with $P=\frac{df}{dx}$, then $f''(x)=P\frac{dP}{df}$. Get $P\frac{dP}{df}+f=0$ and integrate at both sides, so that $P^2+f^2=0$. And we can get $P=\pm i f \Rightarrow \frac{df}{dx}=\pm if \Rightarrow \frac{1}{f}df=\pm i dx \Rightarrow \ln f=\pm ix+C$, and I stuck here.
Is the steps above are right or there's another way of prove?

REPLY [2 votes]: $$f''+f=0$$
$$\color {red}{2f'}f''+\color{red}{2f'}f=0$$
$$(f'^2)'+(f^2)'=0$$
After integration:
$$f'^2+f^2=C$$
$$C=f'^2(0)+f^2(0)=0$$
$$f'^2+f^2=0$$
$$(f'+if)(f'-if)=0$$
Then we have :
$$f'\pm if=0$$
$$(fe^{\pm ix})'=0$$
Integrate:
$$f(x)=Ce^{\pm ix}$$
Since $f(0)=0  \implies C=0$:
$$\implies f(x)=0 \;\;\forall \; x$$