# How to solve 2nd order diff. equation for simple harmonic motion

1. Apr 4, 2013

### cjurban

In my physics class we're talking about LC and LRC circuits, and the equations are analogous to those for SHM. However, I don't see how x=Acos(ωt+$\varphi$) satisfies m(d^2x/dt^2)+(k/m)x=0. I've never done differential equations and in the book it seemed like the author just guessed and checked until he found the right solution, and this doesn't seem like a satisfactory answer. How did he solve this equation?

2. Apr 4, 2013

### SteamKing

Staff Emeritus
Take the assumed solution, do the requisite manipulation, and see if it satisfies the ODE. Any unknown constants can be determined using initial conditions. You have taken derivatives of trig functions, haven't you?

3. Apr 4, 2013

### vanhees71

Well, solving differential equations is an art. You just have to practice it to find solutions. There is of course a lot of work done by the mathematicians to provide general theorems about their structure and that of their solutions.

In your case of circuit theory or the harmonic oscillator you have a particularly nice class of differential equations, namely a linear differential equation. Here, it's even the kind with constant coefficients. For the undamped harmonic oscillator it reads
$$\ddot{x}+\omega^2 x=0.$$

Here the standard ansatz to find a solution is
$$x(t)=A \exp(\lambda t).$$
Plugging this into the equation you find
$$\lambda^2+\omega^2=0.$$
There are two solutions for $\lambda$, namely
$$\lambda_{1/2}=\pm \mathrm{i} \omega.$$
Now the mathematicians have proven that any solution is given as the superposition of two linearly independent solutions, and these we just have found! So the general solution is
$$x(t)=A_1 \exp(\mathrm{i} \omega t) + A_2 \exp(-\mathrm{i} \omega t).$$
The constants $A_1$ and $A_2$ are determined by giving initial values, e.g., position and velocity at $t=0$.

4. Apr 4, 2013

### timthereaper

I have a book that does something similar and I'm not sure the book was guessing and checking. I think they were showing why other functions don't satisfy the given ODE.