The principal quantum number n, belongs to the principal shell (K,L,M, ....) which is occupied by an electron and can be any positive integer (n = 1, 2, 3, 4, ........). Its location is further narrowed down by the angular momentum quantum number l, corresponding to the subshell and its general shape. The value of l is dependent on the value of n (l = 0, 1, 2, .........., n-1). The values of l correspond to specific subshells i.e. l = 0 for s; l = 1 for p; l = 2 for d; l = 3 for f.
The magnetic quantum number($$m_l$$), further divides these subshells into orbitals and gives orientation of these orbitals in space. The number of orbitals can be determined from the angular momentum quantum number l and the maximum possible values of $$m_l$$ can be determined from number of orbitals given by, (2l + 1).
Also, $$m_l$$ is the projection of l in field direction. For angle of projection $$\theta$$ it is given by
$$m_l = l \cos \theta$$.
Since, $$m_l$$ is an integer and $$\cos \theta$$ never exceed unity hence, the possible values of $$m_l$$ are
$$m_l = -l, ........, 0, ..........., +l$$
Hence, for a hydrogen atom is in the d-state, $$l = 2$$,
Number of orbitals are,
$$(2l + 1) = (2(2) + 1) = 5$$
Therefore, $$m_l = -2, -1, 0, 1, 2$$