# Why does period 3 of the periodic table contain 8 elements instead of 18?

Period 1 of the periodic table contains 2 elements ($$1s^1$$ and $$1s^2$$).

Period 2 contains 8 elements ($$2s^1$$, $$2s^2$$, $$2p^1$$, $$2p^3$$, ..., $$2p^6$$).

By the same argument, period 3 might contain 18 elements ($$3s^1$$, $$3s^2$$, $$3p^1$$, $$3p^3$$, ..., $$3p^6$$, $$3d^1$$, $$3d^2$$, $$3d^{10}$$). Why does period 3 of the periodic table contain 8 elements instead of 18?

I think that it could be explained by means of atomic stability, but I need help to understand what happens.

Electrons are filled according to $$n+l$$ rule. It states as $$n+l$$ increases, the energy of the orbital increases. If $$n+l$$ is the same, then the bigger $$n$$ has larger energy.
So $$\mathrm{4s}$$ would be filled before $$\mathrm{3d}$$. Therefore elements containing $$\mathrm{3d}$$ electrons would have their $$\mathrm{4s}$$ orbital filled, and therefore, come in 4th period. There 3rd period contains elements having $$\mathrm{3s}$$ and $$\mathrm{3p}$$ electron as their last electron which are equal to 8.