Bouncing Balls and the Boltzmann Distribution

by Dominic Ford

Temperature

### The distribution of the heights of the balls

The graph below shows the total mass distribution of all of the balls as a function of height:

### The distribution of the speeds of the balls

The plot below shows this distribution of the speeds of the balls:

### The distribution of the kinetic energies of the balls

The plot below shows this distribution of the kinetic energies of the balls:

## Explanation

The tank of bouncing balls above demonstrates several important principles of statistical mechanics. The balls behave in a similar way to air molecules in the Earth's atmosphere, behaving like an ideal gas.

The balls feel the force of gravity, and also experience collisions with the sides of the container and with each other. All of these interactions are frictionless, and so energy is conserved.

The controls above the tank can be used to change the number of balls; click on Restart simulation for your changes to take effect. The colors of the balls are either assigned randomly if all the balls have the same mass (default), but heavier balls are shown in red, and lighter balls in blue, if the balls have different masses.

The temperature control on the right hand side can be used to change how much kinetic energy the balls have – a value of one corresponds to the default. The red line next to the temperature control indicates how much energy the balls currently have; this does not update instantly when the slider is changed since energy changed are implemented by briefly introducing a little friction into the system.

### Applying statistical mechanics to the tank

From the initial positions and speeds of all the balls, it is theoretically possible to calculate their future positions from Newton's laws. However, calculations at this level of detail obscure large-scale average trends in the behaviour of the balls. Some configurations of the balls are more likely then others. For example, a state where all the balls are clustered together one corner of the tank is theoretically possible, but quite unlikely to arise by chance. A state where the balls are more uniformly spaced out is much more likely.

Consider the distribution of the heights of the balls above the bottom of the tank.

The Boltzmann distribution states that the probability of finding a system in a particular state is related to the energy of that state, by the formula $P(state) \propto e^{-E/kT}.$

Here, $$k$$ is the Boltzmann constant and $$T$$ is thermodynamic temperature – a measure of how much energy the system has, by analogy with how the temperature of a gas describes how much energy its molecules have.

The height of any particular ball is related to its potential energy by the equation $\text{Potential Energy}=mgh,$ where $$m$$ is the mass of the ball, $$g$$ is the acceleration due to gravity, and $$h$$ is the height of the ball. Substituting this into the Boltzmann distribution, we find that the probability of a ball being at some height $$h$$ is given by $P(h)\propto e^{-mgh/kT}.$

Removing all of the constant terms, and assuming the balls all have a common thermodynamic temperature, this simplifies to $P(h)\propto e^{-h}.$ The most likely place for a ball to be found is at the bottom of the tank, and the chance of it being at some height $$h$$ above the bottom decreases exponentially with height.

A graph above shows the distribution of balls as a function of height. The position of each ball represents a sample from the probability distribution above, and so the mass distribution follows this same exponential curve.

Try changing the thermodynamic temperature of the balls using the slider to the right of the tank. According to the Boltzmann distribution, the mass distribution will become flatter at higher temperatures – that is, balls are able to bounce higher when they have more energy.

The plot is somewhat jittery, which comes about because it's based on the random motions of a relatively small number of balls. The Boltzmann distribution only describes the most likely configuration of a system, not the exact distribution of the heights of the balls.

To demonstrate this, try changing the number of balls using the configuration panel above the tank. Adding more balls will reduce the amount of jitter because an average is then being taken over the random motions of a larger number of balls.

### The Maxwell–Boltzmann distribution

The second plot above shows the distribution of the speed of the balls.

The distribution of speeds of particles $$v$$ in an ideal gas follow the Maxwell–Boltzmann distribution, given by $f(v) = \left(\frac{m}{2\pi kT}\right)^{\frac{3}{2}}\, 4\pi v^2\, \text{exp}\left(\frac{-mv^2}{2kT}\right).$ Our tank of balls is similar to an ideal gas, but differs in that the balls are only free to move in two dimensions rather than three. As a result, rather than following the Maxwell-Boltzmann distribution, the velocity distribution instead follows $f(v) = \left(\frac{v}{kT}\right)\, \text{exp}\left(\frac{-mv^2}{2kT}\right).$

To understand how these distributions arise, it is useful to look at each term in turn. The right-most term in each distribution looks very like a Boltzmann distribution, with the familiar expression for kinetic energy, $$mv^2/2$$ substituted for the energy of each available state. But there is also a new term which is proportional to $$v^2$$ for a three-dimensional gas and proportional to $$v$$ for our two-dimensional simulation.

This arises because velocity is a vector, with three components for a real-world gas, and with two components in our simulation. Speed, meanwhile, is a scalar; it is the magnitude of this vector.

The volumes of velocity space which correspond to higher speeds are larger than the ones that correspond to lower speeds. This means that it is less likely that a ball will randomly be found in the relatively small part of parameter space corresponding to slow speeds, as compared to the much larger volume of velocity space corresponding to higher speeds.

We can go further and quantify this. The velocity of a ball encompasses three degrees of freedom. A ball's velocity can be represented as a point in a three-dimensional parameter space – the ball's so-called 'velocity space'. The ball's speed is the distance of that point from the origin, $$\text{Speed}=\sqrt{v_\text{x}^2+v_\text{y}^2+v_\text{z}^2}$$.

Thus, many different points in three-dimensional velocity space correspond to the same speed. In fact there is a whole spherical shell of velocity states, centred on the origin, that all corresponding to the same speed $$v$$. These are degenerate states for the purposes of calculating the distribution of speeds.

The volume of this spherical shell of degenerate states, which has radius $$v$$ and thickness $$\text{d}v$$, is given by $\text{Volume} = 4\pi v^2 \text{d}v.$ It is as a result of summing over the probabilities of a ball being in any of the velocity states within this shell that the term $$4\pi v^2$$ arises in the speed distribution.

In the case of balls which can only move in two dimensions, the sum is instead over a circular ring of states in a two-dimensional velocity space, which has an area of $\text{Area} = 2\pi v \text{d}v.$

### The principle of equipartition

In the final plot above, the balls are sorted into a series of bins according to their masses, and the average kinetic energy of the balls within each bin is plotted.

Note that the default option above is for all the balls to have the same mass, and so a spread of balls with different masses will only be seen if the balls are set to have differing masses.

The principle of equipartition states that when a system is able to distribute energy between a number of different degrees of freedom, it will tend to spread the energy equally among those degrees of freedom. Each degree of freedom has an average energy of $\text{Mean energy} = \frac{kT}{2}.$

This means that in the tank above, all the balls should have the same time-averaged kinetic energy, even if they have different masses.

### The role of collisions

A final option above allows collisions between balls in the tank to be enabled (default) or disabled. If collisions are disabled, the balls are able to pass through one another and do not interact with one another.

Enabling this option means that the balls have no means of exchanging energy or momentum. Looking at the graphs above, you will see that they no longer follow the Boltzmann and Maxwell-Boltzmann distributions.

The simulation starts with the balls spread randomly through the box. The balls are assigned random positions and speeds. However, these random initial conditions do not match the Boltzmann distribution. The rules of statistical mechanics determine that it doesn't matter how the balls start out – random exchanges of energy when they collide will quickly distribute energy between them according to the Boltzmann distribution.

However, if there are no collisions between the balls, there is no mechanism by which they can exchange energy and momentum. Instead, they retain the initial energy distribution with which they started the simulation.

In statistical mechanics, a system in which energy has been evenly shared out amongst its components is said to be relaxed. The relaxation timescale is how long it takes for a system to smooth out any temperature imbalances within it. The only mechanism by which relaxation occurs in our tank of balls is through collisions between the balls. Without any collisions, the relaxation timescale becomes infinite, and thermodynamic equilibrium is never reached.