Homemade salad dressing separates into layers after it sits for a while. Why doesn't this violate the 2nd law of thermodynamics?

The separation does not violate the 2nd law of thermodynamics, because the oil and water phases being separate is a lower energy state.

The water molecules strongly interact with each other, forming hydrogen bonds. The protons of water are shared between two oxygen atoms of two different water molecules, forming a constantly changing network of molecules. Water molecules do not have strong intermolecular interactions with oil molecules.

The more the two phrases are mixed, the more water molecules are at an interface surface. The water molecules at an interface surface can not fully participate in intermolecular interactions with other water molecules, so this is a higher energy state.

For a process to spontaneously occur, the Gibbs free energy (G) must decrease.

$\Delta G = \Delta H-T\Delta S$

So entropy (S) is only part of the consideration. Enthalpy (H) and temperature (T) must also be considered. In this case the decrease in enthalpy (H) due to energy of intermolecular interactions makes up for the decrease in entropy (S). The process is an exothermic process.

Even absent gravity, it is still thermodynamically favorable for the phases to separate, to minimize the interfacial surface area, just like a spherical drop of water being the lowest energy state absent gravity.

I would predict that absent any gravity, the lowest energy state of the salad dressing would be a sphere of water phase surrounded by a spherical shell of oil phase.


DavePhD's answer explains the specifics. The separation decreases the enthalpy of the oil-water mixture. But there's one more step:

When the enthalphy of the dressing decreases by $\Delta H$, it causes the entropy of the dressing and its surrounding environment to increase by $\Delta H / T$.

The reason is: The decrease in enthalpy releases heat, which (slightly) increases the temperature of the dressing, and its container, and the room its in. Higher temperature means more entropy.

So in the bigger picture, it really is increasing the entropy.


Here is an attempt to connect two of the other answers:

The system is the salad dressing, which is in contact with air that forms a heat reservoir at constant temperature $T$ (isothermal). Everything is also at constant pressure $P$ (isobaric). We're comparing the initial, mixed with the final, separated states of the system.


DavePhD states that the demixing occurs because the result has lower energy, which sounds definitive. However, the dressing's loss of energy is the reservoir's gain (by conservation of energy), so the total energy is unchanged, and one might start to feel a bit uncertain.

He then states (correctly) that the change in Gibbs free energy: $$ \Delta G_{sys} = \Delta H_{sys} - T \Delta S_{sys} $$ must be negative for the reaction to proceed spontaneously, noting that "entropy (S) is only part of the consideration". I have added subscripts to indicate that these quantities are the Gibbs free energy, enthalpy, and entropy of the system.

At this point, someone trained to believe that entropy must always increase may be rather befuddled.


Recognizing this potential confusion, SteveB connects this result to the total entropy of the system plus reservoir. For an isothermal, isobaric process, whether or not the system performs work, $\Delta H_{sys}$ is the amount of heat added to the system from the reservoir. Therefore, the change in entropy of the reservoir (not of the system + reservoir) is: $$ \Delta S_{res} = - \frac{\Delta H_{sys}}{T} $$

The change in total entropy $S_{tot}$ is then: $$ \Delta S_{tot} = \Delta S_{sys} + \Delta S_{res} = \Delta S_{sys} - \frac{\Delta H_{sys}}{T} = - \frac{\Delta G_{sys}}{T} $$

So, for an isothermal, isobaric reaction, a decrease in Gibbs free energy of the system is equivalent to an increase in total (system + reservoir) entropy. As expected (hoped for?), spontaneous reactions do indeed increase (total) entropy!

Note that de-mixing is not necessarily spontaneous: the de-mixing process must generate sufficient heat to raise the entropy of the reservoir by more than the decrease in entropy of the system.


Finally, if the process is isobaric but not isothermal, some of the emitted heat raises the temperature (and hence entropy) of the system (as stated by SteveB), so the calculation is no longer so simple. In fact, $ \Delta G_{sys} = 0 $ is no longer the threshold for spontaneous reactions in this condition, because for an infinitesimal, reversible process:

$$ dG = -S \, dT + V \, dP $$

so $dG \ne 0 $ if $dT \ne 0 $. Instead, the change in total entropy must be calculated to determine spontaneity.