Notice that this shows only that there are no more whole numbers than rational numbers, and no more rational numbers than whole numbers. To conclude that there is the same number of each (more generally, that cardinal numbers are totally ordered (EDIT: as ionfish (http://news.ycombinator.com/item?id=4251492) points out, I should have said that the inclusion relation on cardinals is antisymmetric)) is actually a bit delicate; it's called the Schröder–Bernstein theorem (although Wikipedia attaches more names, in a different order: https://en.wikipedia.org/wiki/Cantor%E2%80%93Bernstein%E2%80...).