What is the Aufbau principle?
The Aufbau (building up) Principle:
the number of electrons in an atom is equal to the atomic number;
each added electron will enter the orbitals in the order of increasing energy;
an orbital cannot take more than 2 electrons.
This principle gives the order of filling of orbitals with electrons according to this sequence:
1s > 2s > 2p > 3s > 3p > 4s > 3d > 4p > 5s > 4d
The atom of magnesium has a total of 12 electrons. Using the aufbau diagram we obtain an electronic configuration of