Conveniently, perhaps even miraculously, the equations developed in Chapter 4 to accomplish basis swaps can be used to balance chemical reactions automatically. Once the equations have been coded into a computer program, there is no need to balance reactions, compute equilibrium constants, or even determine equilibrium equations by hand. Instead, these procedures can be performed quickly and reliably on a small computer. To balance a reaction, we first choose a species to appear on the reaction’ s left side, and express that species’ composition in terms of a basis B. The basis might be a list of the elements in the species’ stoichiometry, or an arbitrary list of species that combine to form the left-side species. Then we form a second basis B´ composed of species that we want to appear on the reaction’ s right side. To balance the reaction, we calculate the transformation matrix relating basis B´ to B, following the procedures in Chapter 4. The transformation matrix, in turn, gives the balanced reaction and its equilibrium constant. Two methods of balancing reactions are of interest. We can balance reactions in terms of the stoichiometries of the species considered. In this case, the existing basis B is a list of elements and, if charged species are involved, the electron e–. Alternatively, we may use a dataset of balanced reactions, such as the LLNL database. Basis B, in this case, is the one used in the database to write reactions. We will consider each possibility in turn. A straightforward way to balance reactions is to use as the initial basis the stoichiometries of the species involved. If the species’ free energies of formation are known, the reaction’ s equilibrium constant can be determined as well. In the stoichiometric approach, basis B is the list of elements that will appear in the reaction, plus the electron if needed. We write swap reactions and calculate a transformation matrix as described in Section 3.1. The equations in Sections 3.2 and 3.3 give the balanced reaction and associated equilibrium constant.