Ionic Compounds
Gaining and losing electrons… forming ions
When a small amount of sodium is brought into contact with chlorine, a very violent reaction occurs, although not spontaneously. It is necessary to overcome an activation energy. This phenomenon is very common in chemistry. There are reactions where a lot of energy is released that needs some initial "help" for them to occur. But once started, they are so violent that they can cause an accident if you do not act with caution.
n Na + (n/2) Cl2 = n NaCl
A piece of sodium with "n" atoms reacts with "n/2" amount of diatomic chlorine molecules to give "n" molecules of NaCl (sodium chloride).
Ionic compounds form primarily between elements at both ends (left and right) of the Periodic Table. The octet rule allows us to know how they will react.
How will potassium (K) and oxygen (O) do it? Look at the electronic configuration of both. Oxygen is two electrons short of filling the 2 shell. Potassium has one electron in the 4s level that it can easily lose. Therefore: