The electronic configuration of elements is determined by the way electrons occupy different energy levels or shells around the nucleus. The pattern you mentioned, 2,8,8,2, is related to the filling of the electron shells following the Aufbau principle, Hund's rule, and the Pauli exclusion principle.
According to the Aufbau principle, electrons fill the available energy levels or orbitals starting from the lowest energy level and moving to higher levels. The first energy level (shell) can accommodate a maximum of 2 electrons, and the second energy level can accommodate a maximum of 8 electrons. This is why the electronic configuration starts with 2,8.
However, when it comes to the third energy level, there are both s and p orbitals available. The 3s orbital can accommodate a maximum of 2 electrons, while the 3p orbitals can accommodate a maximum of 6 electrons. Following the Aufbau principle, the 3s orbital is filled before the 3p orbitals. So the electronic configuration becomes 2,8,8,2.
In the case of calcium (atomic number 20), its electronic configuration is indeed 2,8,8,2. The first two electrons occupy the 1s and 2s orbitals, the next eight electrons occupy the 2p orbitals, the next eight electrons occupy the 3s and 3p orbitals, and the final two electrons occupy the 4s orbital. This arrangement ensures that each orbital is filled in a way that minimizes electron-electron repulsion, following the Pauli exclusion principle and Hund's rule.
It's important to note that the electron configuration doesn't always follow a strict pattern. Transition metals and elements in higher energy levels (beyond the third period) exhibit variations in their electronic configurations due to the more complex arrangement of orbitals and electron filling.