where δQ is energy added as heat, and δW is energy added as work. The work done on the system may be written as δW = − pdV + δW x, where − pdV is the mechanical work of compression/expansion done on or by the system and δW x is all other forms of work, which may include electrical, magnetic, etc. Then