First law of thermodynamics:
The first law of thermodynamics states that the change in internal energy of a system in any process equals to net heat flow into the system minus the total work W done by the system.Suppose a system with internal energy I1 absorbs q amount of heat from the surrounding, and it performs work done W and also its internal changes to I2, then according to first law of thermodynamics:
heat supplied to the system = change in internal energy + Work done by the system
q = (I2-I1)+W
q = ΔI + W, or
ΔI = q - W