When an ionic compound dissolves in water, its ions separate and move freely. In some reactions only some of these ions actually change. An ionic equation shows just the ions that react and the substance they form. Ions that are present but do not change are called spectator ions, and they are left out.
Silver nitrate solution reacts with sodium chloride solution to give solid silver chloride. The sodium ions and nitrate ions are spectator ions, so the ionic equation is Ag+(aq) + Cl-(aq) → AgCl(s). The solid that forms from two solutions is a precipitate. Barium ions and sulfate ions form the precipitate barium sulfate: Ba2+(aq) + SO42-(aq) → BaSO4(s).
An ionic equation must balance in two ways. The number of atoms of each element must be the same on both sides, and the total charge must be the same on both sides. For lead iodide: Pb2+(aq) + 2I-(aq) → PbI2(s). The left side has a total charge of zero (2+ and two 1-) and the right side is neutral, so the charge is zero on both sides. Neutralisation is H+(aq) + OH-(aq) → H2O(l). The other ions in the acid and the alkali are spectator ions.