dU = dq + dw , or

U_{2} - U_{1} = q + w

where

Note that matter does not "contain" heat; heat is, itself, a flow. Heat only exists where there are temperature differences. The thermal state of a body can be characterized by its temperature, and we may say that the material constituting the body possesses internal energy, which in turn is manifested as the kinetic energy (of vibration, rotation and translation), and the potential energy (energy defined by position of a body in a field) of the constituent atoms/molecules.

The equation for the first law shows that

the internal energy of a body decreases.

The Second Law

After many years of teaching graduate level thermodynamics, I have found that the equation

dS __>__ dq/T :the
second
law of thermodynamics

causes more pedagogic problems than any other equation. How can the second law be interpreted? This equation can be used to distinguish between the irreversible and reversible paths (processes) that lead from an initial state to a final state.

As an example, let's consider a
simple process involving the air in a bag of pretzels which is near room
temperature and at or
below sea-level atmospheric pressure (under
these conditions, the air in the bag behaves nearly as an ideal gas).
Assume the bag
is sitting in the back seat of a field vehicle. We
will first
allow the bag of air to expand isothermally
(constant temperature) and reversibly. We will lower the
external pressure
*continuously* by, say, driving the vehicle containing the bag of
pretzels up a 10,000 ft
mountain pass (with the windows open just enough to allow
equilization
of pressure; however, we can still maintain a constant temperature in the
truck with a good climate control system). The gas in the bag
expands reversibly and isothermally as we ascend the mountain. (If you
have every driven over a mountain pass with an unopened bag of pretzels
[low fat] in a climate [temperature]-controlled car, you have done this
experiment)! Performing a process "reversibly" means that the process can
be reversed if we
reverse our direction by even an infinitesimal amount (i.e., as we
ascend with our ever-so-slowly expanding bag of preztels, we
might
(gently!) allow the vehicle to roll back down the mountain a few feet).
The bag of pretzels then shrinks by an
infinitesimal amount...as we again begin to inch forward and upward,
the bag expands back - *
this is reversibility.* A

Now, an expanding gas tends to cool i.e., its temperature drops (this
does *not* mean that heat flows out of it!),
because work is done by the air in the bag (which is our "thermodynamic
system"). The air, still sealed in the bag, pushes against its surroundings (the air in the truck, and indeed, the "rest"
of the entire universe!), causing the
plastic bag to increase in volume and strain its seams as the
surroundings are pushed back (pdV>0). However, if we examine the
thermal budget of the bag, we see that the system is isothermal
ONLY because the "temperature bath"
(the air in the truck) is constantly supplying
heat
to the system *because * with each infinitesimal
increment of expansion, the *tendency* is for the temperature of the
gas in the bag to decrease by dT. This constant infusion of heat during
expansion of the gas
KEEPS the temperature of the gas in the balloon-like bag constant, and the
same as
the
temperature of the surrounding air in the truck. Ok, got the picture?
This is the
reversible path - it is important to us because the system never deviates
by more than an infinitesimal amount from an equilibrium state.

Time for the plot to thicken...now we will transport our bag of snacks to the top of the mountain in a rigid, air-tight container (to hide the last bag of pretzels from their ever-ravenous advisors, the grad students hide it in the pot used to cook last night's chili - given how well Mark Frank and Matt Hall wash pots, the top is now hermetically sealed to the pot, and the pot now acts as a rigid container for whatever is sealed inside (we could also discuss the expansion of gases inside the now happy anaerobic bacteria, but that is another story {and one I only relate when there is a bottle of Pepto-Bismol nearby}). So now, the pressure in the pot (and in the bag of pretzels) is maintained at the pressure of the valley (from the night before, when the pot was "washed" by the grad students); furthermore, the pot is wrapped in my sleeping bag to keep the booty from my dog Timbre, who would otherwise be likely to destroy the thermodynamic system). The sleeping bag insulates the bag of pretzels, and renders the system ADIABATIC (i.e. no heat can flow in or out of the bag, even if the temperature of the bag changes).

As we approach the mountain top, the
cover happens to pop off the pot, exposing the system to the low
pressure mountain air, but NO heat is
exchanged because the now rapidly and IRREVERSIBLY inflating bag is still
wrapped in the sleeping roll. *Without its temperature bath*, the
expanding bag DOES cool* somewhat (i.e., experience a decrease in
temperature)* as it expands (as the gas in the bag does work
on the surroundings, internal energy ,U, measured solely by temperature in
the case of an ideal gas, is converted into P-V work) but NOW all the
expansion occurs against the SIGNIFICANTLY diminished external pressure!
Work is always done against an opposing force, and in the latter case, ALL
expansion work is done against this constant low pressure, as opposed to
the reversible case, where the gas ALWAYS expands against the MAXIMUM
POSSIBLE pressure that would allow expansion at every step! that means
that the gas does less work in this, the irreversible case. If we now
extrapolate the results of this irreversible case to a very high
mountain (e.g., K-2) where the pressure is extremely low, and beyond, we
can see that the gas
would expand without doing any work when the opposing pressure is zero.
There would be NO
expansion work (because of the vanishingly low external (opposing)
pressure), NO heat flow (because the system is adiabatic) and therefore no
change in U. For an ideal gas, no change in U means no change in T
(all internal energy in an ideal gas is kinetic; there are no
forces among the molecules, so there is NO potential energy among the
molecules). That is, the
irreversible limiting case "free" expansion of an ideal gas (adiabatic
expansion against a zero pressure) is ISOTHERMAL, and can have the same
initial and final state as the REVERSIBLE ISOTHERMAL expansion!

The Punch Line

What we can say is that q/T for the reversible case is > q/T for the irreversible case. This is the second law. We define q/T (reversible) = delta S = S2 - S1, where S is the entropy. Then, for an irreversible case, (such as the expansion of a gas into a vacuum, which is basically what happens to a bag of pretzels that is suddenly exposed to the atmospheric pressure of, say, the Himalayan mountain K-2), delta S > q/T (irreversible). The expansion of a gas into a vacuum (or against a finitely lower pressure) is a NATURAL, SPONTANEOUS, and IRREVERSIBLE process. SO, we now have an INDEX that tells us when we are dealing with such a process - evaluate the entropy of the initial and final state, evaluate the heat, q, (paying attention to the sign) in going from state 1 to state 2, and divide the q by T (in Kelvins). If delta S > q/T, the process is irreversible (i.e. the natural direction for the process, since all real processes are irreversible; If delta S = q/T, the process is reversible (and therefore states 1 and 2 are in equilibrium with other);If delta S < q/T, this is the REVERSE of the spontaneous, irreversible process (e.g., all the air inside the vehicle spontaneously rushes into the pretzel bag, killing all of the vehicle's occupants). Thankfully, this is an impossible process, and *that's* what delta S < q/T indicates.

we can rearrange the equation:

__/\__S __>__q/T

into the form:

which, given q = __/\__H (at constant pressure)
is, essentially,the equation

so, to do simple delta G calculations, we, paradoxically, are not required to introduce the concept of free energy. I discuss this problem more under "chemical potential", which is the next concept discussed in the online textbook.

Note: to fully understand the second law, the students need to understand the difference between a reversible and irreversible Carnot Cycle, which contain reversible and irreversible adiabats, respectively. I ALWAYS discuss the Carnot Cycle in my geological thermodynamics class, and I think it lamentable that instructors now commonly leave consideration of it out...is it because they never fully understood the significance of the Carnot Cycle themselves?

The first law for an adiabatic (q=0) expansion is dU = dw. In the case of an ideal gas expanding against a steadily decreasing pressure (e.g. parcel of air rising adiabatically on a summer day) , the gas does work (expands against an opposing pressure), and the source of the energy is the internal energy of the gas, which is closely related to the temperature of the gas. So, the gas expands and hence cools. Irreversibility tends to reduce the magnitude of the temperature decrease. For an ideal gas, the reversible adiabat is derived from: dE = dw --> CdT = -PdV, where C = heat capacity at constant volume, P = pressure, V=volume. dG is equal to dH - TdS. The "d"s may be interpreted as deltas or as differential operators. Note that this equation follows directly from the combined first and second laws, and is not really a new equation (in fact if you go back to the masterful work of JW Gibbs, (ca. 1878), you will find that this equation is relegated to minor status; chemical potential, U, S, T, P , and unit of quantity were considered by him to be more fundamental - G was called an "Auxiliary Function" { also watch out - he used different symbols for these quantities}). Also, dS = dH/T is ONLY for constant pressure because dq = dH + VdP, and the fundamental equation is dS = dq/T. This equation can certainly be used concurrent with reversible changes in pressure (Even Gibbs give the equation: dH = TdS + VdP for reversible processes).