According to the first law of thermodynamics, the energy change in a system is equal and opposite to the energy change of the surroundings.
When an ice cube, the system, is added to a cup of hot tea, the surroundings, the ice melts while the tea becomes cooler. The heat gained by the ice cube is equal to the heat lost from the tea. Energy is conserved no matter the direction of heat transfer.
However, adding an ice cube would never make the tea hotter because the amount of heat transferred does not determine which way the heat flows.
The associated change in entropy must be considered to explain the direction of heat transfer and other spontaneous reactions.
The second law of thermodynamics states that the entropy of the universe, which is the total entropy of both the system and surroundings, increases for all spontaneous processes. This means that the ΔS of the universe, the difference between the entropy of the universe’s final and initial states, must be greater than zero.
As entropy is a measure of energy dispersal, a process where the energy of the universe is more dispersed in the final state than in the initial will be spontaneous.
When an ice cube melts, the water molecules change from an ordered solid to a more disordered liquid state with a positive change in the entropy of the system; when water freezes into ice, the ΔS of the system is negative.
However, for these processes to be spontaneous, the entropy of the universe must increase, so the difference between whether these processes are spontaneous must be in the surroundings.
When water freezes, it releases heat to the surroundings, increasing the energy dispersal of the surroundings. The ΔS of the surroundings must be positive and greater in magnitude than the ΔS of the system for the ΔS of the universe to be positive.
Pure water will only freeze spontaneously at temperatures below 0 °C. This is because the heat transferred to the surroundings at low temperatures will result in a greater change in entropy than the same heat transferred at higher temperatures.
The magnitude of ΔS of the surroundings is directly proportional to the heat transferred by the system and inversely proportional to the temperature T.
Thus, for any process occurring at a constant temperature and pressure, the ΔS of the surroundings is equal to the heat transferred to the surroundings, divided by the temperature in kelvin.