Magnetism originates from the spin and orbital magnetic moment of an electron.

Spin and Orbital motion of an electron

The orbital motion of an electron around the nucleus is analogous to the current in a loop of wire.

The magnetic moment of a current carrying conductor is given by

µ = I.A where I is the current in A and A is the area in m^{2}.

**Oribital magnetic moment**

The magnetic moment of an electron in orbit is given by

µ =πr^{2} (ev/2πr) = evr/2 -- (1) where r is the radius of orbit, e - charge and v is the velocity

The angular momentum of an electron must be an integral multiple of Plancks const.

mvr=nh/2π -- (2)

where m is the mass and h is the Planck's const.

If the electron revolves in the first orbit then n=1

Therefore orbital magnetic moment of an electron is given by from (1) and (2)

µl =eh/4πm -- (3)

which is known as Bohr magneton, the smallest possible orbital magnetic moment

**Spin magnetic moment**

Similarly the smallest possible magnetic moment due to spin of the electron is

µs =eh/4πm

According to quantum theory the spin of electrons have only two possibilites +1/2 or -1/2.

Similar to orbital mag moment, spin moment from experiments can be written as

µs =1µ_{B} --(4)

S is the spin quantum number here given by (1/2).(h/2π)

In short,

µs =gs.(e/2m).S --(5)

g is the term known as g- factor.

When g=2, the spin contribution arises and when g=1 the orbital contribution arises.

The mass of the nucleus is so large that the magnetic moment contribution can be neglected compared to the electronic magnetic moment.

The gryomagnetic ratio is proportional to the g-factor and 'g' arises due to the precession of the electrons similar to the precession of a top in a gravitational force. the value of g tells us whether the origin of magnetic moment is spin or orbital motion of electrons.