Explain how a change in thermal energy causes matter to change from one state to another. Give two examples