How do you determine the magnetic quantum number?

The magnetic quantum number, ml, is determined by first knowing the subshell, or angular momentum quantum number (l).

The s subshell (l=0) has one orbital: ml=0

The p subshell (l=1) has three orbitals: ml=-1, 0, +1

The d subshell (l=2) has five orbitals: ml=-2, -1, 0, +1, +2

A more generic formula is: ml = -l to +l