Prove that if $f''(x)+25f(x)=0$ then $f(x)=Acos(5x)+Bsin(5x)$ for some constants $A,B$ Suppose $f: \mathbb{R} \rightarrow \mathbb{R}$ is twice differentiable.
Prove that if $f''(x)+25f(x)=0$ then $f(x)=Acos(5x)+Bsin(5x)$ for some constants $A,B$

Consider $g(x):= f(x)-Acos(5x)-Bsin(5x)$ where $A$ and $B$ are chosen so that $g(0)=g'(0)=0$ [this portion is given, so can someone explain why it is important?]
For reference, we note that
$g(x):= f(x)-Acos(5x)-Bsin(5x)$
$g'(x):= f'(x)+5Asin(5x)-5Bcos(5x)$
$g''(x):= f''(x)+25Acos(5x)+25Bsin(5x)$
Consider the derivative of $\frac{25}{2}g(x)^2+\frac{1}{2}g'(x)^2$
$25g(x)g'(x)+g''(x)g'(x)$ if and only if $g'(x)[25g(x)+g''(x)]$
Following substitution, we conclude that 
$g'(x)[25g(x)+g''(x)]=g'(x)(0)=0$
Therefore, by the Constancy Theorem, $\frac{25}{2}g(x)^2+\frac{1}{2}g'(x)^2=C_0$, where $C_0$ is a constant
$25g(x)^2+g'(x)^2=C$, where $C$ is a constant
Thus, 
$25(f(x)-Acos(5x)-Bsin(5x))^2 + (f'(x)+5Asin(5x)-5Bcos(5x))^2=C$

Where do I go from here?
 A: By steps: $g(0)=g'(0)=0$ is important because you have a homogenous differential equation, therefore zero initial data implies that the solution is zero everywhere.
After obtaining that $25(f(x)-A\cos(5x)-B\sin(5x))^2 + (f'(x)+5A\sin(5x)-5B\cos(5x))^2=C$, use initial data $g(0)=g'(0)=0$.
We chose $A$ and $B$ to get $f(x)-A\cos(5x)-B\sin(5x)=0$  and $f'(x)+5A\sin(5x)-5B\cos(5x)=0$ at $x=0$. Therefore we can find $C$ by putting $x=0$:
$$25(f(x)-A\cos(5x)-B\sin(5x))^2 + (f'(x)+5A\sin(5x)-5B\cos(5x))^2=C = 25(f(0)-A\cos(0)-B\sin(0))^2 + (f'(0)+5A\sin(0)-5B\cos(0))^2=0.$$
Hence  $$\forall x\quad 25(f(x)-A\cos(5x)-B\sin(5x))^2 + (f'(x)+5A\sin(5x)-5B\cos(5x))^2 =0.$$
You have the sum of squares equal to zero, therefore each term is zero itself. We can conclude that $\forall x\, (f(x)-A\cos(5x)-B\sin(5x))^2=0$ and, therefore,
$$\forall x\quad  f(x)=A\cos(5x)+B\sin(5x).$$
We conclude that all solutions of the initial differential equation has the above form.
A: In your expression involving $\frac {25}2g^2+\frac 12 g'^2=C$ you can set $x=0$ to determine the constant (this is where the bit you have been given is important). Then you have the sum of two squares equal to [?].

Note: you get the first part - the values of $A$ and $B$ from the values of $f(0)$ and $f'(0)$ if these are given, because $f(0)=g(0)+A$ so you want $A=f(0)$ and $f'(0)=g'(0)+5B$ so that $B=\frac 15 f'(0)$. Hence you can always find $A$ and $B$ which work.
If the initial conditions are given by the values of $f(x)$ at two distinct values of $x$ you get $A$ and $B$ by solving a couple of simultaneous equations.
Once you have filled in the details, this gives a proof that all the solutions of the original equation are of the requisite form, and justifies using that form to find solutions without replicating the proof every time.
A: Since this is a differential equation with a right side equal to zero, we say that it is homogeneous. Thus, we solve the auxiliary equation associated with the equation:  f′′(x) + 25 f(x) = 0  ------>   r^2 + 25 = 0
This yields:   
r = +/- 5i 
Solution will be of the form: f = Ae^(5i) + be^(-5i)
Which using Euler's method yields:
f = ACos(5t) + BSin(5t).
Differentiating f twice and plugging into the original diff. eq. should yield zero.
Is this what you wanted?
A: I don't remenber the general formula, you can find in some book of ODE. You have this y= f(x)=> y'' + 25y=0. We make the substitution $y=\exp{rx}$. Then $r^2e^{rx}+25e^{}rx=0$ and $e^{rx}(r^2+25)=0$. We find the roots of polinomial $r^2+25$ there are $r=5i$ and $r=-5i$ for the properties of the solutions of the ode we can say $y = (e^{5xi}+e^-{-5xi})/2=cos(5x)$ is a solution or $y = (e^{5xi}+e^-{-5xi})/2=i sin(5x)$
A: Is it easier just to substitute?
$$f(x)=Acos(5x)+Bsin(5x)$$
then
$$\dot f(x)=-5Asin(5x)+5Bcos(5x)$$
$$\ddot f(x)=-25Acos(5x)-25Bsin(5x)$$
finally:
$$-25Acos(5x)-25Bsin(5x)+25( Acos(5x)+Bsin(5x)) =0 $$
?
