Justifying an ODE's solution In an introductory lesson into ODEs, in order to "semi-rigorously" justify the solution for e.g. : $(a)\ \ y'+y=0$ we proceed without an ansatz or guess solution (hence the "semi-rigour"):
Let: $\phi=ye^{x}$  Then by differentiating: $\phi'=y'e^{x}+ye^{x}=e^{x}(y'+y)=0$; thus: $\phi=C=\phi(0)=y_0$, therefore the final result: $y=y_0 e^{-x}$ with no direct ansatz
I tried to do the same for this ODE: $(b) \ y''+y=0$
This time with $\psi=f^{2}+f'^{2}$. So as to yield either sine or cosine for f, and WLOG end up with one of them.
I get $\psi'=2ff'+2f'f''=2f'(f+f'')$
$\Rightarrow \psi'=0 \Rightarrow \psi=C=\psi(0)$
$\rightarrow \psi(0)=f^{2} +f'^{2}$. Then I normalize f with $g(x)=f(x)/\sqrt\psi(0))$
To be formal, I tried proving that $\psi(0) \neq0$ :
$\psi(0)=0 \Rightarrow f^{2}(0)+f'^{2}(0)=0 \Rightarrow f(0)=f'(0)=0 \ \text{combined with} \ f''+f=0 \rightarrow \forall k: f^{(k)}=0 \rightarrow \text{This yields a trivial solution: the zero function which I implicitely eliminated} $ QED: $\psi(0)\neq 0$
Back to the problem: I get: $g^{2}+g'^{2}=1$, so there must: $\exists \theta:f(x)=\sqrt\psi(0)cos\theta $ This is where I couldn't justify: is the x in $g(x)$ the same as the $\theta$ in $\sin(\theta)$?
 A: I think the ansatz should read $g(x)=ψ(0)\cosθ(x)$. But what is $ψ(0)$ doing there? 
From the sum of squares you get that the point $(g(x),g'(x))$ is somewhere on the unit circle and thus at some specific angle $θ$ that depends on $x$. Which means that $g(x)=\cosθ$ and $g'(x)=\sinθ$. Assuming that the dependence $θ=θ(x)$ is differentiable, the derivative of the first equation gives $g'(x)=-\sin(θ(x))θ'(x)$ and comparing with the second equation, $θ'(x)=-1$.
A: If you are allowed to use complex numbers, do the following:
$$
f''+f=0\quad\Longrightarrow\quad f''+if'=i(f'+if),
$$ 
hence letting $g=f'+if$ we have that
$$
g'=ig\quad\Longrightarrow\quad\mathrm{e}^{-ix}(g'-ig)=0\quad\Longrightarrow\quad
\big(\mathrm{e}^{-ix}g\big)'=0\quad\Longrightarrow\quad g=c\,\mathrm{e}^{ix}.
$$
Thus
$$
f'+if=c\,\mathrm{e}^{ix}\quad\Longrightarrow\quad \mathrm{e}^{ix}(f'+if)=c\,\mathrm{e}^{2ix}
\quad\Longrightarrow\quad \big(\mathrm{e}^{ix}f\big)=c\,\mathrm{e}^{2ix},
$$
and finally
$$
f=c\mathrm{e}^{ix}+c'\mathrm{e}^{-ix}=a\cos x+b\sin x.
$$
