Suppose we have the counting numbers 0, 1, 2, 3, 4, ... but we don't have the negative numbers. That means we can solve the equation x+5=13, but we can't solve x+13=5.

How can we fix this? What we want is some new, larger system of things we call "numbers" that somehow extends the existing idea, and allows these other, similar problems to be solved. Here's one way to do that.

Consider all pairs (a,b) of counting numbers, and declare that two pairs (a,b) and (c,d) are equivalent if (and only if) a+d=b+c. (The idea here is that (a,b) "means" a-b, but we can't say that formally because a-b is a possibly-negative integer and at this point we're supposed to know only about the counting numbers.)

We can check that this is a proper equivalence relation, and so we have equivalence classes. Any pair (a,b) is in exactly one equivalence class. It's the equivalence classes we're interested in.

Given two equivalence classes A and C we define their sum A+C as follows. Take a representative (a,b) of A, and a representative (c,d) of C, and define A+C to be the equivalence class containing (a+c,b+d). We need to check that the result is always the same no matter which representatives you choose, but it turns out that this definition is "well-defined."

Further, given an equivalence class A we define the negative of A as follows. Let (a,b) be any representative of A and define -A to be the equivalence class containing (b,a). Again, we need to check that it doesn't matter what representative we choose, we always get the same answer, but again, the concept is well-defined.

We can now show that for any counting number a the equivalence class that contains (a,a) plays the role of a zero. Given any other pair (c,d), (a+c,a+d) is in the same equivalence class as (c,d). Adding (a,a) has no effect on which equivalence class we're in.

Now we can see that (b,a) acts as the negative of (a,b) because (a,b)+(b,a)=(a+b,a+b) and we get the equivalence class that plays the role of zero.

We also have a natural embedding of the counting numbers into the collection of equivalence classes $x\rightarrow(x,0)$

Thus the collection of equivalence classes acts as the integers.

The method above is not the only way to construct something that behaves as the integers should, starting with only the counting numbers. The usual way of writing integers suggests another way: say that an integer is either a counting number (0,1,2,...) or a nonzero counting number with "-" stuck in front of it (-1,-2,...); and then define arithmetic operations on these things case by case. So, for instance, to define addition on the integers we need to consider the following cases:

• (a)+(b) = (a+b)
• (-a)+(-b) = -(a+b)
• (a)+(-b) = (a-b) when a >= b
• (a)+(-b) = -(b-a) when a < b
• (-a)+(b) = (b-a) when a <= b
• (-a)+(b) = -(a-b) when a > b
This approach has the advantage of familiarity, and avoids the technical machinery of equivalence classes; but it requires a great deal of case-splitting. In contrast, the equivalence-classes-of-ordered-pairs approach above just says: (a,b) + (c,d) = (a+c,b+d), and that's that.

Which is better? Most mathematicians would choose the first way. It's harder to understand at first, but the ideas it uses -- ordered pairs, equivalence relations, etc. -- turn out to be useful throughout mathematics. (For instance, we can use a very similar idea for constructing the rationals.) And the payoff in simplicity and elegance is considerable.