the shape and form of something is defined by how much energy it has. gas has more energy, therefor it has more space. a solid has low energy, and is there fore compact. when the rock cools, it contracts, and vice versa,
The expansion of rocks when they are heated and contraction of rocks when they are cooled weakens them and eventually breaks them into smaller pieces. This is an example of mechanical weathering.