Solution to $\frac{d^2x}{dt^2}+\frac{kx}{m}=0$ This is the system of differential equations which describes simple harmonic motion:
$$\frac{d^2x}{dt^2}+\frac{kx}{m}=0$$
$$x(0)=A$$
$$\frac{dx}{dt}\bigg|_{t=0}=0$$
By guessing that $x$ is of the form $A\cos\left(\omega t+\phi\right)$, I can arrive at the solution following solution: $$x=A\cos\left(\sqrt{\frac{k}{m}}\text{ }t\right)$$
My question is, how can you derive this solution without assuming that $x$ is a sinusoidal function? I have not yet taken a formal calculus course, so a simple solution would be appreciated. 
 A: As noted in the problem statement, the ODE $m\ddot{x}+k x=0$ describes simple harmonic motion. More precisely, it's the equation of motion of such a system (i.e. Newton's second law).
What's more crucial for the present purpose, however, is not Newton's laws but rather energy conservation. To reveal this, suppose we multiply both sides of the equation of motion by $\dot{x}$ to get 
$$0=m\dot{x}\ddot{x}+k x\dot{x}=mv\frac{dv}{dt}+kx\frac{dx}{dt}=\frac{d}{dt}\left(\frac12 m v^2+\frac12 k x^2\right)$$
from which we conclude that the energy $E=\frac12 mv^2+\frac12 k x^2$ is conserved. For the initial conditions in the problem, we specifically have
$$\frac12 m\left(\frac{dx}{dt}\right)^2+\frac12 k x^2=\frac12 k A^2.$$
Why is energy conservation useful? Because this ODE is separable:
$$t=\int_{A}^{x(t)}\frac{dx}{dx/dt}=-\sqrt{\frac{m}{k}} \int_{A}^{x(t)}\frac{dx}{\sqrt{A^2-x^2}}.$$
(The minus sign is because, if the object starts from rest with $x(0)=A>0$, it will begin moving with a negative velocity. Other such sign issues can be clarified if one is careful.) Either by trig substitution or by using a table of integrals, one obtains
$$t=\sqrt{\frac m k}\cos^{-1} \frac{x(t)}{A}\implies x(t)=A\cos(t\sqrt{k/m}).$$ So it is indeed a sinusoidal motion.
A: You might be surprised that one of the most general ways to solve differential equations is to guess the solution. Differential equations are different from algebraic equations in that respect. I will show you a method here that involves another form of guessing, but it is slightly more general.
You may not have taken a formal calculus course, but you may know Euler's identity
$$
\tag{$*$}e^{ix} = \cos x + i\sin x,
$$
which relates the exponential $e$ to $\sin$ and $\cos$. Then what you can do is a little more general than guessing the solution is of the form $A\cos (\omega t + \phi)$. You can guess the solution is of the form $x(t) = e^{\lambda t},$ and not give a care about what $\lambda$ is, but find out. Put $k/m := \omega^2$.
$$
\frac{d^2x}{dt^2}+\omega^2 x=0 \\
\lambda^2e^{\lambda t} + \omega^2e^{\lambda t} = 0
$$
and since $e^{\lambda t} \ne 0$, we can divide by $e^{\lambda t}$ on each side of our equation:
$$
\lambda^2 + \omega^2 = 0 \\
\lambda^2 = -\omega^2 \\
\lambda = \pm i\omega.
$$
Note that we don't give a care what $\lambda$ is beforehand. We just assume the solution can be some $\lambda$, and intrepidly proceed until we can go no further.
We find out that one solution of our equation is $x_1(t) = e^{i\omega t}$ as you can check by differentiating:
$$
\frac{d^2x_1}{dt^2}+\omega^2 x_1=0 \\
(i\omega)^2e^{i\omega t} + \omega^2e^{i\omega t} = 0 \\
-\omega^2e^{i\omega t} + \omega^2e^{i\omega t} = 0 \\
(-\omega^2 + \omega^2)e^{i\omega t} = 0 \\
0e^{i\omega t} = 0\, \checkmark.
$$
And other solution is $x_2(t) = e^{-i\omega t}$ as you can check by differentiating:
$$
\frac{d^2x_2}{dt^2}+\omega^2 x_2=0 \\
(-i\omega)^2e^{-i\omega t} + \omega^2e^{-i\omega t} = 0 \\
-\omega^2e^{-i\omega t} + \omega^2e^{-i\omega t} = 0 \\
(-\omega^2 + \omega^2)e^{-i\omega t} = 0 \\
0e^{-i\omega t} = 0\, \checkmark.
$$
The most general solution to the problem is then some sum of these two solutions
$$
x(t) = Ce^{i\omega t} + De^{-i\omega t}.
$$
Using our initial conditions that $x(0) = A$ and $x'(0) = 0$, we have
$$
x(0) = Ce^0 + De^0 = A \\
\therefore C + D = A \\
x'(0) = i\omega Ce^0 - i\omega De^0 = 0 \\
\therefore C = D = A/2 \\
x(t) = \tfrac{A}{2}(\cos \omega t + i\sin\omega t) + \tfrac{A}{2}(\cos\omega t - i\sin\omega t) \\
x(t) = A\cos\omega t.
$$
Hence, our particular solution is $x(t) = A\cos\omega t$. If our solution turned out to involve the imaginary number $i$, we know that whenever we measure the position of the mass on the spring, we should get a real number. However, $e^{i\omega t}$ is a complex number and it has an imaginary part. Our solution should be real, so we take what's known as the real part of our solution, which is the $\cos$ part of $(*)$.
Unfortunately, methods for solving differential equations are generally different than solving algebraic equations, until you learn plenty more calculus. This method is a little more general than guessing $\cos$ or $\sin$ because we don't assume it has to be one or the other. We assume it is some combination of them both, and that we can find out by solving for $\lambda$.
A: Solution(Partial): $$\frac{d^2x}{dt^2}=-\frac{kx}{m}$$ $$\implies 2\frac{dx}{dt}\frac{d^2x}{dt^2}=-2\frac{dx}{dt}\frac{kx}{m}$$ 
On integrating both sides: 
$$\implies (\frac{dx}{dt})^2=-\frac{2kx^2}{m}+C$$ Using the initial conditions we get: $$C=\frac{2kA^2}{m}$$
$$\implies \frac{dx}{dt}=\sqrt\frac{2k}{m}\sqrt{(A^2-x^2)}$$ I think you can take it from here.
