Matter is changed from one state to another by addition or removal of heat and suitable pressure conditions.
When a solid is heated, it normally melts and changes to liquids which on heating changes to vapor. The randomness of the particles increases from solid to liquid state and to gaseous states.
Also, a gas can be cooled to liquid and on further cooling transformed into a solid matter.
These phase changes are brought about by energy changes in a system. Some form of matter can also sublime by changing form solid to gas and vice versa.