A change is said to occur reversibly when it can be carried out in a series of infinitesimal steps, each one of which can be undone by making a similarly minute change to the conditions that bring the change about. For example, the reversible expansion of a gas can be achieved by reducing the external pressure in a series of infinitesimal steps; reversing any step will restore the system and the surroundings to their previous state. Similarly, heat can be transferred reversibly between two bodies by changing the temperature difference between them in infinitesimal steps each of which can be undone by reversing the temperature difference.
The most widely cited example of an irreversible change is the free expansion of a gas into a vacuum. Although the system can always be restored to its original state by recompressing the gas, this would require that the surroundings perform work on the gas. Since the gas does no work on the surrounding in a free expansion (the external pressure is zero, so PΔV = 0,) there will be a permanent change in the surroundings. Another example of irreversible change is the conversion of mechanical work into frictional heat; there is no way, by reversing the motion of a weight along a surface, that the heat released due to friction can be restored to the system.

These diagrams show the same expansion and compression ±ΔV carried out in different numbers of steps ranging from a single step at the top to an "infinite" number of steps at the bottom. As the number of steps increases, the processes become less irreversible; that is, the difference between the work done in expansion and that required to re-compress the gas diminishes. In the limit of an ”infinite” number of steps (bottom), these work terms are identical, and both the system and surroundings (the “world”) are unchanged by the expansion-compression cycle. In all other cases the system (the gas) is restored to its initial state, but the surroundings are forever changed.
It should go without saying, of course, that any process that proceeds in infinitesimal steps would take infinitely long to occur, so thermodynamic reversibility is an idealization that is never achieved in real processes, except when the system is already at equilibrium, in which case no change will occur anyway! So why is the concept of a reversible process so important?
The answer can be seen by recalling that the change in the internal energy that characterizes any process can be distributed in an infinity of ways between heat flow across the boundaries of the system and work done on or by the system, as expressed by the First Law of thermodynamics

Each combination of q and w represents a different pathway between the initial and final states. It can be shown that as a process such as the expansion of a gas is carried out in successively longer series of smaller steps, the absolute value of q approaches a minimum, and that of w approaches a maximum that is characteristic of the particular process. Thus when a process is carried out reversibly, the w-term in Equation has its greatest possible value, and the q-term is at its smallest. These special quantities and (which we denote as and pronounce “q-reversible”) have unique values for any given process and are therefore state functions.
Work and Reversibility
Changes in entropy (), together with changes in enthalpy (), enable us to predict in which direction a chemical or physical change will occur spontaneously. Before discussing how to do so, however, we must understand the difference between a reversible process and an irreversible one. In a reversible process, every intermediate state between the extremes is an equilibrium state, regardless of the direction of the change. In contrast, an irreversible process is one in which the intermediate states are not equilibrium states, so change occurs spontaneously in only one direction. As a result, a reversible process can change direction at any time, whereas an irreversible process cannot. When a gas expands reversibly against an external pressure such as a piston, for example, the expansion can be reversed at any time by reversing the motion of the piston; once the gas is compressed, it can be allowed to expand again, and the process can continue indefinitely. In contrast, the expansion of a gas into a vacuum () is irreversible because the external pressure is measurably less than the internal pressure of the gas. No equilibrium states exist, and the gas expands irreversibly. When gas escapes from a microscopic hole in a balloon into a vacuum, for example, the process is irreversible; the direction of airflow cannot change.
Because work done during the expansion of a gas depends on the opposing external pressure (), work done in a reversible process is always equal to or greater than work done in a corresponding irreversible process: . Whether a process is reversible or irreversible, the first law of thermodynamics holds. Because is a state function, the magnitude of does not depend on reversibility and is independent of the path taken. So

Work done in a reversible process is always equal to or greater than work done in a corresponding irreversible process:

In other words, ΔU for a process is the same whether that process is carried out in a reversible manner or an irreversible one. We now return to our earlier definition of entropy, using the magnitude of the heat flow for a reversible process (qrev) to define entropy quantitatively.

For a process that reversibly exchanges a quantity of heat with the surroundings, the entropy change is defined as

This is the basic way of evaluating ΔS for constant-temperature processes such as phase changes, or the isothermal expansion of a gas. For processes in which the temperature is not constant such as heating or cooling of a substance, the equation must be integrated over the required temperature range, as discussed below.
Entropy is an extensive quantity; that is, it is proportional to the quantity of matter in a system; thus 100 g of metallic copper has twice the entropy of 50 g at the same temperature. This makes sense because the larger piece of copper contains twice as many quantized energy levels able to contain the thermal energy.
for an Isothermal Expansion (or Compression)
As a substance becomes more dispersed in space, the thermal energy it carries is also spread over a larger volume, leading to an increase in its entropy. Because entropy, like energy, is an extensive property, a dilute solution of a given substance may well possess a smaller entropy than the same volume of a more concentrated solution, but the entropy per mole of solute (the molar entropy) will of course always increase as the solution becomes more dilute.
For gaseous substances, the volume and pressure are respectively direct and inverse measures of concentration. For an ideal gas that expands at a constant temperature (meaning that it absorbs heat from the surroundings to compensate for the work it does during the expansion), the increase in entropy is given by

Note: If the gas is allowed to cool during the expansion, the relation becomes more complicated and will best be discussed in a more advanced course.
Because the pressure of an ideal gas is inversely proportional to its volume, i.e.,

we can easily alter the above equation to express the entropy change associated with a change in the pressure of an ideal gas:

Also the concentration for an ideal gas is proportional to pressure

we can expressing the entropy change directly in concentrations, we have the similar relation

Although these equations strictly apply only to perfect gases and cannot be used at all for liquids and solids, it turns out that in a dilute solution, the solute can often be treated as a gas dispersed in the volume of the solution, so the last equation can actually give a fairly accurate value for the entropy of dilution of a solution. We will see later that this has important consequences in determining the equilibrium concentrations in a homogeneous reaction mixture.
The Relationship between Internal Energy and Entropy
Because the quantity of heat transferred () is directly proportional to the absolute temperature of an object () (), the hotter the object, the greater the amount of heat transferred. Moreover, adding heat to a system increases the kinetic energy of the component atoms and molecules and hence their disorder (). Combining these relationships for any reversible process,

and

Because the numerator (qrev) is expressed in units of energy (joules), the units of ΔS are joules/kelvin (J/K). Recognizing that the work done in a reversible process at constant pressure is

we can express as follows:

Thus the change in the internal energy of the system is related to the change in entropy, the absolute temperature, and the work done.
To illustrate the use of Equations, we consider two reversible processes before turning to an irreversible process. When a sample of an ideal gas is allowed to expand reversibly at constant temperature, heat must be added to the gas during expansion to keep its T constant (Figure ). The internal energy of the gas does not change because the temperature of the gas does not change; that is, ΔU = 0 and qrev = −wrev. During expansion, ΔV > 0, so the gas performs work on its surroundings:

According to Equation, this means that must increase during expansion; that is, the gas must absorb heat from the surroundings during expansion, and the surroundings must give up that same amount of heat. The entropy change of the system is therefore

and the entropy change of the surroundings is

The corresponding change in entropy of the universe is then as follows:

Thus no change in ΔSuniv has occurred.

In the initial state (top), the temperatures of a gas and the surroundings are the same. During the reversible expansion of the gas, heat must be added to the gas to maintain a constant temperature. Thus the internal energy of the gas does not change, but work is performed on the surroundings. In the final state (bottom), the temperature of the surroundings is lower because the gas has absorbed heat from the surroundings during expansion.
Now consider the reversible melting of a sample of ice at 0°C and 1 atm. The enthalpy of fusion of ice is 6.01 kJ/mol, which means that 6.01 kJ of heat are absorbed reversibly from the surroundings when 1 mol of ice melts at 0°C, as illustrated in Figure . The surroundings constitute a sample of low-density carbon foam that is thermally conductive, and the system is the ice cube that has been placed on it. The direction of heat flow along the resulting temperature gradient is indicated with an arrow. From Equation, we see that the entropy of fusion of ice can be written as follows:


By convention, a thermogram shows cold regions in blue, warm regions in red, and thermally intermediate regions in green. When an ice cube (the system, dark blue) is placed on the corner of a square sample of low-density carbon foam with very high thermal conductivity, the temperature of the foam is lowered (going from red to green). As the ice melts, a temperature gradient appears, ranging from warm to very cold. An arrow indicates the direction of heat flow from the surroundings (red and green) to the ice cube. The amount of heat lost by the surroundings is the same as the amount gained by the ice, so the entropy of the universe does not change.
In this case,

The amount of heat lost by the surroundings is the same as the amount gained by the ice, so

Once again, we see that the entropy of the universe does not change:

In these two examples of reversible processes, the entropy of the universe is unchanged. This is true of all reversible processes and constitutes part of the second law of thermodynamics: the entropy of the universe remains constant in a reversible process, whereas the entropy of the universe increases in an irreversible (spontaneous) process.
As an example of an irreversible process, consider the entropy changes that accompany the spontaneous and irreversible transfer of heat from a hot object to a cold one, as occurs when lava spewed from a volcano flows into cold ocean water. The cold substance, the water, gains heat (q > 0), so the change in the entropy of the water can be written as ΔScold = q/Tcold. Similarly, the hot substance, the lava, loses heat (q < 0), so its entropy change can be written as ΔShot = −q/Thot, where Tcold and Thot are the temperatures of the cold and hot substances, respectively. The total entropy change of the universe accompanying this process is therefore

magnitude but opposite in sign. Whether ΔSuniv is positive or negative depends on the relative magnitudes of the denominators. By definition, Thot > Tcold, so −q/Thot must be less than q/Tcold, and ΔSuniv must be positive. As predicted by the second law of thermodynamics, the entropy of the universe increases during this irreversible process. Any process for which ΔSuniv is positive is, by definition, a spontaneous one that will occur as written. Conversely, any process for which ΔSuniv approaches zero will not occur spontaneously as written but will occur spontaneously in the reverse direction. We see, therefore, that heat is spontaneously transferred from a hot substance, the lava, to a cold substance, the ocean water. In fact, if the lava is hot enough (e.g., if it is molten), so much heat can be transferred that the water is converted to steam (Figure ).

Summary
During a spontaneous process, the entropy of the universe increases.

A reversible process is one for which all intermediate states between extremes are equilibrium states; it can change direction at any time. In contrast, an irreversible process occurs in one direction only. The change in entropy of the system or the surroundings is the quantity of heat transferred divided by the temperature. The second law of thermodynamics states that in a reversible process, the entropy of the universe is constant, whereas in an irreversible process, such as the transfer of heat from a hot object to a cold object, the entropy of the universe increases.
When molten lava flows into cold ocean water, so much heat is spontaneously transferred to the water that steam is produced.

