Note: calculus, specifically integration, is essential in this article, though students can possibly just substitute it with summation to achieve the same result.

In the previous installation, we defined a temperature scale by looking at the efficiency of a heat engine. However, recall we could also define a temperature scale in the case of an ideal gas via *f*(*P*, *V*, *N*) = *PV*/*N*. How do these two compare?

**7. Optional Interlude: Temperature for an Ideal Gas**

We prepare a homogeneous ideal gas with parameters , constant *N*, whose ideal gas temperature is . Next we subject it to the following cycle:

- Connect the gas to a heat source at temperature . Expand it to .
- Seal the gas adiabatically and expand it further to . Measure the temperature and write it as .
- Connect the gas to a heat source at temperature . Contract it to .
- Seal the gas adiabatically and contract it till we obtain the original parameters .

We call the above sequence a **Carnot cycle**. Recall that two ideal gases at the same temperature satisfies since *N* is constant, and during adiabatic transformation, we have . If we look at the state of the gas throughout the entire transformation, we get the following *P*–*V* graph:

Next, observe that each of the four steps is reversible since each process is either adiabatic or performed at the same temperature as the heat source (a process which occurs at constant temperature is said to be **isothermal**). Since the initial and final states of the gas are identical, *dU* = 0, so the net result is an extraction of heat from the hotter source during the first step, and a deposit of heat into the colder source during the third step, i.e. *it is a reversible heat engine*! Let’s calculate by writing out the equations relating the state parameters.

- since this is isothermal;
- since this is adiabatic;
- since this is isothermal;
- since this is adiabatic.

Multiplying the four relations then gives us , or .

To compute , since step 1 occurs isothermally, there’s no change in the internal energy c·*PV* of the gas (reminder: this is an ideal gas; for a non-ideal gas the internal energy can depend on its volume/pressure even if the temperature is kept constant). So we only need to find the amount of work done:

Likewise . Hence the ratios do match: , so the ideal gas temperature scale is consistent with the thermodynamic temperature up to a scaling factor.

**8. Defining Entropy**

From here onwards, we shall assume that our temperature is the thermodynamic temperature.

Suppose we have a system which is connected to heat sources sequentially, and takes in heat from the heat source . Here, can be negative, in which case the system actually releases heat into the heat source. We shall prove the following.

If the initial and final states of the system are identical, then . Equality holds if and only if the entire process is reversible.

[ Conceptual exercise: since the initial and final states of the system are identical, does that mean the internal energy is unchanged? If so, is the net heat extracted equal to zero? ]

**Proof**. Create a new heat source at some arbitrary temperature *T*. For *i*=1, 2, …, *r* we connect a reversible heat engine between *T* and *T _{i}* such that

- the heat engine takes in heat from
*T*; - it then releases heat into ;
- and converts the balance into work.

When this is performed together with the earlier process, we see that the net transfer of heat into *each of* is zero. On the other hand, the transfer of heat from source *T* is given by:

and all of it is converted into work. Kelvin Law then stipulates that this value must be non-positive. So the result follows. To prove the second statement, if the sum is zero, then the two processes are mutual reverses of each other; conversely, if the process is reversible then so is the concatenation of the two processes, which is the conversion of work into heat. By Kelvin Law again, the only way this can be reversible is when the amount of work converted is zero. ♦

Let’s consider the continuous variant of the above result.

During a small time step, suppose a system absorbs heat dQ from a heat source at temperature T. If the process is reversible and the initial and final states of the system are identical, then

.

This means for any two states *A* and *B* of a system, if we take a reversible process which brings the system from *A* to *B*, then the integral along the path is independent of the process we pick, *as long as it is reversible*. Thus we can define a state parameter S such that , or in differential format, . This is the **entropy** of the system, which is well-defined up to an additive constant.

Example 7. We meet our old friend, the ideal gas with state (*P*, *V*, *N*). What is its entropy? For that, we need to find a reversible process which takes the gas from to , assuming *N* is fixed for now. What better choice than to pick parts of the Carnot cycle?

- For an isothermal process, , where
*Q*is the total amount of heat pumped in. Since the temperature of the system remains constant, so is the internal energy (remember: ideal gas!) and thus all heat is used to do work, i.e. since*P*=*TN*/*V*. This happens when . - For an adiabatic process, since
*dQ*= 0 throughout (the very definition of adiabatic). This happens when .

Putting these together, we can take:

where *t*(*N*) is an additive constant dependent on *N*. We will figure out a more complete expression for this later.

**9. More About Entropy**

One important consequence is that the entropy of an adiabatically sealed system must never decrease. More generally, suppose there’s a process *C* which brings a system from state *A* to state *B* (i.e. the system is now interacting with its environment). Now we construct a *reversible process D* which brings the system from state *B* back to state *A*. If we perform *D* followed by C, then we get:

Since *D* is reversible, the second summand is just *S*(*A*) – *S*(*B*). So we have

.

In the case of an adiabatically sealed system, the left-hand-side is 0, so . This gives the more commonly known variant of the second law of thermodynamics: *the entropy of an adiabatically sealed system tends to increase*. However, we now see that this is actually a consequence – in fact, without Clausius or Kelvin Law, we wouldn’t be able to define a total ordering on the set of temperatures, let alone talk about heat engines or define entropy.

Example 8. This is the quintessential example of an increase in entropy of an isolated system. Suppose heat *Q* flows from an area of higher temperature to an an area of lower temperature . The hotter area thus loses entropy while the colder area gains entropy . Thus, if we only look at the union of these two heat sources, the change in entropy is .

Finally, the **Third Law of Thermodynamics** states that in general, the entropy of a system is non-negative and as , the entropy of the system also tends to 0. In particular, the third law enables us to find the “additive constant” for the formula of entropy.