The Outermost Shell of an Atom
Inside an atom the electrons move around the nucleus in shells. The first shell holds at most 2 electrons, the second holds at most 8 and the third holds at most 8. Magnesium has atomic number 12, so its 12 electrons settle as 2, 8, 2. The way the electrons are spread over the shells like this is called the electron arrangement of the atom.
Of all these shells, the outermost one is the shell that matters in chemical reactions. The electrons in the inner shells are held tightly by the nucleus, but the electrons in the outermost shell sit far from the nucleus. So when the atom meets another atom, it is these outer electrons that are given away, taken in or shared.
Valence shell: the outermost shell of an atom is called its valence shell.
Valence electron: an electron present in the valence shell is called a valence electron.

Three Things an Atom Does to Become Stable
An atom is always trying to reach stability by having 2 electrons in its valence shell (for elements of atomic number 1 to 5) or 8 electrons in it. Once that outer shell is filled the atom is settled and no longer looks for another atom to join. To reach that state an atom does one of three things: it gives electrons away, it takes electrons in, or it shares electrons.
Which of the three it does depends on how many electrons are in that outer shell. An atom with only a few outer electrons finds it easy to let them go, because the filled shell underneath then becomes its outermost shell. An atom that already has many outer electrons finds it easier to pull in the few it still needs to reach 8.
With 1 to 3 electrons in the outer shell an atom gives electrons away, with 4 it shares them, and with 5 to 7 it takes electrons in.
What the Valency of an Element Is
The number of electrons an atom gives, takes or shares is the valency of that element. Sodium has the arrangement 2, 8, 1. There is only 1 electron in its outer shell, so sodium gives that one electron away and its valency is 1. Oxygen has the arrangement 2, 6. It needs 2 more electrons to reach 8, so oxygen takes in 2 electrons and its valency is 2.
Valency: the number of electrons an atom of an element gives, takes or shares in order to become stable is called the valency of that element.
If the valence shell already holds 8 electrons, the atom neither gives, takes nor shares electrons. The valency of such an element is 0, and elements like these do not take part in chemical reactions. Neon and argon are elements of this kind.


The number of valence electrons and the valency are not the same thing. Sulphur has 6 electrons in its outer shell, but its valency is 2 and not 6, because the number of electrons it actually takes in is only 2.
Electron Arrangement and Valency of the First Twenty Elements
Once the atomic number is known the electron arrangement can be written, and once the arrangement is written the valency can be read off the outer shell. The working for the first twenty elements is set out below.
| Atomic number | Element | Electron arrangement | Valency |
| 1 | Hydrogen | 1 | 1 |
| 2 | Helium | 2 | 0 |
| 3 | Lithium | 2, 1 | 1 |
| 4 | Beryllium | 2, 2 | 2 |
| 5 | Boron | 2, 3 | 3 |
| 6 | Carbon | 2, 4 | 4 |
| 7 | Nitrogen | 2, 5 | 3 |
| 8 | Oxygen | 2, 6 | 2 |
| 9 | Fluorine | 2, 7 | 1 |
| 10 | Neon | 2, 8 | 0 |
| 11 | Sodium | 2, 8, 1 | 1 |
| 12 | Magnesium | 2, 8, 2 | 2 |
| 13 | Aluminium | 2, 8, 3 | 3 |
| 14 | Silicon | 2, 8, 4 | 4 |
| 15 | Phosphorus | 2, 8, 5 | 3 |
| 16 | Sulphur | 2, 8, 6 | 2 |
| 17 | Chlorine | 2, 8, 7 | 1 |
| 18 | Argon | 2, 8, 8 | 0 |
| 19 | Potassium | 2, 8, 8, 1 | 1 |
| 20 | Calcium | 2, 8, 8, 2 | 2 |
One thing stands out clearly from the table. Nitrogen has 5 electrons in its outer shell but a valency of 3, because it needs to take in only 3 electrons to reach 8. In the same way chlorine has 7 outer electrons but a valency of just 1.
Molecular Formula
The formula of the molecules of an element or a compound, written in symbols, is called its molecular formula. The molecule of an element is made of atoms of the same kind, while the molecule of a compound is made of atoms of different kinds. A molecule of oxygen is two oxygen atoms joined together, so its molecular formula is written as O2. A molecule of water, on the other hand, carries atoms of two different elements, hydrogen and oxygen.
Molecular formula: the formula of the molecules of an element or a compound, expressed in symbols, is called the molecular formula.
To write the molecular formula of a compound you must know which elements the compound is made of. That alone is not enough: you must also know the valencies of those elements. With both of those in hand, the formula can be written by the criss-cross method.
Criss-cross method: the way of writing a molecular formula by swapping the valency of each element onto the symbol of the other element.
Writing the Formula of Magnesium Oxide Step by Step
Step 1: Write down the name of the compound first. Here the compound is magnesium oxide.
Step 2: Write the symbols of the elements present in the molecule of that compound:
\[ \mathrm{Mg} \quad \mathrm{O} \]
Step 3: Write the valency of each element above its symbol. Magnesium has valency 2 and oxygen has valency 2:
\[ \overset{2}{\mathrm{Mg}} \quad \overset{2}{\mathrm{O}} \]
Step 4: Now swap the valencies across, with the help of two arrows. The 2 of magnesium moves over to the symbol of oxygen and the 2 of oxygen moves over to the symbol of magnesium. The swapped numbers are written below the symbols:
\[ \mathrm{Mg}_2 \mathrm{O}_2 \]

Step 5: Both numbers can be divided by 2, so divide and keep only the number that is left:
\[ \mathrm{Mg}_2\mathrm{O}_2 = \mathrm{MgO} \]
Tidying the Formula After the Swap
Two rules are applied once the swap is done. The first is that a 1 does not need to be written. In potassium chloride both valencies are 1, so no number appears in the finished formula.
\[ \mathrm{K}_1\mathrm{Cl}_1 = \mathrm{KCl} \]
The second rule is that if the two numbers divide into each other, they are divided and only what is left is written. In carbon dioxide the valency of carbon is 4 and that of oxygen is 2, so the swap gives C2O4, and dividing both by 2 tidies the formula to this:
\[ \mathrm{C}_2\mathrm{O}_4 = \mathrm{CO}_2 \]
Leaving the swapped numbers as they are is a mistake many students make. Writing Mg2O2 for MgO, or C2O4 for CO2, is wrong. Never skip the tidying: drop a 1, and divide when both numbers share a common divisor.
Molecular Formulae of Other Compounds
The same five steps work for any compound in exactly the same way. The working for five familiar compounds is set out together below.
| Compound | Elements and valencies | After the swap | Molecular formula |
| Potassium chloride | \( \mathrm{K} = 1 \), \( \mathrm{Cl} = 1 \) | \( \mathrm{K}_1\mathrm{Cl}_1 \) | \( \mathrm{KCl} \) |
| Calcium chloride | \( \mathrm{Ca} = 2 \), \( \mathrm{Cl} = 1 \) | \( \mathrm{Ca}_1\mathrm{Cl}_2 \) | \( \mathrm{CaCl}_2 \) |
| Ammonia | \( \mathrm{N} = 3 \), \( \mathrm{H} = 1 \) | \( \mathrm{N}_1\mathrm{H}_3 \) | \( \mathrm{NH}_3 \) |
| Carbon dioxide | \( \mathrm{C} = 4 \), \( \mathrm{O} = 2 \) | \( \mathrm{C}_2\mathrm{O}_4 \) | \( \mathrm{CO}_2 \) |
| Water | \( \mathrm{H} = 1 \), \( \mathrm{O} = 2 \) | \( \mathrm{H}_2\mathrm{O}_1 \) | \( \mathrm{H}_2\mathrm{O} \) |
Look carefully at the working for water. The valency 1 of hydrogen moves across to oxygen and settles under it, and the valency 2 of oxygen moves across to hydrogen and settles under it. That is why the formula is H2O and not OH2. A number belongs to the element it has landed under.
The full lesson is waiting for you
The notes are free to read in full. A free account opens the rest of the practice, and tracks your progress and confidence score for every subject. Presentations and videos need approval from Learn Yeti.