In physics, we describe the interaction between two objects in terms of forces. And by now you're learned that, where atoms are concerned, there are two forces that are important: the electric force and the strong force. But remember that the strong force has a very short range. It has no effect on electrons, and in fact, it has no effect outside the nucleus. So when two atoms are attached (bound) to each other, it's because there is an electric force holding them together. And that means that we have to look again at the electric charge in atoms.
But an interesting thing can happen when the two atoms get close together. The electron in each atom starts to notice the proton of the other atom. As a result, it becomes attracted not only to its own proton, but to the proton of the other atom as well. As a result, the electrons will tend to spend more of their time in between the two protons, instead of each one quorbiting its own proton. Perhaps something like this:
Now the protons in this scenario will still repel each other, but they'll both be attracted to the negatively charged region that lies between them. And since this negatively charged region is closer to each proton than the other proton is, the attraction to this region will overcome the repulsion from the other proton. (Remember, the electric force gets weaker with distance.) As a result, the whole thing will tend to hold together in what we call a hydrogen molecule (H2).
Now if you're really on the ball, you may be thinking that I've left something important out. This negatively charged region between the two protons is created by two electrons. And electrons tend to repel each other. So you may be wondering if the fact that these two electrons will repel each other is going to kill the whole deal. It turns out that this is a very complicated question. What we're faced with here are a number of different attractions and repulsions. And the question that's posed is basically whether the attractions win out and the whole thing holds together, or whether the repulsions win and the whole thing flies apart (into two separate hydrogen atoms again).
The answer lies in considering energy. Remember that in a single atom, the electrons tends to drop to their lowest possible energy state. Well, this is true not just for a single atom, but for pretty much any kind of physical system. Now the system we're dealing with here has a lot going on. It's got two protons and two electrons, and so the total energy of the system consists of the kinetic energy of each particle, plus the potential energy between the two protons, plus the potential energy between the two electrons plus the potential energy between each proton and each electron. Some of these potential energies are positive and some are negative.
Anyway, to figure out whether these two hydrogen atoms are going to hold together into a hydrogen molecule, we have to ask ourselves which state has a lower energy: two separate hydrogen atoms, or the hydrogen molecule I've described above. The answer, after a big messy quantum mechanical calculation, is that the molecule has a lower energy than the two separate atoms. (At least I assume it is. I've never done the calculation. I'm taking other people's word for it.) Hence, two hydrogen atoms can form a hydrogen molecule.
This type of bond, in which the electrons tend to spend a lot of time between the two nuclei, is called a "covalent bond" by chemists. The two electrons involved no longer belong to one atom or the other, but are shared by the two atoms. In a more complicated atom than hydrogen, covalent bonding involves only the outermost electrons. The inner ones are more tightly bound to their own nucleus, and don't pay much attention to the passing of other atoms.
Covalent bonding can produce much larger molecules as well. DNA molecules consist of huge numbers of atoms held together mainly by covalent bonds. But there are other ways to hold atoms together.
Now if these two atoms are brought close together, one can imagine the following scenario. The outermost electron in the sodium atom is rather far out from the nucleus compared to the others. This means that it's not tied to its nucleus very tightly. It leaves the sodium atom, and joins the chlorine atom, stepping into that empty energy state I mentioned above.
The result is that the sodium atom has 11 protons and only 10 electrons. It has a net positive charge, and we call it a positive "ion." The chlorine atom has 17 protons and 18 electrons, giving it a net negative charge. It's a negative ion. And we know from early on that a positive particle and a negative particle will attract each other. Hence the sodium and chlorine atom will be bound together by their opposite charges.
We can imagine this scenario, but is this really what will happen? Well, again, the answer lies with energy. The electron that switches from one atom to the other actually has slightly more energy in the chlorine atom than it did in the sodium atom. And remember, it's the lowest energy state that wins out. So far, it doesn't look good. However, by moving this electron anyway, we have a positively charged sodium atom near a negatively charged chlorine atom. And the attraction between this negative and positive charge leads to a lower energy than two neutral atoms would have. In fact, this reduces the energy more than the energy of the shifted electron was increased.
In other words, the net result is a decrease in energy, so this bond will, in fact, form. This type of bond is called an "ionic bond," since it's a bond between two ions. It turns out that you can bind more than two atoms together this way. Sodium and chlorine ions, in fact, can line themselves up in vast arrays (well, vast on an atomic scale, anyway) called crystals.
The yellow ones are the sodium atoms, and the green ones are the chlorine atoms. I went ahead and used the chemical symbols for sodium (Na) and chlorine (Cl). You also have to imagine this stretching into three dimensions. That is, behind the atoms shown here, there are more atoms just like them, over and over again. This particular crystal is called "sodium chloride" in the chemistry lab, or "salt" at the dinner table.
There are other ways that atoms bind together, but I'm not going to go into them. If you want to know more, find a good chemistry web page, or a good chemist. But whatever the means by which two or more atoms choose to link themselves together, it always comes down to the same considerations: how the charge is distributed, and how much energy the atoms have when they're linked.
The end result is that all these atoms that various quarks and electrons have arranged themselves into, are themselves arranged into tables and rocks and plants and people and planets, and nearly all the other things that you may like or dislike. One could go on forever.
* Just as on the previous page, the light parts of these graphs denote the regions where the electron is most likely to be found. And you still have to mentally rotate each atom around its vertical axis. Back.