In a chemical reaction the initial state of the system refers to the reactants and the final state refers to the products.
2 H2(g) + O2(g) → 2 H2O(g)
In the reaction above, the system looses energy to the surroundings as heat. Because heat is lost from the system, the internal energy of the products (final state) is less than that of the reactants (initial state), and ΔE is negative.
Another way of saying this - as heat is added to or removed from a system, work is done on or by the system.
Using q to represent the heat added to or removed from the system, and w to represent work, the First Law of Thermodynamics can be represented by the equation:
ΔE = q + w
- + means system gains heat
- − means system loses heat
- + means work is done on system
- − means work is done by system
- + means net gain of energy by system
- − means net loss of energy by system