In physics for a Simple Harmonic Oscillator, we have the differential equation $$ {\frac {d^2x}{dt^2}} + \frac kmx = 0 $$ from the balance of forces, which has a solution $$ x(t) = {x_o}\cos(\omega t+\phi), for\ \omega = \sqrt\frac km $$

My question is how do you get from the differential equation to the solution if you are not sure where to start.

I know how to find solutions to many first order differential equations, but I have no experience with solving 2nd-order ODE.

  • $\begingroup$ Welcome to Mathematics StackExchange. Please tell us what you know about solving differential equations. Then you may get answers more suited to your current understanding. $\endgroup$
    – M. Vinay
    Commented Jun 7, 2014 at 2:22
  • $\begingroup$ Here is another helpful link! $\endgroup$
    – Cookie
    Commented Jun 7, 2014 at 2:28
  • $\begingroup$ They guessed the solution? Not very helpful to me. When people pull solutions out of a magic hat. $\endgroup$
    – user01520
    Commented Jun 7, 2014 at 2:45
  • $\begingroup$ It's a reasonable guess though. You're modelling something that has a periodic motion. What are some periodic functions you know? sin(constantx) and cos(constantx). And what do you know, they work. $\endgroup$ Commented Jun 7, 2014 at 3:19
  • $\begingroup$ @mathematician So how does that generalize to other systems? How would I approach a non-periodic system, say the motion of a free body. If I guess a solution say $ x(t) = Ae^{\lambda t} $ ? What is the best way to approach these equations in general? I am new to 2nd-order ODE. $\endgroup$
    – user01520
    Commented Jun 7, 2014 at 3:47

1 Answer 1


There are two ways to look at this equation. One is the fact that it is a linear ODE with constant coefficients, which implies the exponential ansatz, leading to the characteristic polynomial with complex eigenvalues. This can be summarized as $$ \left(\frac d{dt}-i\sqrt{\frac km}\right)\left(\frac d{dt}+i\sqrt{\frac km}\right)x(t)=0 $$ which can be rewritten as the chain of one homogeneous and one inhomogeneous differential equations of first order. Or you can interpret it as $$ \frac d{dt}y(t)=i\sqrt{\frac km}\,y(t)\;\text{ where }\;y(t)=\dot x(t)+i\sqrt{\frac km}x(t) $$ so that one can read of directly $x(t)=\sqrt{\frac mk}\,Im(y(t))$.

The second, more physics related point of view is that this is the equation of motion inside a conservative force field, i.e., the gradient field of a potential. Multiply the equation by $\dot x$ and integrate to obtain $$ C=\dot x^2+\frac km x^2 $$ Which tells you that, on general principles of parametrizing an ellipse, $\dot x(t)=\sqrt{C}\cos(\theta(t))$ and $x(t)=\sqrt{\frac{Cm}{k}}\sin(\theta(t))$. Making a leap of faith into assuming that $\theta(t)$ is differentiable and using the chain rule on the second equation results in $$ \sqrt{C}\cos(θ(t))=\dot x(t)=\sqrt{\frac{Cm}{k}}\cos(θ(t))\,\dot θ(t) $$ so that $\dot θ(t)=\sqrt{\frac{k}{m}}$.

  • $\begingroup$ Great explanation, many thanks. $\endgroup$
    – user01520
    Commented Jun 27, 2014 at 5:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .