 So, the first law of thermodynamics tells us that energy can be broken out into two different forms. When we change the energy, that change has to come either from heat or from work. And the sum of heat and work gives us the total change in the energy of a system. The goal for right now is to spend a little more time focusing on the details of work. So, remember, what we've seen is that work, a differential change in work, comes from changing the energy levels of a system without changing the occupation of those energy levels, without changing the probability that those states are occupied. So, this is the idea of work that we're going to focus a little more attention on. So, if we do some work, it's always done by changing the energy levels. We can think about how we might change the energy levels for a molecule. So, imagine you've got a molecule or a whole bunch of molecules that form some material. There's a lot of different ways you can think about changing their energies, doing work on them. You can take those molecules and I can twist them or stretch them or modify their shape in some way. So, I'm doing mechanical work on them. I might take those molecules and lift them up in a gravitational well so I change their gravitational energy. I can change their electrical energy if I put them next to a charged particle or I put them in an electric field. If the molecules themselves have charges, I've done electrical work. I've changed their energy in that way. However, the case we're going to be more interested in for right now is pressure volume work. If what I have is a gas, even if it's not a gas, but if I have some molecules and I change the volume, if I reduce the volume of the box that contains the molecules, that's going to take me some work. It costs me work to compress the system and change its volume and so that combination of pressure that I exert to change the volume, that's also going to turn out to change the energy levels of the molecules. To see why that's true, let's think about the one case where we can describe the energies in detail at the moment, which is for gas, we can treat a gas with the 3D particle in a box model. That model tells us the energy levels for molecules in a container. If it's a cubic box, box length A, then I can write the energy levels this way. That describes some energy ladder, which I'll draw off to the side over here just as an illustration. Again, in a cubic box, as we've seen before, there's a ground state and there's a triply degenerate excited state and there's a lot of other states that are either triply degenerate or not degenerate or six-fold degenerate and so on. So there's a whole ladder of energy levels for this 3D particle in a box, particle in a cubic box. So that's what the energies look like. And the question we have now is how do I go about changing those energies? If I wanted to modify those energy levels, raise them or lower them in order to do work on the system, how do I do that without changing their occupation levels? So I can't change the mass of the particle. I can't change Planck's constant. I can, however, change the box length of the box that they're confined to. So if I take the box and change the size of the box, change the volume of the box, the length of each one of the dimensions of the box, as let's say I decrease the box length, if I want to make the box smaller, A is in the denominator here, so that causes the energies to go up. So when I decrease the volume, the energies go up. And not just this energy, but every one of the energies has this factor of 1 over A squared out in front of it. So when I decrease the volume of the box, every one of the states has its energies increased. So I can take all these states and lift them all proportionally by changing the size of the box. So what that tells us is the energy levels, each of these energy levels, whether I use n's as my subscript or i's as my subscript, each of my energy levels depends on the volume of the box. What we're interested in understanding, to talk about the work we do on a system that obeys the 3D particle in a box model, is understanding how those energy levels change. If the energies depend on volume, then the change in the energy level is related to the change in volume. So this just says the change in the energy is the rate at which the energy changes when I change the volume multiplied by the change in volume. So I can take this expression and I can substitute it in my equation for the work. So for any system whose energies depend on volumes, dE becomes the derivative of the energy level with respect to volume multiplied by a change in volume summed over all the possible states. Remember, every one of these energy levels is changing when I change the volume. I only change the volume one time, I change the volume by some amount so that dV doesn't need to be inside of the sum. The only thing that needs to be inside the sum is these two terms with the subscript i. So I've got probabilities multiplied by the rate at which energies change as I change the volume inside the sum and I just multiply that whole thing by dV. So the next step is to recall something that we've seen a little while ago, specifically when we were introducing the idea of pressure at the microscopic level. We found that pressure, what pressure means for a microscopic system is pressure is exactly the negative of the rate at which the energy changes as I change the volume. So I'm writing this P as a capital P here to distinguish it from a lower case P for probability. So pressure, the microscopic pressure is defined to be negative dE and dV for an individual microscope and macroscopic pressure, so this is the microscopic pressure, the macroscopic pressure that we would measure at a larger scale, that's just, if I can think about the pressure associated with each one of these individual microstates on the energy ladder, multiply those by the probability that that state is the one that the system occupies, calculating the average in that way tells us the thermodynamic or macroscopic average pressure. So combining all these facts, if I go back to thinking about what the work is equal to, the differential change in the work is some of these probabilities times dE dV, dE dV is the negative of pressure, so this sum is going to look like probabilities times pressures with a negative sign. Let's go ahead and write that out that way, so I can write probabilities times pressures and now I really have a confusion between different P's, so this is lower case P for probability multiplying by a capital P for pressure and I need to introduce a negative sign and then I recognize that the quantity and parentheses, that's just the sum of probabilities times microscopic pressures, that's the macroscopic pressure, so I can write this whole thing as negative macroscopic pressure, the pressure we're used to thinking about times dV. So the equation we've arrived at at this point is the change in work is equal to negative pressure times the change in volume. So what that tells us is an expression without having to think about microscopic energy levels or states, a way to directly compute the amount of work from the pressure of a system and the volume of the system. So that's a useful equation, unfortunately there's one slight caveat we have to discuss about that equation. We have to be extra careful in using this equation, so the topic of the next video lecture actually after I mention one more thing, the topic of the next video lecture will be to explain that caveat. But let me point out before I conclude this video that very often we don't want just the differential change in the work, sometimes we want the actual change in work for a non-infinitesimally small change in work. I don't want to just infinitesimally change the volume of a container, I want to change it by quite a bit. So the way I calculate the finite amount of work is just by integrating the differential dW from state one to state two from beginning to end or initial to final. And since we now have an expression for how to calculate the work we could do that in this way, integrate pdv from one to two. So whether we want the infinitesimally small differential change that we call dW or whether we want the more macroscopic change in work associated with a process, we can now calculate either one of those we want. Again with this caveat that this equation can only be used under certain circumstances and the next video lecture will explain what circumstances those are.