本文へスキップ

レッスン 11 · Integers and Rational Numbers

Adding and Subtracting Integers

Learn clear rules for adding and subtracting positive and negative integers using the number line, with worked examples, common mistakes and code.

Adding and subtracting with negative numbers feels strange at first, but it follows simple, consistent rules. The easiest picture is walking on a number line: a positive number means "move right", a negative number means "move left".

Adding integers on the number line

To compute a + b, start at a, then move |b| steps right if b is positive and left if b is negative.

  • 3 + 4: start at 3, move 4 right → 7.
  • 3 + (−5): start at 3, move 5 left → −2.
  • −2 + (−4): start at −2, move 4 left → −6.
  • −6 + 9: start at −6, move 9 right → 3.

The rules for addition

  1. Same signs: add the absolute values and keep the sign. (−4) + (−3) = −7.
  2. Different signs: subtract the smaller absolute value from the larger, and keep the sign of the number with the larger absolute value. (−9) + 5: 9 − 5 = 4, and 9 is negative, so −4.
  3. Opposites add to zero: 6 + (−6) = 0.

A helpful model uses chips: each positive chip cancels one negative chip. In (−9) + 5, five pairs cancel and four negative chips remain: −4.

Python Adding integers with rules

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The function follows the rules exactly, and the last column checks it against the built-in +.

Subtracting integers

Subtracting a number is the same as adding its opposite:

a − b = a + (−b)

  • 7 − 3 = 7 + (−3) = 4
  • 7 − (−3) = 7 + 3 = 10
  • −5 − 4 = −5 + (−4) = −9
  • −5 − (−4) = −5 + 4 = −1

Why is 7 − (−3) = 10? Think of a temperature of 7 degrees. Removing 3 degrees of "cold" (−3) makes it warmer. Another way: the distance from −3 up to 7 is 10, and subtraction finds the gap between numbers.

Rewrite every subtraction as an addition of the opposite: change − to + and flip the sign of the second number. Then use the addition rules.

Python Subtraction as adding the opposite

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Several terms at once

Evaluate −8 + 12 − 5 − (−3) from left to right after rewriting:

−8 + 12 + (−5) + 3

  • −8 + 12 = 4
  • 4 + (−5) = −1
  • −1 + 3 = 2

You may also group positives and negatives: positives 12 + 3 = 15, negatives −8 − 5 = −13, total 15 − 13 = 2. The commutative and associative properties make that legal.

Real-world example: elevation

A hiker starts at 40 m above sea level and descends 55 m. The new elevation is 40 − 55 = 40 + (−55) = −15 m, meaning 15 m below sea level. A submarine at −120 m that rises 45 m ends at −120 + 45 = −75 m.

Python Track a running total

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Reading 3 − 5 as 5 − 3. The answer is −2, not 2.
  • Forgetting that − (−4) becomes + 4.
  • Treating a double sign as two minuses that make nothing. −(−4) equals +4; the signs combine into a plus.

Writing 5 + −3 is awkward; most writers add parentheses: 5 + (−3).

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is (−7) + (−5)?

    Same signs: add 7 + 5 = 12 and keep the negative sign.
  2. 2. What is 4 − 9?

    4 − 9 = 4 + (−9). Different signs: 9 − 4 = 5, and 9 is negative, so −5.
  3. 3. What is −6 − (−10)?

    Subtracting −10 is adding 10: −6 + 10 = 4.
  4. 4. A freezer is at −18 °C and warms by 7 °C. What is the new temperature?

    −18 + 7 = −11.

Summary

  • Add on a number line: move right for positive, left for negative.
  • Same signs: add and keep the sign. Different signs: subtract and keep the sign of the larger absolute value.
  • Subtracting equals adding the opposite: a − b = a + (−b).
  • Rewrite subtractions as additions to avoid sign errors.

Next: Multiplying and Dividing Integers

進捗を記録しよう

無料アカウントを作成すると、レッスンの完了を記録し、どの端末でも続きから学べます。