Matter can exist in a solid, liquid or gaseous state, and the state a substance is in can be largely determined by its temperature. When a certain temperature threshold unique to each substance in the universe is crossed, a phase change will result, changing the state of the matter. Under conditions of constant pressure temperature is the primary determinant of a substance's phase. The differential in temperatures and the phases of different kinds of matter allows for the operation of heat engines and refrigerators.
TL;DR (Too Long; Didn't Read)
Temperature has a direct effect on whether a substance exists as a solid, liquid or gas. Generally, increasing the temperature turns solids into liquids and liquids into gases; reducing it turns gases into liquids and liquids into solids.
States of Matter
At low temperatures, molecular motion decreases and substances have less internal energy. Atoms will settle into low energy states relative to one another and move very little, which is characteristic of solid matter. As temperatures increase, additional heat energy is applied to the constituent parts of a solid, which causes additional molecular motion. Molecules begin to push against one another and the overall volume of a substance increases. At this point, the matter has entered the liquid state. A gaseous state exists when molecules have absorbed so much heat energy due to increased temperatures that they are free to move around one another at high speeds.
Phase Changes Between States of Matter
The point at which matter subjected to a particular temperature under conditions of constant pressure begins to change its phase is called the phase change threshold. At this temperature, every bit of the substance exposed to the heat will change its state. A shift from to a solid to a liquid occurs at the melting point, and the transition from a liquid to a gas takes place at the boiling point. Conversely, the moment of change from a gas to a liquid is the condensation point and the shift from a liquid to a solid takes place at the freezing point.
Sudden Temperature Changes and Phase States
A substance may undergo phase change from a solid to a gas or from a gas to a solid if the temperature it is exposed to is changed very quickly. If the temperature around a solid is raised very quickly, it can sublimate, or phase change from a solid to a gas without existing as a liquid. In the opposite direction, a gas that is suddenly supercooled can undergo complete deposition.
Temperature Effects on Phase
If pressure is constant, the state of a substance will depend entirely on the temperature it is exposed to. For this reason, ice melts if taken out of a freezer and water boils out of a pot if left at too high a temperature for too long. Temperature is merely a measurement of the amount of heat energy present in the surroundings. When a substance is placed in surroundings of a different temperature, heat is exchanged between the substance and the surroundings, causing both to achieve an equilibrium temperature. So when an ice cube is exposed to heat, its water molecules absorb heat energy from the surrounding atmosphere and begin to move more energetically, causing the water ice to melt into liquid water.