# 3. Energy#

## 3.1. Work#

How much work do you need to do to move a box? The answer depends on two things: how heavy the box is, and how far you have to move it. Multiply the two, and you’ve got a good measure of how much work will be required. Of course, work can be done in other contexts as well - pulling a spring from equilibrium, or cycling against the wind. In each case, there’s a *force* and a *displacement*. To be fair, we will only count the part of the force that is in the direction of the displacement (when cycling, you don’t do work due to the fact that there’s a gravitational force pulling you down, since you don’t move vertically; you do work because there’s a drag force due to your moving through the air). We define *work* as the product of the component of the force in the direction of the displacement, times the displacement itself. We calculate this component by projecting the force vector on the displacement vector, using the dot product (see Section 15.1.1 for an introduction to vector math):

Note that work is a scalar quantity - it has a magnitude but no direction. Work is measured in Joules (J), with one Joule being equal to one Newton times one meter.

Of course the force acting on our object need not be constant everywhere. Take for example the extension of a spring: the further you pull, the larger the force gets, as given by Hooke’s law (2.7). To calculate the work done when extending the spring, we chop up the path (here a straight line) into many small pieces. For each piece, we approximate the force by the average value on that piece, then multiply with the length of the piece and sum. In the limit that we have infinitely many pieces, this approximation becomes exact, and the sum becomes an integral: for one dimension, we thus have:

Likewise, the path along which we move need not be a straight line. If the path consists of multiple straight segments, on each of which the force is constant, we can calculate the total work by adding the work done on the different segments. Taking the limit to infinitely many infinitesimally small segments \(\mathrm{d}\bm{r}\), on each of which the force is given by the value \(\bm{F}(\bm{r})\), the sum again becomes an integral:

Equation (3.3) is the most general version of the definition of work; it simplifies to (3.2) for movement along a straight line, and to (3.1) if both the path is straight and the force constant^{[1]}.

In general, the work done depends on the path taken - for example, it’s more work to take a detour when biking from home to work, assuming the air drag is the same everywhere. However, in many important cases the work done in getting from one point to another depends on the endpoints only. Forces for which this is true are called *conservative forces*. As we’ll see below, the force exerted by a spring and that exerted by gravity are both conservative.

Sometimes we will not be interested in how much work is done in generating a certain displacement, but over a certain amount of time - for instance, a generator generates work by getting something to move, like a wheel or a valve, but we don’t typically care about those details, we want to know how much work we can expect to get out of the generator, i.e., how much *power* it has. Power is defined as the amount of work per unit time, or

Power is measured in Joules per second, or Watts (W). To find out how much work is done by an engine that has a certain power output, we need to integrate that output over time:

## 3.2. Kinetic energy#

Newton’s first law told us that a moving object will stay moving unless a force is acting on it - which holds for moving with any speed, including zero. Now if you want to start moving something that is initially at rest, you’ll need to accelerate it, and Newton’s second law tells you that this requires a force - and moving something means that you’re displacing it. Therefore, there is work involved in getting something moving. We define the *kinetic energy* (\(K\)) of a moving object to be equal to the work required to bring the object from rest to that speed, or equivalently, from that speed to rest:

Because the kinetic energy is equal to an amount of work, it is also a scalar quantity, has the same dimension, and is measured in the same unit. The factor \(v^2\) is the square of the magnitude of the velocity of the moving object, which you can calculate with the dot product: \(v^2 = \bm{v} \cdot \bm{v}\). You may wonder where equation (3.6) comes from. Newton’s second law tells us that \(\bm{F} = m \mathrm{d}\bm{v}/\mathrm{d}t\), relating the force to an infinitesimal change in the velocity. In the definition for work, equation (3.3), we multiply the force with an infinitesimal change in the position \(\mathrm{d}\bm{r}\). That infinitesimal displacement takes an infinitesimal amount of time \(\mathrm{d}t\), which is related to the displacement by the instantaneous velocity \(\bm{v}\): \(\mathrm{d}\bm{r} = \bm{v} \mathrm{d}t\). We can now calculate the work necessary to accelerate from zero to a finite speed:

where we used that the dot product is commutative and the fact that the integral over the derivative of a function is the function itself.

Of course, now that we know that the kinetic energy is given by equation (3.6), we no longer need to use a complicated integral to calculate it. However, because the kinetic energy is ultimately given by this integral, which is equal to a net amount of work, we arrive at the following statement, sometimes referred to as the **Work-energy theorem**: the change in kinetic energy of a system equals the net amount of work done on or by it (in case of increase/decrease of \(K\)):

Gabrielle Émilie Le Tonnelier de Breteuil, marquise du Châtelet (1706-1749)

**Gabrielle Émilie Le Tonnelier de Breteuil, marquise du Châtelet** (1706-1749), known as Émilie du Châtelet, was a French mathematician and physicist (then known as natural philosopher), who made important contributions to the development of the concept of (kinetic) energy. She translated Newton’s *Principia* into French, and wrote an extensive commentary on it, in which she first postulated the law of conservation of energy, for which she introduced the new concept of kinetic energy. Inspired by experiments first done by ‘s Gravesande, which she repeated and analyzed, she discovered that a ball dropped from a given height \(h\) would make an indentation in a piece of soft clay with a depth proportional to the height the ball was dropped from. At the time, most people, including Newton, considered energy to be equivalent to momentum (and thus proportional to velocity); had they been correct, the depth of the indentation should be proportional to \(\sqrt{h}\) instead. Du Châtelet’s work showed this to be incorrect, postulating instead that kinetic energy is proportional to the square of the velocity.
Émilie du Châtelet was born in the French nobility, corresponded with people across Europe, married at age 18, and had a long-term friendship with Voltaire, with whom she collaborated extensively in her work on mathematics and physics. She published several books, often initially anonymously to avoid sexist prejudices, which found their way to salons and universities of the time. Her translation of the *Principia* is still the standard French version. She died in childbirth at age 42.

## 3.3. Potential energy#

We already encountered *conservative forces* in Section 3.1. The work done by a conservative force is (by definition) path-independent; that means that in particular the work done when moving along any closed path^{[6]} must be zero:

For a conservative force, we can thus define a *potential energy difference* between points 1 and 2 as the work necessary to move an object from point 1 to point 2:

Note the minus sign in the definition - this is a choice of course, and you’ll see below why we made this choice. Note also that the potential energy is defined only between two points. Often we will choose a convenient reference point and calculate the potential energy at any other point with respect to that point. The reference point is typically either the origin or infinity, if the force happens to be zero at either of these. Let’s suppose we have set such a point, and know the potential energy difference with that point at any other point in space - this defines a (scalar) function \(U(\bm{r})\). If we now want to know the force acting on a particle at \(\bm{r}\), all we need to do is take the derivative of \(U(\bm{r})\) - that is to say the gradient in three dimensions (which simplifies to the ordinary derivative in one dimension):

Equation (3.11) is extremely useful, as it gives us a means to calculate the force, which is a vector quantity, from the potential energy function, which is a scalar quantity - and therefore much simpler to work with. For instance, since energies are scalars, they can simply be added, as we’ll do in the next section, whereas for forces you need to do vector addition. Equation (3.11) also reflects that we are free to choose a reference point for the potential energy, since the force does not change if we add a constant to the potential energy.

### 3.3.1. Gravitational potential energy#

We saw in Section 2.2.2 that for low altitudes, the gravitational force is given by \(\bm{F}_g = m \bm{g}\), where \(\bm{g}\) is a vector of constant magnitude \(g\approx 9.81 \mathrm{m}/\mathrm{s}^2\) and always points down. Therefore, the gravitational force does no work when you move horizontally, and if you first move up and then the same amount down again, it doesn’t do any net work either, as the two contributions exactly cancel. \(\bm{F}_g\) is therefore an example of a conservative force, and we can define and calculate the *gravitational potential energy* \(U_g\) between a point at height \(0\) (our reference point) and one at height \(h\):

Note that by choosing a minus sign in the definition of the potential energy, we end up with a positive value of the energy here.

What about larger distances, i.e., Newton’s law of gravity, equation (2.9)? Well, there the distances are measured radially, so any movement perpendicular to the radial direction doesn’t matter, and if you move out and back in again, the net work done is zero, so by the same reasoning as before we again have a conservative force. This force vanishes at infinity, so it makes sense to set that as a reference point - though notice that that will make our potential energy always negative in this case:

where \(r\) is the distance between \(m\) and \(M\), and \(M\) sits at the origin. Of course we can also calculate gravitational potential differences between two distances \(r_1\) and \(r_2\) from \(M\): \(\Delta U_\mathrm{G}(r_1, r_2) = G M m \left(\frac{1}{r_1} - \frac{1}{r_2}\right)\).

### 3.3.2. Spring potential energy#

Like the gravitational force, the Hookean spring force (2.7) also depends on displacement alone, and by the same reasoning is conservative (notice the pattern?). Calculating its associated potential energy is straightforward, and taking the equilibrium position of the spring as the reference point, we find:

The minus sign in Hooke’s Law gives us a positive spring potential energy. Note that \(x\) stands for displacement here; as we only consider one-dimensional springs the 1D-version is sufficient.

### 3.3.3. General conservative forces#

In the case of the gravitational and spring force it was easy to reason that they had to be conservative. It is also easy to see that the friction force is not conservative: if you take a longer path, you need to do more net work against friction, which you can moreover never recover as mechanical energy. For more complicated systems, especially in three dimensions, it may not be so easy to see whether a force is conservative. Fortunately, there is an easy test you can perform: if the curl of a force is zero everywhere, it will be a conservative force, or expressed mathematically:

Is is straightforward to show that if a force is conservative, its curl must vanish: a conservative force can be written as the gradient of some scalar function \(U(\bm{x})\), and \(\bm{\nabla} \times \bm{\nabla} U(\bm{x}) = 0\) for any function \(U(\bm{x})\), as you can easily check for yourself. The proof the other way around is more complicated, and can be found in advanced mechanics textbooks.

## 3.4. Conservation of energy#

Work, kinetic energy and potential energy are all quantities with the same dimension - so we can do arithmetic with them. One particularly useful quantity is the *total energy* \(E\) of a system, which is simply the sum of the kinetic and potential energy:

(Law of conservation of energy)

If all forces in a system are conservative, the total energy in that system is conserved.

Proof. For simplicity, we’ll look at the 1D case (3D goes analogously). Conserved means not changing in time, so in order to prove the statement, we only need to calculate the time derivative of \(E\) and check that it is always zero.

where the last equality holds because of Newton’s second law.

Conservation of energy means that the total energy of a system cannot change, but of course the potential and kinetic energy can - and by conservation of total energy we know that they get converted directly into one another. Exploiting this fact will allow us to analyze and easily solve many problems in classical mechanics - this conservation law is an immensely useful tool.

Note that conservation of energy is not the same as the work-energy theorem of Section 3.2. For the total energy to be conserved, all forces need to be conservative. In the work-energy theorem, this is not the case. You can therefore calculate changes in kinetic energy due to the work done by non-conservative forces using the latter.

## 3.5. Energy landscapes#

In the previous section we proved that the total energy is conserved. In the section before that, we looked at potential energies. Typically, the potential energy is a function of your position in space. When we plot it as a function of spatial coordinates, we get an *energy landscape*, measuring an amount of energy on the vertical axis. Of course we can also plot the total energy of the system - and since that is conserved, it is the same everywhere, and thus becomes a horizontal line or plane. Because kinetic energy cannot be negative, any point where the potential energy is higher than the total energy is not allowed: the system cannot reach this point. When the potential energy equals the total energy, the kinetic energy (and thus the speed) has to be zero. Whenever the potential energy is lower than the total energy, there is a positive kinetic energy and thus a positive speed.

Probably the simplest energy landscape is that of the harmonic oscillator (mass on a spring) - it’s a simple parabola. The point at which the horizontal line representing the total energy crosses the parabola corresponds to the extrema of the oscillation: these are its turning points. The bottom of the parabola is its midpoint, and you can immediately see that that’s where the kinetic energy (and thus the speed) will be highest.

Of course you can have more complex energy landscapes than that. In particular, you can have a landscape with multiple extrema, see for example Fig. 3.3. A particle that is being acted upon by forces described by this potential energy, follows a trajectory in this landscape, which can be visualized as a ball rolling over the hills and valleys of the landscape. Think back to the harmonic oscillator example. If we let go of a ball in a parabolic vase at some point on the slope, the ball will roll down and pick up speed, then roll up the opposite slope and lose speed, until it reaches the same height where its speed will again be zero. The same is true in more complicated landscapes. Particularly interesting are local maxima. If you put a ball exactly on top of one of them, it will stay there - it is a fixed point, but an unstable one, as any arbitrarily small perturbation will push it down. If you let go of a ball at a level above a local maximum, it may hop over it to the next minimum, but if your initial position (your initial energy) was too low, your ball can get stuck oscillating about a local minimum - a metastable point.

## Show code cell source

```
import plotly.graph_objects as go
import numpy as np
from myst_nb import glue
def U(x):
return (x**2)*(x**2 - 2)*(x + 1)*(x - 2)
def dU(x):
return x*(6*x**4 - 5*x**3 - 16*x**2 + 6*x + 8) # Derivative of U(x)
x = np.linspace(-2, 2.5, 100)
y = U(x)
fig = go.Figure(layout=go.Layout(template='simple_white'))
#fig = go.Figure()
# Have hover text for each point on function U(x) be equal to U'(x).
dU_values = dU(x)
hover_texts = [f'<i>U</i>\'(<i>x</i>) = {val:.3f}' for val in dU_values]
# Add function trace for potential energy U(x)
function_trace = go.Scatter(
x=x,
y=y,
mode='lines',
name='Potential energy function',
#line=dict(color='blue'),
legendgroup='function', # Assign to its own legend group so it is always visible and non-toggleable from the legend
showlegend=False, # Hide from legend
text=hover_texts, # Set the hover text for each point
hoverinfo='text' # Display only the hover text
)
fig.add_trace(function_trace)
# Add equilibrium points
extreme_x = {
'Unstable equilibria': [-0.635, 0.942], # Local max
'Metastable equilibria': [-1.254, 0], # Local min
'Globally stable equilibrium': [1.779] # Global min
}
extreme_y = {etype: [U(x_val) for x_val in x_values] for etype, x_values in extreme_x.items()}
extrema_traces = []
for etype, color in [
('Unstable equilibria', 'green'),
('Metastable equilibria', 'orange'),
('Globally stable equilibrium', 'red')]:
extremum_dict = {'Unstable equilibria': 'Local maximum', 'Metastable equilibria': 'Local minimum', 'Globally stable equilibrium': 'Global minimum'}
hover_text = f'<i>U</i>\'(<i>x</i>) = 0\n{extremum_dict[etype]}'
trace = go.Scatter(
x=extreme_x[etype],
y=extreme_y[etype],
mode='markers',
name=f'{etype}',
marker=dict(color=color, size=10),
text=hover_text,
hoverinfo='text'
)
fig.add_trace(trace)
extrema_traces.append(trace)
fig.update_layout(
#title_text='A potential energy landscape and its equilibrium points',
#title_x=0.5,
showlegend=True,
yaxis=dict(range=[-3, 4]),
xaxis_title='<i>x</i>',
yaxis_title='<i>U</i>(<i>x</i>)',
xaxis_title_font = dict(size=24, family='Times New Roman'),
yaxis_title_font = dict(size=24, family='Times New Roman')
)
# fig.show()
# Save graph to load in figure later (special Jupyter Book feature)
glue("InteractiveEnergyLandscape", fig, display=False)
```