# Simple harmonic oscillator position function

We know from Hooke's law $$F=-kx$$ and $$md^2x/dt^2 = -kx$$ therefore $$x''+w^2x=0$$ we must get $$x(t) =A\cos(wt)$$ but I don't know how

I know how to derive the position function from graph, but i don't know how to solve it as linear differential equation. May someone do that?

• You're asking us to help you in solving the second order liner ODE, right$?$ Feb 27 at 12:24
• yes the 3rd equation
– mark
Feb 27 at 12:25
• I can help but you see that the variables $A$ is an abbreviation for a longer expression Feb 27 at 12:26
• I'll just solve the eqn...and as for an exercise you must yourself do the changing of variables....making it of the given form Feb 27 at 12:30
• A represents the radius of oscillator, thanks
– mark
Feb 27 at 12:31

Let's start from the equation of motion $$$$\tag{1} m\frac{d^2x}{dt^2} = -kx$$$$ and introduce the constant $$$$\tag{2} \omega^2 = \frac{k}{m}$$$$ so that equation (1) becomes $$$$\tag{3} \frac{d^2x}{dt^2} = -\omega^2 x.$$$$ This is a second order linear differential equation with constant coefficients and one way to solve it is by letting $$x = e^{\lambda t}$$ where $$\lambda$$ is another constant. Substituting this form in (3) we get $$$$\tag{4} (\lambda^2 + \omega^2)e^{\lambda t} = 0.$$$$ Since $$e^{\lambda t} \ne 0$$, we have $$\lambda = \pm i\omega$$ and the general solution of (3) is $$$$\tag{5} x(t) = A_1 e^{i\omega t} + A_2e^{-i\omega t},$$$$ where $$A_1$$ and $$A_2$$ are constant of integration to be determined from the initial conditions. If, for example, $$x(0) = A$$ and $$\dot{x}(0) = 0$$ then we have $$\begin{eqnarray} A &=& A_1 + A_2 \\ 0 &=& i\omega(A_1 - A_2). \end{eqnarray}$$ The solution of these equations is $$A_1 = A/2, A_2 = A/2$$. Therefore, for this choice of initial conditions, equation (5) becomes, $$$$\tag{6} x(t) = \frac{A}{2}\left(e^{i\omega t} + e^{-i\omega t}\right) = A\cos(\omega t).$$$$ The number $$A$$ is called the amplitude of the oscillator.
• Complex and binomial formula: $$0=(D^2+w^2)x=(D+iw)(D-iw)x=0$$ leads to recognize basis solutions $$x=e^{\pm iwt}$$. Linear combinations that are real functions are $$\cos(wt)$$ and $$\sin(wt)$$ and with phase $$A\cos(wt+\phi)$$.
• Finding a first integral, multiply with $$2x'$$ and integrate to $$2x'x''+2w^2xx'=0\implies x'^2+w^2x^2=R^2$$ Recognize this as circle equation and parametrize $$x'=R\cos(u(t))$$, $$wx=R\sin(u(t))$$, explore the consequences to find $$u'=w$$.
• Find/guess an integrating factor (there is such a thing also for second order linear DE) $$0=\cos(wt)x''+\cos(wt)w^2x=[\cos(wt)x''-w\sin(wt)x']+w[\sin(wt)x'+w\cos(wt)x] \\ \implies C=\cos(wt)x'+w\sin(wt)x$$ and continue solving as first-order linear DE with integrating factor $$1/\cos^2(wt)$$.
First, $$Acos(\omega t)$$ is not the general solution this would be $$x(t)=Acos(\omega t)+Bsin(\omega t)$$ the only thing you have to know if you are not familiar with komplex functions is that $$(Acos(b t))''=-A*b^2cos(bt) and (Bsin(b t))''=-Bb^2sin(b t)$$ so you have not really to "solve" it but just look for a known function with f''=-f. just f you want to solve x^2=4 you remember that $$4=2^2 and (-2)^2$$