In physics, a closed system can exchange heat and work (aka energy), but not matter, with its surroundings. In contrast an isolated system can exchange neither heat nor matter with the surroundings. For a simple system, with only one type of particle (atom or molecule), this amounts to a constant number of particles. However, for systems which are undergoing a chemical reaction, there may be all sorts of molecules being generated and destroyed by the reaction process. In this case, the fact that the system is closed is expressed by saying that the total number of each elemental atom is conserved, no matter what kind of molecule it may be a part of. Mathematically:
where is the number of j-type molecules, is the number of atoms of element i in molecule j and bi0 is the total number of atoms of element i in the system, which remains constant, since the system is closed. There will be one such equation for each different element in the system.