(N/A) The internal energy of a system can change through two modes of energy transfer: heat and work.
Let $\Delta Q$ = Heat supplied to the system by the surroundings.
Let $\Delta W$ = Work done by the system on the surroundings.
Let $\Delta U$ = Change in the internal energy of the system.
From the principle of conservation of energy,$\Delta Q = \Delta U + \Delta W$ ... $(1)$ is known as the first law of thermodynamics.
From equation $(1)$,it is stated that the energy $(\Delta Q)$ supplied to the system is used partly to increase the internal energy of the system $(\Delta U)$ and the rest is used to perform work on the surroundings $(\Delta W)$.
An alternative form of this equation is $\Delta Q - \Delta W = \Delta U$ ... $(2)$.
$A$ system may transition from an initial state to a final state in various ways. For example,to change the state of a gas from $(P_{1}, V_{1})$ to $(P_{2}, V_{2})$,one could change the volume from $V_{1}$ to $V_{2}$ at constant pressure,then change the pressure from $P_{1}$ to $P_{2}$ at constant volume.
When a system is taken from one state to another,$\Delta Q$ and $\Delta W$ are different for different paths,meaning $\Delta Q$ and $\Delta W$ are path-dependent. However,the difference $(\Delta Q - \Delta W)$ is the same for every path. Thus,$(\Delta Q - \Delta W)$ is path-independent and depends only on the initial and final states of the system.
Therefore,the first law of thermodynamics is $\Delta Q - \Delta W = \Delta U$.
This law is obeyed in all natural processes. All three terms must have the same units.
Sign convention: If the system absorbs heat,$\Delta Q$ is positive; if heat is released,$\Delta Q$ is negative. When a gas expands,work done by the system $\Delta W$ is positive; when compressed,work done on the system $\Delta W$ is negative.
If $(\Delta Q - \Delta W) > 0$,the internal energy increases; if $(\Delta Q - \Delta W) < 0$,the internal energy decreases.