We see ice melting and water boiling every day. But why does it happen? If you think about it, it's kind of weird that the properties of water can change so suddenly. Today, I'm going to talk about why this happens. But first, we have to come up with some equations that we can use to describe the properties of gases.

## The Van der Waals Equation

At some point in chemistry class, you might have seen the ideal gas law, $PV = nRT$. An ideal gas is a theoretical gas whose particles take up no volume and don't interact with each other. These properties make ideal gases easy to do math about, and give us nice equations like the ideal gas law. In fact, if we change our units, we can get an even nicer ideal gas law. If we let $N$ be the number of particles and $\tau$ be the temperature in joules, then instead of the normal chemistry ideal gas law, we just have $PV = N\tau$. It's nice and simple.

Unfortunately, if we want to study phase transitions, this ideal gas model is a little bit too simple. Many phase transitions happen because of interactions between molecules, which cannot happen in an ideal gas. If we want to understand why water boils, we'll need a more sophisticated model. We can add in some correction terms to make two of our assumptions a bit more realistic. First of all, instead of assuming our particles are point masses, we can instead give them each a little volume. This decreases the amount of empty space in the container of gas. Furthermore, how much the empty space decreases should depend linearly on the number of gas particles. So we can replace $V$ in our equation by $V - Nb$ for some positive constant $b$. Next, we add in an attractive force between the particles. For particles in the middle of the gas, this doesn't do much. They have particles surrounding them on all sides, so the attractive forces in all directions cancel each other out. But it does affect the particles near the edges of the container. They are pulled back towards the middle of the container since almost all of the other particles are in that direction. The magnitude of this force depends on the number density ($\frac N V$) of particles in the container. The number of particles at the edge of the container is also proportional to the number density of particles. This means that the pressure of our non-ideal gas is decreased by $a \frac {N^2}{V^2}$ for some positive constant $a$. These two modifications give us the Van der Waals equation $\left(p + \frac {N^2}{V^2} a\right) (V - Nb) = N \tau$ The Van der Waals equation is still a pretty crude approximation and still only works for dilute gases, but it will allow us to understand phase transitions qualitatively.

## Phase Transitions

So, now we've got a fancy new equation to model non-ideal gases. Let's see what it tells us. We'll begin by looking at how pressure varies with volume. I picked some arbitrary $a, b$ and $N$ values and plotted $V$ vs $p$ for various temperatures. The plots look like this.

For $\tau$ below some critical temperature, we see that pressure first dips down, then goes up a bit, and then goes back down again as volume decreases. This is weird. Intuitively, if you squish a substance, the pressure should go up. But there's a region in the plot where decreasing the volume decreases the pressure. As you squish the material more, it resists you less. This seems pretty unrealistic. What's going on there?

To analyze this weird behavior, we need to think about the energy stored by squishing the gas. At some point in physics class, you might have seen that $W = \int F\;dx$. Work (energy) is a force applied over a distance. If we multiply through by $\frac{area}{area}$, we get another form of the equation that is often more useful with gases. $W = \int F \cdot \frac{area}{area}\;dx = \int \frac{F}{area} \; d(x \cdot area) = \int p\;dV$ So $\int p \; dV$ can be seen as the energy stored in the system. In fact, if our system is at a constant temperature, then $\int p \; dV$ is the Helmholtz free energy of the system. We denote the Helmholtz free energy by $A$.

Now, we'll try to use the Helmholtz free energy to understand what goes on in the weird region of the graph we identified above. We'll assume that our temperature is constant, so we have that the Helmholtz free energy when the system has volume $v$ is $A(v) = -\int^\infty_v p\;dV$ That weird dip in our $p-V$ graph makes the Helmholtz free energy flatten out a little bit in that area. This means that in that region, the Helmholtz free energy is not a convex function of $V$. In the following plot, I exaggerate the effect a bit, but it makes it a lot easier to see what happens next.

Systems don't like to have high energy, and gases are no exception. A gas tries to minimize its Helmholtz free energy however it can. This is what makes Helmholtz free energy a useful topic to study. And by using a neat trick, a gas can 'cheat' to get a lower free energy than our plot above would predict by taking advantage of all the weirdness that was confusing us earlier. Our plot describes the Helmholtz free energy of a homogenous substance. But a gas doesn't have to be homogenous. Some of it could be in one state, and some could be in another. Normally, this is not a helpful thing to do, so gases don't do it. But because of our weird graph, a gas can use this trick to lower its free energy.

If part of the gas is in the red state and part of it is in the blue state, then the Helmholtz free energy of the gas is a weighted average of the red energy and the blue energy. This means that by splitting itself into two states, the gas can follow the black line on the $A-V$ graph instead of the purple one, thus lowering its energy! This is only possible because of the unusual concavity of the graph, which in turn was caused by the weird dip in the $p-V$ graph. But what does this mean? When does a gas randomly split into two states? When it condenses into a liquid!

As a gas condenses, the liquid and gas form can coexist. This is precisely the gas becoming inhomogeneous as a means to lower its free energy.

So there you have it. Phase transitions occur because a material can decrease its energy by splitting into an inhomogeneous combination of states rather than smoothly changing its properties. The sudden, mysterious change from a gas to a liquid is a just trick that gases play to take advantage of little bumps in their energy curves!

The image of condensation came from here.