There are two basic things you must be able to do if you ever want to be successful in Chemistry: write a chemical formula and name a chemical formula. But before you do that let's see why and how elements combine to form compounds.

In a chemical reaction, two or more elements combine to form a compound. Right now as you sit in front of your computer, billions of atoms of carbon in the food you eat are combining with the oxygen you breathe producing energy and carbon dioxide. The chemical formula for carbon dioxide is CO2 - a colorless, odorless gas.

The first thing you need to know about compounds is something about the elements that combine to make them. There are three types of elements: Metals, Nonmetals and Metalloids. Metals are on the left side and center of the periodic table, metalloids along the zigzag line that begins at 3A, and nonmetals (except for hydrogen) are on the right side of the table.

IT'S ALL ABOUT LOSING (AND GAINING)

In a chemical reaction between a metal and nonmetal, metal atoms lose their valence electrons, while nonmetal atoms gain valence electrons. These actions allow the atoms to have eight valence electrons and become chemically stable.

Metals generally have between 1 and 3 valence electrons (the Group number at the top of each family). Lets see what happens to magnesium (an Alkaline Earth Metal) in a chemical reaction.

If magnesium can lose 2 electrons to a nonmetal (such as oxygen), it will be stable since now has eight valence electrons. But when it loses 2 electrons it now has 12 protons and only 10 electrons and becomes a cation (+ charged particle) with a +2 valence.

Nonmetals generally have between 5 and 7 valence electrons (Noble Gases have filled valence energy levels so we aren't concerned with them). Let's see what happens to phosphorus, a member of the Nitrogen Family.

If a phosphorus atom can gain 3 electrons from one or more metallic atoms it will be stable. When phosphorus gains 3 electrons in a chemical reaction, it now has 15 protons and 18 electrons and becomes a phosphide anion (- charged particle) with a -3 valence.

Important: When a nonmetal gains electrons and becomes an anion, the last few letters of its name is replaced with the suffix -ide. Here is a list of anions: nitride, oxide, phosphide, sulfide, fluoride, chloride, bromide, and iodide.

So why do ions stay together in a compound if both the elements are stable with 8 valence electrons? Two words: electromagnetic force. The positive charge on the metallic cation and the negative charge on the nonmetal anion attract each other and form a repeating pattern of ions called a crystalline lattice. In the reaction between sodium and chlorine, sodium loses an electron to become a +1 sodium cation while chlorine gains the electron to become a -1 chloride anion. They form a crystalline lattice - a salt crystal.

To sum it up:
Metals lose all their valence electrons in a chemical reaction and become cations (+ ions) with a +1, +2 or +3 oxidation number.
Nonmetals gain enough electrons to fill their outer energy level and therefore become anions (- ions) with a -1, -2, or -3 oxidation number.
The attraction between these two opposite charged ions hold the crystalline lattice together.
 

SHARE & SHARE ALIKE

Two nonmetals have a tight hold on their valence electrons and neither is willing to give up any electrons. So when two nonmetals react, they share electrons to become chemically stable with eight valence electrons. Here is an example.

When you burn hydrogen gas (as we did the first day of school when Mr. G ignited the hydrogen balloon) it combines with oxygen (in the air) to produce H2O (water). Since both hydrogen and oxygen are nonmetals they share valence electrons. Hydrogen only needs 2 electrons to become stable (H, Li, Be and B only need 2 valence e- since the first energy level fills with 2 e-) while oxygen needs 8 valence electrons. So when they combine each hydrogen atom shares one electron with oxygen and oxygen shares one electron with each hydrogen atom - covalent bonds between the atoms hold the water molecule together.

Unlike a metal and nonmetal, when two nonmetals combine neither takes on a charge since neither lost or gained electrons. They remain atoms and do not become ions. Unlike ionic compounds which form crystals, covalent compounds form molecules. The shared pair of electrons orbit both nuclei giving each atom a filled outer electron energy level. The attraction for these shared pair of electrons produce a covalent bond which holds the molecule together.

Now that you understand why compounds form, lets move on to seeing how we can write their chemical formulas.