In copper (Cu), the expected electron configuration based on the position of copper in the periodic table would be 3d9 4s2. However, the observed electron configuration is 3d10 4s1. This is because copper preferentially fills its 3d orbital to make it completely filled and its 4s orbital half-filled, which is a more stable configuration. This is an exception to the octet rule.
Similarly, in iron (Fe), the expected electron configuration would be 3d7 4s2. However, the observed electron configuration is 3d6 4s2. This is because iron preferentially removes its two electrons from the 4s orbital to form Fe(II), and then removes one electron from the 3d orbital to form Fe(III). This results in a half-filled 3d orbital, which is more stable.
So, in both copper and iron, the changes in electron configuration occur to achieve a more stable configuration by either completely filling or half-filling certain orbitals. These changes allow for the display of multiple valences in these metals.