Three states of matter are a result of a balance between intermolecular forces and the thermal energy of the molecules. When the intermolecular forces are weak to compensate the thermal energy, the molecules cannot form a closely packed structure and the matter is in the liquid or gaseous phase. The higher difference results in gaseous phase and lesser difference results in the liquid phase. However, when the forces become strong enough, the molecules come close and form a closely packed structure of solid.