work is done when number of moles of gas changes in a chemical reaction. Assuming ideal gas law, we can use to calculate the work done by the gases.