Proving the double differential of z = -z implies z= sinx In common usage, we know that $$\frac{d^2z}{dx^2}=-z\,$$ implies $z$ is of the form $a\sin x + b\cos x$. Is there a proof for the same. I was trying to arrive at the desired function but couldn't understand how to get these trigonometric functions in the equations by integration. Does it require the use of taylor polynomial expansion of $\sin x\, \text {or}\, \cos x$?
 A: We assume the solution is of the form 
$$z=\sum_{n=0}^{\infty}a_nx^n=a_0+a_1x+a_2x^2+\cdots+a_nx^n+\cdots$$
then
$$
z''
=\sum_{n=2}^{\infty}n(n-1)a_nx^{n-2} 
=1\cdot2a_2+2\cdot3a_3x+3\cdot4a_4x^2+\cdots
$$
from $z''=-z$ then with arbitrary $a_0$ and $a_1$ we have
\begin{eqnarray*}
&&
 a_2=-\frac{1}{1\times2}a_0 ~~~,~~~ 
 a_4=-\frac{1}{3\times4}a_2=\dfrac{1}{4!}a_0   ~~,~~~ 
 a_6=-\frac{1}{5\times6}a_4=-\dfrac{1}{6!}a_0  ~~,~~~ \cdots\\
&&
 a_3=-\frac{1}{2\times3}a_1 ~~~,~~~ 
 a_5=-\frac{1}{4\times5}a_3=\dfrac{1}{5!}a_1   ~~,~~~ 
 a_7=-\frac{1}{6\times7}a_5=-\dfrac{1}{7!}a_0  ~~,~~~ \cdots
\end{eqnarray*}
then
$$z=a_0\left(1-\dfrac{x^2}{2!}+\dfrac{x^4}{4!}-\cdots\right) + a_1\left(x-\dfrac{x^3}{3!}+\dfrac{x^5}{5!}-\cdots\right)=\color{blue}{a_0\cos x+a_1\sin x}$$
A: $$d^2z/dx^2=k^2z$$
$$z=A\exp(kx)+B\exp(-kx)$$
Now $k^2=-1$ so substitute $k=i$ and get your form
A: To show that $A\cos x +B\sin x$ are the ONLY solutions: For any $P,Q\in \Bbb R$ there exist $A, B \in \Bbb R$ such that $A\cos x +B \sin x$ is a solution to $(f''=-f\land f(0)=P\land f'(0)=Q).$  
If $z(x)$ is any solution to $(z''=-z\land z(0)=P\land z'(0)=Q)$ then $y(x)=z(x)-(A\cos x+B\sin x)$ satisfies $(y''=-y\land y(0)=y'(0)=0).$ 
We show this implies $\forall x\; (y(x)=0)$ as follows: 
Suppose by contradiction that $y(x_1)\ne 0$ for some $x_1>0$.  (The case $y(x_1)\ne 0$ for some $x_1<0$ is handled similarly.) 
Then $x_0=\max \{x\geq 0: \forall x'\in [0,x]\;(y(x')=0)\}$ exists. We have $y(x_0)=0 .$ And we have $0\leq x_0<x_1.$
If $x_0=0$ then $0=y(0)=y'(x_0).$ If $x_0>0$ then $y$ is constantly $0$ on $[0,x_0]$ so $y'(x_0)=0.$ So  $y'(x_0)=0$ regardless of whether $x_0=0$ or $x_0>0.$ 
For any $r>0$  there exists $s_r\in (0,r)$ such that $$y(x_0+r)=y(x_0)+ry'(x_0)+r^2y''(x_0+s_r)/2=r^2y''(x_0+s_r)/2=r^2y(x_0+s_r)/2.$$ However  we  can take $r_1$ such that $0<r_1<\min (1,x_1-x_0)$ and we can take $r_2\in [0,r_1]$  such that $$|y(x_0+r_2)| =\max \{|y(x)|: x\in [x_0,x_0+r_1]\}.$$ We have $|y(x_0+r_2)|>0$ (by the def'n of $ x_0$ and because $x_0+r_1>x_0$.) So $$0<|y(x_0+r_2)|=|(r_2)^2y(x_0+s_{r_2})/2|
\leq $$ $$\leq  |(r_2)^2y(x+r_2)/2|\leq |y(x_0+r_2)|/2$$ which implies $0<|y(x_0+r_2)|\leq |y(x_0+r_2)|/2,$ which is  absurd. 
