The mass of an atomic nucleus is given by
where  and  are the rest mass of a proton and a neutron, respectively, and  is the total binding energy of the nucleus. The mass–energy equivalence is used here. The binding energy is subtracted from the sum of the proton and neutron masses because the mass of the nucleus is less than that sum. This property, called the mass defect, is necessary for a stable nucleus; within a nucleus, the nuclides are trapped by a potential well. A semi-empirical mass formula states that the binding energy will take the form
The difference between the mass of a nucleus and the sum of the masses of the neutrons and protons that comprise it is known as the mass defect. E is often divided by the mass number to obtain binding energy per nucleon for comparisons of binding energies between nuclides. Each of the terms in this formula has a theoretical basis. The coefficients , , ,  and a coefficient that appears in the formula for  are determined empirically.
The binding energy expression gives a quantitative estimate for the neutron-proton ratio. The energy is a quadratic expression in  that is minimized when the neutron-proton ratio is . This equation for the neutron-proton ratio shows that in stable nuclides the number of neutrons is greater than the number of protons by a factor that scales as .
The figure at right shows the average binding energy per nucleon as a function of atomic mass number along the line of beta stability, that is, along the bottom of the valley of stability. For very small atomic mass number (H, He, Li), binding energy per nucleon is small, and this energy increases rapidly with atomic mass number. Nickel-62 (28 protons, 34 neutrons) has the highest mean binding energy of all nuclides, while iron-58 (26 protons, 32 neutrons) and iron-56 (26 protons, 30 neutrons) are a close second and third. These nuclides lie at the very bottom of the valley of stability. From this bottom, the average binding energy per nucleon slowly decreases with increasing atomic mass number. The heavy nuclide U is not stable, but is slow to decay with a half-life of 4.5 billion years. It has relatively small binding energy per nucleon.
For β decay, nuclear reactions have the generic form 
where  and  are the mass number and atomic number of the decaying nucleus, and X and X&prime; are the initial and final nuclides, respectively. For β decay, the generic form is
These reactions correspond to the decay of a neutron to a proton, or the decay of a proton to a neutron, within the nucleus, respectively. These reactions begin on one side or the other of the valley of stability, and the directions of the reactions are to move the initial nuclides down the valley walls towards a region of greater stability, that is, toward greater binding energy.
The figure at right shows the average binding energy per nucleon across the valley of stability for nuclides with mass number A = 125. At the bottom of this curve is tellurium (Te), which is stable. Nuclides to the left of Te are unstable with an excess of neutrons, while those on the right are unstable with an excess of protons. A nuclide on the left therefore undergoes β decay, which converts a neutron to a proton, hence shifts the nuclide to the right and toward greater stability. A nuclide on the right similarly undergoes β decay, which shifts the nuclide to the left and toward greater stability.
Heavy nuclides are susceptible to α decay, and these nuclear reactions have the generic form,
As in β decay, the decay product X&prime; has greater binding energy and it is closer to the middle of the valley of stability. The α particle carries away two neutrons and two protons, leaving a lighter nuclide. Since heavy nuclides have many more neutrons than protons, α decay increases a nuclide's neutron-proton ratio.