has contributions both from the orbital angular momentum and the spin, with different coefficients g(l) and g(s):
by substituting this back to the formula above and rewriting
For a single nucleons =1/2. For j = l + 1 / 2 we get
and for j = l − 1 / 2
According to the shell model, protons or neutrons tend to form pairs of opposite total angular momentum. Therefore the magnetic moment of a nucleus with even numbers of both protons and neutrons is zero, while that of a nucleus with odd number of protons and even number of neutrons (or vice versa) will have be that of the "last", unpaired proton (or neutron), according to the formula we have arrived at. For a nucleus with odd numbers of both protons and neutrons, one must take both the "last", unpaired proton and neutron. Their total magnetic moment will be some combination of their magnetic moments.
In fact, nuclear magnetic moment is only partly predicted by simple versions of the shell model. The magnetic moment is calculated through j, l and s of the "last" nucleon, but nuclei are not in states of well defined l and s. Furthermore, for odd-odd nuclei, one has to consider the two "last nucleons, as in deuterium. Therefore one gets several possible answers for the nuclear magnetic moment, one for each possible combined l and s state, and the real state of the nucleus is a superposition of them. Thus the real (measured) nuclear magnetic moment is somewhere in between the possible answers.