Question: I'm tutoring few students for Chemistry. During the course, I many times use the phrase "Out of these possibilities this one is stable. So it is formed". I get questions like, "How do the molecules know?"

Honestly I don't know. How do the molecules know the future? How do they proceed to form "Most Stable" compound?

**Cross Post:** <https://physics.stackexchange.com/questions/51894/how-do-the-molecules-of-reacting-compounds-proceed-to-form-most-stable-molecul>

Answer: 
Chemical reactions occur because the thermal energy in a substance makes molecules bump into each other, and each time they bump into each other there is some chance for a reaction to take place. This is an oversimplified model, but it suffices to get some intuition for what's going on.

The molecules of course do not "know" that some configuration is more stable than others. What happens is that the molecules react randomly, again and again; they take a sort of random walk through the available configurations. Every now and then, a molecule will purely randomly find its way into the stable state. Once it's there, it's "stuck" - it has a much smaller chance of getting out of the stable state. That's more or less what it means for a state to be stable.

Over time, more and more molecules will find their way into the stable state and get stuck, so the result looks as if the molecules "knew" which state to go to and just went straight there. But actually they only got there through the process of randomly bouncing around the configuration space, plus the stable state acting as a trap that molecules can enter but not (as easily) leave.
Clearly, molecules are not in any sense volitional agents. They're simply subject to the basic and immutable laws of thermodynamics, the second of which states that any isolated system always spontaneously develops toward a state of equilibrium in which entropy (which can be informally described as "disorder" or "randomness," meaning thermal energy distributed in such a way that it cannot be used to perform useful work) is maximized. Increased stability is really another term for the minimization of free energy, i.e., energy available to perform useful work. All irreversible spontaneous chemical reactions are ones in which the free energy change is negative, either because the chemical reagents involved experience an increase in entropy, or because the thermal energy released by the reaction sufficiently increases the entropy of the surroundings. The basic, simplified equation for describing this situation is:

$$\ce{\Delta G\ =\ \Delta H\ -\ T\Delta S}$$

Where $\small\ce{\Delta G}$ is the change in free energy, $\small\ce{\Delta H}$ is enthalpy (change in heat energy), $\small\ce{T}$ is absolute temperature, and $\small\ce{\Delta S}$ is the change in entropy. If $\small\ce{\Delta G}$ is negative for a particular reaction at a given temperature, the reaction will proceed spontaneously. In essence, the entire universe is evolving toward a state in which entropy is maximized and free energy is minimized, and only chemical reactions which contribute to that phenomenon can spontaneously take place.