TExcelTAD
Home › Basic Math & Pre-Algebra › Signed Numbers

Signed Numbers

Signed numbers carry a direction: positive numbers point one way, negative numbers the other. Temperatures below zero, a bank account in the red, a step to the left, a velocity downward: all of them need a minus sign. This lesson gives the rules for adding, subtracting, multiplying and dividing them, and shows why those rules make sense.

What the sign means

A signed number has a sign (++ or −-) and a size. The size is its distance from zero, called the absolute value. On the number line, +3 is three steps right of zero, and −3 is three steps left. Numbers like 3 and −3, at the same distance on opposite sides, are opposites. The plus sign is usually left out: 3 means +3.

The minus sign has two jobs that look identical: subtract (8−38 - 3) and negative/opposite of (−3-3, or −x-x). In fact "−(−3)-(-3)" means "the opposite of −3", which is 3.

Adding signed numbers

Think of adding as walking on the number line: a positive number is a walk to the right, a negative one a walk to the left.

Case Rule Example
same signs add the sizes, keep the sign (−4)+(−6)=−10(-4) + (-6) = -10
different signs subtract the smaller size from the larger, take the sign of the larger (−9)+5=−4(-9) + 5 = -4, 9+(−5)=49 + (-5) = 4
opposites the sum is zero (−7)+7=0(-7) + 7 = 0

A money picture helps: owing 4 dollars and then owing 6 dollars more means owing 10 dollars (−4+−6=−10-4 + -6 = -10). Owing 9 dollars and earning 5 dollars still leaves you owing 4 dollars (−9+5=−4-9 + 5 = -4).

Subtracting: add the opposite

Every subtraction can be rewritten as an addition: subtracting a number is the same as adding its opposite.

7−10=7+(−10)=−3−2−5=−2+(−5)=−74−(−6)=4+6=10−8−(−3)=−8+3=−5\begin{aligned} 7 - 10 &= 7 + (-10) = -3 \\ -2 - 5 &= -2 + (-5) = -7 \\ 4 - (-6) &= 4 + 6 = 10 \\ -8 - (-3) &= -8 + 3 = -5 \end{aligned}

The surprising one is 4−(−6)=104 - (-6) = 10. Taking away a debt makes you richer: if someone cancels a 6-dollar debt you owed, your balance goes up by 6 dollars. On a thermometer, the difference between 4 °C and −6 °C is 10 degrees.

python · try it yourself
pairs = [(7, 10), (-2, 5), (4, -6), (-8, -3)]
for a, b in pairs:
    print(f"{a} - ({b}) = {a - b}   same as  {a} + ({-b}) = {a + (-b)}")
7 - (10) = -3   same as  7 + (-10) = -3
-2 - (5) = -7   same as  -2 + (-5) = -7
4 - (-6) = 10   same as  4 + (6) = 10
-8 - (-3) = -5   same as  -8 + (3) = -5

Multiplying and dividing

The rule for both is about the signs only:

Signs Result Examples
++ and ++ ++ 3×4=123 \times 4 = 12, 12÷4=312 \div 4 = 3
−- and −- ++ (−3)×(−4)=12(-3) \times (-4) = 12, (−12)÷(−4)=3(-12) \div (-4) = 3
++ and −- (either order) −- 3×(−4)=−123 \times (-4) = -12, (−12)÷4=−3(-12) \div 4 = -3

Short version: same signs give positive, different signs give negative. With many factors, count the negatives: an even number of them gives a positive product, an odd number gives a negative one. (−1)×(−1)×(−1)=−1(-1) \times (-1) \times (-1) = -1.

Why is negative ×\times negative positive? Look at a pattern, where each step down subtracts 1 from the second factor:

python · try it yourself
for b in [3, 2, 1, 0, -1, -2, -3]:
    print(f"-3 x {b:2d} = {-3 * b:3d}")
-3 x  3 =  -9
-3 x  2 =  -6
-3 x  1 =  -3
-3 x  0 =   0
-3 x -1 =   3
-3 x -2 =   6
-3 x -3 =   9

Each line is 3 more than the one above. For the pattern to keep going past zero, −3×−1-3 \times -1 must be 3. Any other rule would break the distributive property: (−3)×(1+(−1))=(−3)×0=0(-3) \times (1 + (-1)) = (-3) \times 0 = 0, which forces (−3)×(−1)(-3) \times (-1) to be the opposite of (−3)×1=−3(-3) \times 1 = -3, so it is +3.

Signed numbers in code

Python's integers and floats are signed, and all the rules above are built in. Two details are worth knowing: unary minus binds tighter than most things but not tighter than **, and -0.0 exists for floats.

python · try it yourself
print(-3 ** 2)        # means -(3 ** 2)
print((-3) ** 2)
print((-2) ** 3, (-2) ** 4)
print(-12 / -4, 12 / -4)
print(-0.0, -0.0 == 0.0)
-9
9
-8 16
3.0 -3.0
-0.0 True

-3 ** 2 being −9 catches many people out; it matches the mathematical convention that −32-3^2 means −(32)-(3^2). Write (-3) ** 2 when you mean the square of −3.

In software

  • Coordinates: in maths the yy axis points up, but on screens (HTML canvas, most 2D game engines) yy grows downward. Jumping means a negative yy velocity there.
  • Velocities and forces in physics code are signed: −9.8 m/s2-9.8\ \text{m/s}^2 is gravity pulling down.
  • Money: a refund is a negative charge; balances can go below zero.
  • Signed integer types store the sign in the top bit (two's complement, see Integer Overflow and Two's Complement). An 8-bit signed number holds −128 to 127.

Exercises

Exercise 1: Add and subtract

Compute (a) −8+13-8 + 13 (b) −6+(−9)-6 + (-9) (c) 5−125 - 12 (d) −4−(−11)-4 - (-11)

Answer

(a) 5 (b) −15 (c) −7 (d) 7

Solution
(a) different signs: 13−8=5, larger size is +13→ 5(b) same signs: 6+9=15, keep −→ −15(c) 5+(−12): 12−5=7, larger size is −12→ −7(d) −4+11: 11−4=7, larger size is +11→ 7\begin{aligned} &\text{(a) different signs: } 13 - 8 = 5,\ \text{larger size is } {+13} && \to\ 5 \\ &\text{(b) same signs: } 6 + 9 = 15,\ \text{keep } {-} && \to\ -15 \\ &\text{(c) } 5 + (-12){:}\ 12 - 5 = 7,\ \text{larger size is } {-12} && \to\ -7 \\ &\text{(d) } {-4} + 11{:}\ 11 - 4 = 7,\ \text{larger size is } {+11} && \to\ 7 \end{aligned}

Exercise 2: Multiply and divide

Compute (a) (−7)×6(-7) \times 6 (b) (−8)×(−5)(-8) \times (-5) (c) 56÷(−8)56 \div (-8) (d) (−2)×(−3)×(−5)(-2) \times (-3) \times (-5)

Answer

(a) −42 (b) 40 (c) −7 (d) −30

Solution

(a) different signs → negative. (b) same signs → positive. (c) different signs → negative. (d) three negatives (odd) → negative, and 2×3×5=302 \times 3 \times 5 = 30.

python · try it yourself
print((-7) * 6, (-8) * (-5), 56 // -8, (-2) * (-3) * (-5))
-42 40 -7 -30

Exercise 3: Temperature swing

At 6 a.m. it was −11 °C; by 2 p.m. it was 4 °C. By how much did the temperature rise? If it then fell 9 degrees, what was the new temperature?

Answer

It rose 15 degrees; then it was −5 °C.

Solution
rise=4−(−11)=4+11=15after falling 9: 4−9=−5\begin{aligned} &\text{rise} = 4 - (-11) = 4 + 11 = 15 \\ &\text{after falling 9: } 4 - 9 = -5 \end{aligned}

Exercise 4: Sign of a product

Without multiplying, decide the sign of (−1)×2×(−3)×4×(−5)×6×(−7)(-1) \times 2 \times (-3) \times 4 \times (-5) \times 6 \times (-7). Then check with math.prod.

Answer

Positive (four negative factors); the product is 5 040.

Solution

Count the negatives: −1, −3, −5, −7 is four, an even number, so the product is positive. Its size is 1×2×3×4×5×6×7=5 0401 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 = 5\,040.

python · try it yourself
import math

print(math.prod([-1, 2, -3, 4, -5, 6, -7]))
5040

Test yourself

What is −5−(−8)-5 - (-8)?

  1. 3
  2. −13
  3. −3
  4. 13

What does Python print for -4 ** 2?

  1. 16
  2. -16
  3. 8
  4. -8

The product of five negative numbers is…

  1. always positive
  2. always negative
  3. zero
  4. positive or negative, depending on the numbers