[MUSIC] We learned that the governing thermodynamic potential of the closed isolated system is the entropy s, given as s of u, v, and m. That is the control or canonical variables are the internal energy, volume, and the number of particles. However, the closed isolated system is only one possible thermodynamic system. In many instances it is desirable to have different control variables where we replace one or more of the extensive variable with their conjugate intensive variables. For convenience, we start with the equation of state u of s, v, and n. Remember, that from our definitions, the extensive variables and their conjugate intensive variables are related through the following relationship. A thermodynamic ensemble is defined by the canonical variables of the system. Now changing from one ensemble to another simply amounts to shifting from one thermodynamic potential to another that depends on the new canonical variables. It turns out that replacing an extensive variable for its conjugate intensive variable is effectively replacing the control variable with the slope of the control variable. Now this is a deep concept, and we'll illustrate this with an example so that you can gain some intuition about this. The mathematical method of performing this change of variables is called the Legendre transform. Now let's consider the following steps. Let's take a function y given by f(x) which is defined as a list of x and y pairs, that is the plot of y of x graphs (x1, y1), (x2, y2), (x3, y3), and so on. Now, equivalently, it's possible to express the same information in terms of the tangent slope c of x on the corresponding y-intercepts b, that is the points (c1, b1), (c2, b2), (c3, b3), and so on. Now for a small change dx in the x variable, the corresponding change dy is given by. Now from this point on the curve, we can extend a line back to x equals 0 to find the y-intercept b of x such that. Now the resulting function for the series of intercepts versus the slope, that is b as a function of c, that is b of c, contains the same information as y equals y of x. Now let's say we're interested in a change in the intercept b of c. Now, this is given by. Now this is still quite abstract. Let's consider a simple example. Let's consider the following function, y = (x- 2) square. Now, let's apply the Legendre transform to shift the variable from x to the slope c. The slope of the function is simply given by twice (x- 2), that is c is equal to twice (x- 2). Now, this gives us a way to relate the variable x to the variable c. Now the Legendre transform gives us a new function, b of c, which is simply given by. Now let's take the derivative of the Legendre transform function, and we find that it correctly relates back to the original function. Now, all of the thermodynamic potentials that define specific ensembles are Legendre transforms of the original potential, say the internal energy, u of s, v, and m. Now, let's transform the entropy, s, to the conjugate intensive variable temperature, t, to gain the closed isothermal ensemble. Now this gives us a new quantity that is given as the internal energy minus the temperature times the entropy. Now this quantity is defined as the Helmholtz free energy. Now, let's take the next example of phase equilibrium. Consider a closed isothermal system, which contains a fluid that has a liquid and a vapor. In order to describe the phase equilibria, you need a description of the equation of state for the vapor and the liquid. A popular model is to use the van der Waals equation of state. This model has two key corrections from the well known ideal gas equation, given as PV equals nRT. The microscopic intuition for this is to challenge two assumptions made in the ideal gas. We assume that an ideal gas occupies no volume, and that the molecules don't interact with each other. On the other hand, the van der Waals gas accounts for corrections that relaxes these two assumptions. Now, there is a constant b that is added, that represents the excluded volume of the molecules in the system. Now, another constant, a, is added, which determines the strength of the two-body attractive interactions between the molecules in the system. Now this equation can be written in a dimensionless form. Now this dimensionless form reduces the number of parameters to capture the temperature dependence. Only a tilde now depends on the temperature. Now our goal is to find the limit of stability of each phase, the conditions where the phases coexist, and the properties of the two phases in coexistence. The simple example of phase coexistence demonstrates the essential issues at work in more complex multi-component and multi-phased systems. Now let's consider a plot of the pressure as a function of volume for the van der Waals fluid for a given A tilda value. Now, this consists of three regions. At large volume we get the vapor phase, and at very low volume we get the liquid phase. In between there emerges a region where the slope of the pressure versus volume curve is positive. Now this is in violation of the second law of thermodynamics. Now a way around this violation is the emergence of phase coexistence. Now these set the limit of the stability of the pure single phases. Now how we do find the properties of the coexisting phase? Now clearly at equilibrium the chemical potential of the vapor phase is equal to the chemical potential of the liquid phase. In addition, mechanical equilibrium requires the pressure of the liquid phase is equal to the pressure of the vapor phase. Now let's call this the coexistence pressure. One intuitive way to think about this is that the energy that goes into making the vapor phase is compensated by the energy that is given up by the liquid phase. This implies that the coexistence pressure is set such that the area under the PV curve in these two regions are exactly equal. Now this technique is known as the Maxwell's construction technique. And this provides a way to determine the coexistence pressure of a vapor liquid equilibrium. Now the phenomenon of phase coexistence is extremely crucial in general. This finds applications in many important areas. Now in this module, we studied classical thermodynamics and the first and second laws of thermodynamics. Now from the second law of thermodynamics, we derived conditions for equilibrium. Now we introduced the concept of thermodynamics ensembles. And moving from one ensemble to another is a simple change of variables that is equivalent to the mathematical technique of Legendre transforms. Finally, we explored the idea of phase equilibrium and showed a technique to identify the coexistence pressure of a vapor liquid equilibrium.