Calcium (Ca) is an alkaline earth metal in Group 2, with 2 valence electrons. To achieve a stable octet configuration, it tends to lose these two electrons, forming a Ca²⁺ ion. Oxygen (O) is a non-metal in Group 16, needing 2 electrons to achieve a stable octet, forming an O²⁻ ion. In the formation of the ionic compound CaO, a calcium atom transfers its two valence electrons to one oxygen atom.