# Integer Addition and Subtraction

Shodor > Interactivate > Discussions > Integer Addition and Subtraction

 Mentor: Now that we have established a definition for the Integers, we can perform operations on them. Student: What kind of "operations"? Mentor: Well, the easiest one would be addition. Consider this example: a friend gives you 3 pieces of candy. If you already had 2 pieces of candy, then how many pieces would you have? Student: If I had two pieces and was given three more, then I would have 5 pieces of candy. Mentor: Yes, that is right. You just added two integers. Now, to express this operation we would write, 2 + 3 = 5, which represents 2 pieces of candy plus (or in addition to) 3 pieces of candy equals 5 pieces of candy. Now what if you had three pieces of candy and someone gave you two more? Student: Hmm, if I had 3 pieces and someone gave me 2 more, then I would end up with 5 pieces of candy, again. So if 2 + 3 = 5 and 3 + 2 = 5, then does 2 + 3 = 3 + 2? Mentor: Yes, in fact, for any two integers b and c, b + c = c + b. You can add them in either order, we call this the Commutative Law of Addition. Also, if you are addding more than two numbers, you may add them in any order you like, i.e. if you were adding b + c + d, then you could first add b to c, (b + c) + d, or you could first add c to d, b + (c + d). We call this the Associative Law of Addition (parentheses are used to emphasize the order of the operations performed). Student: The Integers also inlude the Negative Numbers, right? What happens when you add a positive number to a negative number, or two negative numbers together? Mentor: Well, let's say we had two positive numbers b and c. Then b + (-c) would be the same as writing b - c, or b minus c. We call this subtraction. Let's return to our candy example for a moment. What if you started off with 5 pieces of candy and then someone took away 2 pieces? Student: If I had 5 pieces and someone took away 2 pieces I would have 3 pieces left. So 5 - 2 = 3, right? Mentor: Right, however, it is important to know that 5 - 2 is not the same as 2 - 5. To subtract a larger number from a smaller number simply start with the smaller number and count down. Once you hit zero, the next number will be -1, then -2, and so on. Student: So to figure out what 2 - 5 equals I would count down five numbers from 2: 1, 0, -1, -2, -3. So 2 - 5 = -3, which is definitely not equal to 5 - 2 = 3. Mentor: You certainly seem to understand addition and subtraction. Notice that if you subtracted b units from b you would end up back at zero. For any number b, b - b = 0. Now I have one last question. What do you think would happen if you added or subtracted 0 from a number? Student: Well if you did not add anything to a number, it wouldn't change, so b + 0 = b if b is any integer. The same would be true if you did not subtract anything from a number, so b - 0 = b. Mentor:Yes, and since adding or subtracting 0 from any number changes nothing, we can drop it out of the computation completely. This leaves us with b = b, for any b, which we call the identity equation. It tells us that any number b is always equal to itself. 