While in my physics classes, I've always heard that the simple harmonic motion formulas are inaccurate e.g. In a pendulum, we should use them only when the angles are small; in springs, only when the change of space is small. As far as I know, SHM came from the differential equations of Hooke's law – so, using calculus, it should be really accurate. But why it isn't?
Harmonic Oscillator – Why Is Simple Harmonic Motion Idealization Inaccurate?
anharmonic-oscillatorsharmonic-oscillatornewtonian-mechanics
Related Solutions
The trick with the two-dimensional harmonic oscillator is to recognize that there are two directions so that movement in one direction is independent of the movement in the other (if the harmonic oscillator is rotationally symmetric, any two orthogonal directions will do). If you plot the equipotential lines of the oscillator potential (that is, the potential energy if the mass is at that point), it consists of ellipses; the main axes of those ellipses give those two directions.
In each of the directions, the equation of motion is just the equation of motion of a one-dimensional harmonic oscillator. So you solve the two one-dimensional harmonic oscillators separately.
If you don't want to use such a shortcut, you can also calculate it directly using any of the usual methods, like Lagrange formalism or Hamilton formalism.
Here's how you would do it in Lagrange formalism:
Step 1: determine the kinetic and potential energy of the 2D harmonic oscillator.
Kinetic energy: $T = \tfrac{1}{2}m(\dot x^2+\dot y^2)$
Here $x$ and $y$ are the coordinates, and the dot describes the time derivative, that is, $\dot x$ and $\dot y$ are the components of the velocity.
Potential energy: $V = ax^2 + bxy + cy^2$
Here $a$, $b$ and $c$ are general constants (with the restriction that $a>0$, $c>0$ and $2ac-b^2>0$). This is the most general two-dimensional harmonic oscillator potential with the restriction that the minimum is at $x=y=0$ (and the value there is $0$, but a constant term in the potential doesn't change the equations of motion).
Step 2: From the kinetic and potential energy, you calculate the Lagrange function. That step is trivial: The Lagrange function is always $L=T-V$, that is in this case, $$L = \tfrac12m(\dot x^2+\dot y^2) - ax^2-bxy - cy^2$$
Step 3: To derive the equation of motion, you just plug this lagrange equation into the Euler-Lagrange equatons (of the second type): For each coordinate $q$ (that is here, $x$ and $y$), the equation of motion reads $$\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial\dot q} = \frac{\partial L}{\partial q}$$ So for $x$, we get $\partial L/\partial\dot x = m\dot x$ and $\partial L/\partial x = 2ax + by$, and thus $$m\ddot x = -(2ax+by)$$ and analogously $$m\ddot y = -(bx + 2cy)$$
Those are the equations of motion.
A simple pendulum does not strictly show simple harmonic motion unless you allow some approximations and uncertainties. It approximately behaves as a harmonic oscillator for small amplitudes.
An object is said to be executing simple harmonic motion (no damping; not a forced oscillation) if and only if it satisfies the following condition:
$$\frac{d^2 \phi}{dt^2} = -\omega^2 \phi \tag{1}$$
where $\phi$ is a variable quantity such as displacement, angular displacement, etc.
Does a pendulum execute simple harmonic motion?
The equation of motion for the pendulum can be written as:
$$\vec{F} = {m\vec{g}} - \vec{T}$$
We know that the pendulum bob will move in a circle (assume that the string does not stretch), therefore, there is no motion in the direction of the string. This would mean that the net force on the bob will be used to provide a constant centripetal force.
$$F_{radial} = T - mg\cos \theta = \frac{mv^2}{L}$$
The acceleration along the circumference of the string can be written as:
$$F_{tangential} = ma = mg \sin \theta$$
$$a_{tangential} = a = g \sin \theta \tag{2}$$
The tangential acceleration can be expressed in terms of the angle $\theta$ as follows:
$$v = L \frac{d\theta}{dt}$$ $$\frac{dv}{dt} = a = -L\frac{d^2\theta}{dt^2} \tag{3}$$
We have a minus sign because the gravitational force (acceleration) always tries to decrease the angle $\theta$.
Substituting $(3)$ in $(2)$, you get,
$$L\frac{d^2\theta}{dt^2} = -g \sin \theta \tag{4}$$
If you compare equation $(4)$ with equation $(1)$, you'll notice that it does not match.
This would mean that the pendulum bob does not execute a simple harmonic motion.
However, if the amplitude is small, then the maximum value of $\theta$ is small. The small angle approximation can be stated as follows:
$$\sin \theta \approx \theta$$
Image Source: Wikipedia
Using the approximation, you can rewrite equation $(4)$ as
$$L\frac{d^2\theta}{dt^2} = -g\theta \tag{5}$$
The above equation looks quite similar to the equation $(1)$. It does match perfectly. Therefore, for small amplitudes, the pendulum executes a simple harmonic motion with a reasonable uncertainty.
Does a spring-mass system execute simple harmonic motion?
If the spring obeys Hooke's law, then it always executes simple harmonic motion.
Hooke's law states that:
$$F_{restoring} = ma = - kx \tag{6}$$
It is clearly evident from the above equation that the acceleration is directly proportional to the displacement and acts in the direction opposite to the displacement.
Why do we limit the amplitude of a spring-mass system?
Under high strain, the spring does not obey Hooke's law. This is kinda obvious: if you stretch a spring too much, it deforms permanently. Therefore, the equation $(6)$ no longer holds. If that equation does not hold, then the mass won't execute simple harmonic motion.
Best Answer
The actual restoring force in a simple pendulum is not proportional to the angle, but to the sine of the angle (i.e. angular acceleration is equal to $-\frac{g\sin(\theta)}{l}$, not $-\frac{g~\theta}{l}$ ). The actual solution to the differential equation for the pendulum is
$$\theta (t)= 2\ \mathrm{am}\left(\frac{\sqrt{2 g+l c_1} \left(t+c_2\right)}{2 \sqrt{l}}\bigg|\frac{4g}{2 g+l c_1}\right)$$
Where $c_1$ is the initial angular velocity and $c_2$ is the initial angle. The term following the vertical line is the parameter of the Jacobi amplitude function $\mathrm{am}$, which is a kind of elliptic integral.
This is quite different from the customary simplified solution
$$\theta(t)=c_1\cos\left(\sqrt{\frac{g}{l}}t+\delta\right)$$
The small angle approximation is only valid to a first order approximation (by Taylor expansion $\sin(\theta)=\theta-\frac{\theta^3}{3!} + O(\theta^5)$).
And Hooke's Law itself is inaccurate for large displacements of a spring, which can cause the spring to break or bend.