The study of the relationships between the transfer of heat and work, and changes in the state of matter.