Entropy is a function that describes the direction for spontaneous processes
The first law of thermodynamics is a statement of energy conservation.
Energy = heat + work
Work can be many things: electrical work, elastic work, kinetic energy of your car. It is relatively easy to convert work into heat (for example when you apply the brake in a car). On the other hand, converting heat into work is not so easy. Engines can do this but their efficiency is far from 1. Heat and work are both forms of energy, but they are not the same. We could say that converting work into heat is often a spontaneous process. However, converting work into heat is not spontaneous. So what determines whether a process is spontaneous? The fact that a process produces heat is not sufficient to guarantee that the process will be spontaneous. There are examples of chemical reactions that are endothermic and yet spontaneous. The solvation of potassium nitrate (KNO3) is one such example.
There is no work done during an expansion against a vacuum, dU =
d q = d w = 0 and yet this is a spontaneous expansion. Such a process is not reversible. It proceeds at very high speed (> speed of sound). No work is done if two gases are allowed to mix and yet mixing is a spontaneous process.We need a new state function to describe spontaneity.
How do we obtain such a state function? First let's review reversible processes that we have already introduced. A reversible process can be depicted as occuring through a series of states of rest. In other words the system responds faster than you change it. For gases you must stay under the speed of sound.
For a reversible change we can write the first law as:
dU =
d qrev +d wrev.or
d
qrev = dU - d wrev.For an ideal gas U only depends on temperature U(T) so dU = CV dT, and the only work is volume work -PdV
d
qrev= CV dT + (nRT/V) dVd
qrev is not state function. Look at the cross differentiation:
Since the second cross derivatives are not equal the function we have chosen (heat) is not an exact differential. A state function must be an exact differential. The second cross derivatives must be equal. The culprit is the T in the work term. Let’s get rid of it by dividing by T:
d
qrev/T = (CV/T) dT + (nR/V) dVNow the cross derivatives are both zero. That means the qrev is not a state function, but qrev/T = S is a state function, the entropy and it is written as dS =
d qrev/T Of course we only showed it for an ideal gas, but this can be shown for all systems.Because our new function S is a state function it should remain the same when you return to the same state, say along a cycle:
![]()
Let’s look at a cycle: the Carnot cycle. It is a series of four changes of a gas in a cylinder, all reversible. The purpose of the cycle is to get work out of heat, but we will see that that is not so easy.
A hot, compressed gas is allowed to expand
1) first isothermally: dU = 0, so
d q1 = -d w1 V1® V2 (We pick up some heat)2) then adiabatically, so
d q=0 therefore dU = d w2 V2® V3In this step we get work out of the expanding gas, but it gets cold Thot
® TcoldTo close the cycle we must compress the gas:
3) first isothermally dU = 0, so
d q3 = -d w3 V3 ® V4 (We discard some heat)4) then adiabatically, so
d q=0 therefore dU = d w4 V4 ® V1In the last step we must invest some work to close the cycle. The temperature goes back up: Tcold
® ThotWe are dealing with four
d w’s but only two d q’s. Likewise, we are dealing with four volumes but only two temperatures. Using our knowledge of adiabats we can say a bit more about the volumes because on the two adiabats we have:Step 2) Tcold/Thot = (V2/V3)
gStep 4) Tcold/Thot = (V1/V4)
gEquating and rearranging we get: (V4/V3) = (V1/V2)
This allows us to say more about the two heats
d q1 and d q3:Because they happen on isotherms we have:
d
q1 = -d w1 = ì +PdV = nRThotln(V2/V1)d
q3 = -d w3 = ì +PdV = nRTcoldln(V4/V3) = - nRTcoldln(V2/V1)The net heat we pick up therefore is:
d
qtot = nRThotln(V2/V1) - nRTcoldln(V2/V1) = - n.RD T ln(V2/V1)Because we are doing a cycle dUtot is zero so the work we get out must be:
d
wtot = +nRD T ln(V2/V1)Regarding our new state function S we see that the only difference between
d q1 and d q3 is the temperature factor. So if we divide that out:d
q1/Thot + d q3/Tcold = nRln(V2/V1) - nRln(V2/V1) is indeed zero, so dS=0 just like dU and we could have used that to do our bookkeeping.It also means that
d qhot/d qcold = - Thot/TcoldThis has a number of important consequences. First of all if
D T=0 no work can be extracted from the system. So for an engine to work you must have both a hot and a cold reservoir. Secondly we can use the qhot/qcold ratio to define the thermodynamic temperature scale. Thirdly you can never get all the energy you pick up as heat at the hot end out as work. Look at d w/d qhot: =D T/Thot. This would only be 100% if D T=Thot, i.e. if Tcold = 0K (which incidentally reconfirms that the temperature scale must have an absolute zero).The original function of the Carnot cycle was that of a steam engine, where you use a fossil fuel to create a hot reservoir and a condenser as the cold one. We can also look at the internal combustion engine of your car as a Carnot cycle (where you burn a fuel inside the cylinder instead of outside).
The important consequence of S being conserved is that the efficiency of work obtained from heat is never 100%. We always have
heat(in)
® work(out) + heat(wasted)So
h
= work(out)/heat(in) <100%The other way around (dissipation w
® q) is easily 100%. We can even obtain more heat energy than the work, if we run the cycle in reverse:heat(out)
¬ work(in) + heat(picked up)In this case heat(out) /work(in)=[heat(picked up) + work(in)]/work(in) is >100%.!
This is the principle of a heat pump, where you use electrical energy (work) to pump heat from outside into your house. You get all the electrical kilojoules as heat plus the heat you pump. A refrigerator is also a heat pump: you always heat up your room more than you cool down the inside of your fridge.
Spontaneity
By putting in some work we can make heat flow from cold to warm, instead of what it does spontaneously (the other way). That means that S is indeed the key to the question of spontaneity.
Say, we have two identical bricks with the same heat capacity but different temperatures: T=500K and T=300K. Brought in contact they will both achieve a final T of 400K and an amount of heat of |q| = Cv
DT = Cv100. Joule will have left brick one (q1=-|q|) and entered the other (q2=+|q|)What happens to S?
Well
D S = -|q|/500 + |q|/300 = 2Cv/15 > 0So for a spontaneous process S increases! This is (one formulation of) the Second Law of Thermodynamics:
For an isolated system:
Spontaneous process:
D S > 0. At rest: D S = 0Clausius called the function S the entropy and summarized the 1st and 2nd law:
I. The energy (U) of the universe is constant
II. The entropy (S) of the universe tends toward a maximum
Can you never make S go down? Yes you can, but not for an isolated system. If your system is not isolated, Ssystem can go down, but at the cost of Srest of universe going up either the same amount (reversible case) or even more (spontaneous case).
Reversible process:
D
Stotal = 0 ® D Ssystem = -D SsurroundingsIrreversible process:
D
Stotal > 0 ® D Ssystem > -D Ssurroundings or -D Ssystem < D SsurroundingsThis means that to calculate the entropy change
D Ssystem from state 1 to state 2 of a system, it does not matter in principle whether we take a reversible path or not. After all S is a state function. However, the bookkeeping is a lot easier if you take the reversible path, because D Ssystem = -D Ssurroundings and we can use dS = qrev/T.Practical Calculation of Entropy
We begin our discussion with an ideal gas. However, the same principle applies to real gases with modifications in the work (from the pressure function) or the heat capacity.
Reversible isotherm
dU = 0
d
q = - d wd
w = -nRT ln(V2/V1)D
S= +nR ln(V2/V1)Reversible adiabat
d
q= 0D
S= 0Reversible isochor V = constant
d
w = -PdV = 0d
qrev = CVdTD
S =ì CV/T dT = Cv ln(T2/T1)Reversible isobar P = constant
D
S= Cp ln(T2/T1)Let’s examine the expansion against vacuum from V1 to V2. It happens at constant temperature and dU,
d q and d w are all zero. What is D S? Surely not zero because the process is spontaneous. We can calculate D S by expanding the gas reversibly and isothermally then D S = nRln(V2/V1). The entropy change must be the same in both cases (state function!). That means that against vacuum d q/T = 0 = d qirreversible/T, that is why it is not the same as D S! The expansion against vacuum is not a reversible process because there is no balancing force at work. It proceeds explosively at high speed.This example also demonstrates the Inequality of Clausius:
dS
³ d q/T (dS = d q/T for reversible processes only).The example above of an expansion against vacuum needs clarification. For isothermal processes (expansion or compression) we can define an entropy change for the system and for the surroundings and use these to calculate the total entropy change.
Our prescription for calculating entropy is as follows:
D
S = nR ln(V2/V1)qsurroundings = - qsystem
If the process is reversible then qsystem = -w = nRT ln(V2/V1)
Therefore qsurroundings = - nRT ln(V2/V1) and
DSsurroundings = - nR ln(V2/V1)As you can see for a reversible process
D
Ssurroundings = -DSsystemand
D
Stotal = 0For an irreversible process qsystem = -w = Pext(V2 - V1)
Therefore qsurroundings = - Pext(V2 - V1) and
DSsurroundings = - Pext(V2 - V1)/TAs you can see for a irreversible process
D
Ssurroundings < -DSsystemand
D
Stotal > 0Combining the two laws in one formula
Because for a reversible process we can write:
dU =
d qrev +d wrevand
d qrev = TdSwe can write:
dU = TdS +
d wrevIn the case of a gas we usually only have volume work –PdV, so then we get
dU = TdS –PdV
Although we derived this for a reversible process, U is a state function and so this must hold true for any process.

Likewise we can adapt the enthalpy to:
dH= d(U+PV) = dU + PdV + VdP = TdS –PdV+PdV + VdP
dH = TdS + VdP

So you can find
D S (T1 ® T2) by integrating Cp(T)/T, just like you get D H by integrating Cp(T).(unless you get a melting event or so.)Statistical Entropy
If we distribute N particles over M different boxes (e.g. energy levels) can do that in W different ways, where W (the number of realizations) is
W = N!/(n1!n2!...nM!)
Because we deal with gigantic numbers it is easier to do this logarithmically so let’s take the log of W and use Stirling’s expression lnX!
@ XlnX-X to simplifylnW = lnN! –
S (ln(ni!)@
(NlnN –N) -S [niln(ni) – ni]= (NlnN –N) -
S [(niln(ni)] +N= NlnN -
S [(niln(ni)]We also need he derivative versus ni of lnW

Boltzmann’s ideas
The idea that Boltzmann had is that the reason that entropy tends to increase is simply a matter of doing what is most likely.
E.g. a distribution of our entities such that they are all in the same state ni is very unlikely. W would only be one and lnW=0.
Boltzmann therefore postulated that the entropy is proportional to lnW
So: S = kBlnW
Of course the whole system has only so much total energy and the states may have different energies.
Let’s consider a great many (say Navogadro) systems that all have the same equidistant energy states:
We also assume an average energy Eav so that U= Eav*NAvogadro
How can this be achieved? One ways is to put all systems in the ensemble in the same state:
This can be achieved in exactly W= 1 ways. But we could also put one of the systems in a higher and one in the lower:
If the systems are indistinguishable we can do this in many different ways. This configuration can be achieved in W= N!/(0!0!...1!(N-2)!1!0!)1...) = N(N-1) ways.
If N=Navogadro that’s a big number.
Boltzmann’s idea was that this configuration is much more likely to happen and that the tendency to increase S corresponds simply to achieving the highest likelihood possible given that Etot stays the same. So the second law simply corresponds to maximizing W (or lnW).
One way to rationalize the fact that he chose lnW for his definition is that if you add two ensembles together, the entropy should be additive, but Wtot=W1.W2. Taking the log fixes that. (But this is really very superficial)
We really need to ask the question how do we distribute the energies of the individual systems such that W (or lnW) is maximized given that the number of systems is constant and the total energy too.
For lnW to be max dlnW must be zero (set derivative zero)

So W is maximized (the most likely configuration) if the systems assume the Boltzmann distribution!
For an ideal monatomic gas U=3/2nRT (macroscopic) but from the particle in the box partition function, we get U= N(dlnq/d
b ) where
By comparison of the partition function we can relate RT to
b and find that b = kT and R= NavkBIf we heat up this gas at constant volume there is no work, so
dU = dqrev = TdS so dS = k
b dUAlso all that changes is the way the energies
e i are distributed over the same states. (the box in which we have our particles does not change!) so:dU=
S e idnidS = k
b S e idni = kS b e idni
(k
a S dni = 0 because the number of particles doesn’t change.)So yes S should be klnW.
Using Stirling this equates to
S = kNlnN - k
S njlnnj (-kN + kS nj ) (which cancel)We know that the probability that a level j is occupied = pj = nj/N so nj= Npj
S = kNlnN - k
S NpjlnNpjS = kNlnN - k
S Npjlnpj - kS NpjlnNS = kNlnN - k
S Npjlnpj - kNlnNS pjBut
S pj=1 so the first and the last term cancel.S = - kN
S pjlnpj for the ensemble.For one subsystem (e.g. molecule) we have
S = - k
S pjlnpjFrom the partition functions we know that pj = e-
b E/QThis gives us
S = -k
S (e-b E/Q)(-b Ej –lnQ)S =
b kS (Ej e-b E/Q)+ klnQ(S e-b E)/QS= U/T + klnQ
Question: What happens if the box does get bigger as it does in the expansion versus vacuum? You get more energy levels.