\subsection{Energy in Simple Harmonic Motion}

This subsection uses energy to describe how a frictionless spring-mass oscillator trades energy between motion and spring deformation.

\dfn{Kinetic, potential, and total energy in spring SHM}{Consider a block of mass $m$ attached to an ideal spring of spring constant $k$ and moving frictionlessly along the $x$-axis. Let $x$ denote the signed displacement from equilibrium, let $\vec{v}=\dot{x}\hat{\imath}$ denote the block's velocity, let $v=|\vec{v}|=|\dot{x}|$ denote its speed, and let $A>0$ denote the amplitude of the motion.

The kinetic energy is
\[
K=\tfrac12 mv^2=\tfrac12 m\dot{x}^2.
\]
The spring potential energy is
\[
U_s=\tfrac12 kx^2.
\]
The total mechanical energy is
\[
E=K+U_s=\tfrac12 m\dot{x}^2+\tfrac12 kx^2.
\]}

\thm{Conserved-energy relation for SHM}{For the frictionless spring-mass oscillator above, the total mechanical energy is constant:
\[
E=\tfrac12 m\dot{x}^2+\tfrac12 kx^2=\tfrac12 kA^2.
\]
Therefore, at any displacement $x$,
\[
\dot{x}^2=\frac{k}{m}\left(A^2-x^2\right),
\qquad
v=\sqrt{\frac{k}{m}\left(A^2-x^2\right)}.
\]
In particular, the maximum speed occurs at equilibrium $x=0$:
\[
v_{\max}=\sqrt{\frac{k}{m}}\,A.
\]}

\nt{At the turning points $x=\pm A$, the block reverses direction, so $v=0$, $K=0$, and all the mechanical energy is spring potential energy:
\[
U_s=E=\tfrac12 kA^2.
\]
At equilibrium $x=0$, the spring is neither stretched nor compressed, so $U_s=0$ and all the energy is kinetic:
\[
K=E=\tfrac12 kA^2.
\]
Thus SHM continually swaps energy between kinetic and potential forms. If $x(t)=A\cos(\omega t+\phi)$, then $U_s\propto \cos^2(\omega t+\phi)$ and $K\propto \sin^2(\omega t+\phi)$, so the two energy curves are out of phase and each repeats twice during one full oscillation.}

\pf{Short derivation from conservation of mechanical energy}{For a frictionless spring-mass system, the only horizontal interaction is the spring force
\[
\vec{F}_s=-kx\hat{\imath},
\]
which is conservative. Therefore the mechanical energy $E=K+U_s$ is constant. Using the spring potential-energy function,
\[
U_s=\tfrac12 kx^2,
\]
the total energy at any instant is
\[
E=\tfrac12 m\dot{x}^2+\tfrac12 kx^2.
\]
At a turning point, $x=\pm A$ and $\dot{x}=0$, so
\[
E=\tfrac12 kA^2.
\]
Equating the two expressions for $E$ gives
\[
\tfrac12 m\dot{x}^2+\tfrac12 kx^2=\tfrac12 kA^2.
\]
Solving for $\dot{x}^2$ yields
\[
\dot{x}^2=\frac{k}{m}\left(A^2-x^2\right),
\]
and taking the positive square root gives the speed formula for the magnitude $v=|\dot{x}|$.}

\qs{Worked example}{A block of mass $m=0.40\,\mathrm{kg}$ is attached to an ideal horizontal spring of spring constant $k=160\,\mathrm{N/m}$ and oscillates frictionlessly with amplitude $A=0.10\,\mathrm{m}$. At one instant, the block is at displacement $x=+0.060\,\mathrm{m}$ from equilibrium.

Find:
\begin{enumerate}[label=(\alph*)]
\item the total mechanical energy of the oscillator,
\item the spring potential energy and kinetic energy at $x=+0.060\,\mathrm{m}$,
\item the speed of the block at that displacement, and
\item the maximum speed and where it occurs.
\end{enumerate}}

\sol Let $E$ denote the total mechanical energy. Because the motion is frictionless,
\[
E=\tfrac12 kA^2.
\]
Substitute $k=160\,\mathrm{N/m}$ and $A=0.10\,\mathrm{m}$:
\[
E=\tfrac12 (160)(0.10)^2=80(0.010)=0.80\,\mathrm{J}.
\]

So the oscillator's total mechanical energy is
\[
0.80\,\mathrm{J}.
\]

At $x=+0.060\,\mathrm{m}$, the spring potential energy is
\[
U_s=\tfrac12 kx^2=\tfrac12 (160)(0.060)^2.
\]
Since $(0.060)^2=0.0036$,
\[
U_s=80(0.0036)=0.288\,\mathrm{J}.
\]
Then the kinetic energy is
\[
K=E-U_s=0.80-0.288=0.512\,\mathrm{J}.
\]

Now use kinetic energy to find the speed:
\[
K=\tfrac12 mv^2.
\]
So
\[
0.512=\tfrac12 (0.40)v^2=0.20v^2.
\]
Thus,
\[
v^2=\frac{0.512}{0.20}=2.56,
\qquad
v=1.60\,\mathrm{m/s}.
\]

For the maximum speed, use the equilibrium position $x=0$, where all the energy is kinetic:
\[
\tfrac12 mv_{\max}^2=E=0.80\,\mathrm{J}.
\]
Therefore,
\[
0.20v_{\max}^2=0.80,
\qquad
v_{\max}^2=4.0,
\qquad
v_{\max}=2.0\,\mathrm{m/s}.
\]

Equivalently,
\[
v_{\max}=\sqrt{\frac{k}{m}}\,A=\sqrt{\frac{160}{0.40}}(0.10)=20(0.10)=2.0\,\mathrm{m/s}.
\]

Therefore,
\[
E=0.80\,\mathrm{J},
\qquad
U_s=0.288\,\mathrm{J},
\qquad
K=0.512\,\mathrm{J},
\]
\[
v=1.60\,\mathrm{m/s},
\qquad
v_{\max}=2.0\,\mathrm{m/s}\text{ at }x=0.
\]

\nt{In simple harmonic motion, total mechanical energy $E = K + U$ is constant. At maximum displacement ($x=\pm A$), $K=0$ and $U=E$ (all energy is potential). At equilibrium ($x=0$), $U=0$ and $K=E$ (all energy is kinetic). At $x=\pm A/\sqrt{2}$, $K=U=E/2$. The energy exchange oscillates at twice the frequency of the motion itself.}
