Negative Digits
This page describes an elegant method for taking one number away from another, which I claim is simpler than the traditional “long subtraction” (that I was taught in school), and it requires no “carrying”. It uses the idea of negative digits, which also (in case you’re interested) happens to be a nice generalisation of the way we represent numbers!
Notation
“Taking away” is often represented as subtraction, written with a minus sign, like this (these are just arbitrary numbers, picked at random):
This is sometimes called a “binary minus sign”, since it acts on two numbers, written to its left and right.
I find subtraction to be overly-complicated, and instead prefer to add a negative. That would usually be written like this:
This time we have a “unary minus sign”, since it’s only acting on one number, written to its right (if you prefer, you can think of the unary minus sign as acting like a binary minus sign whose left-hand-side is always ).
Mixing between these two different “minus signs” is awkward, so I prefer to write negatives by giving them an over-bar, which looks like this:
This is the notation I’ll be using below. If you prefer, you can use subtraction and/or minus signs instead; although you may need to space-out your writing to keep things nicely aligned!
Reading
We’re familiar with how positive numbers are made from their positive digits, by treating each digit as a multiple of the base raised to decreasing powers (in decimal, the base is ten); for example:
In exactly the same way, we can interpret negative numbers as having negative digits, e.g.
In other words, we can read a negative number like in two ways: as the negative of (which itself is a sum of multiples of ), i.e.
Alternatively we can read as a sum of negative multiples of , e.g.
Setup
We’ll use the example above, and calculate . We’ll start by writing one number above the other, like in normal long-addition; since we’re adding, it doesn’t matter which goes above/below. We align their digits to the right, so the “ones” line up, the “tens” line up, etc. (I’ve also inserted a leading as “padding”). As per tradition, we write on the bottom left and draw a horizontal line underneath (our result will be written below this line):
|
Calculating
We proceed just as in long-addition, adding the right-most digits (the “ones”), and progressing to the left. Reading negative numbers as a sequence of negative digits lets us do two things: firstly, we will apply the usual digit-by-digit algorithm regardless of whether they’re positive or negative; and secondly we’ll allow our answer to use both positive and negative digits if needed.
Let’s start with the right-most column: . Their sum is , so that’s the right-most digit of our answer:
|
|
Moving left one column, we need to calculate , which equals , so that’s the next digit of our answer. Note that the usual long-subtraction algorithm would give up here, and ask us to “carry a one” from the third column!
|
|
Our result now contains positive and negative digits, but that’s fine. We can proceed through the rest: , , , . The overall result is:
|
|
Note that we performed the above calculation by working right-to-left through the digits, but that’s not actually required: we can add up the columns in any order, since they’re all independent (unlike traditional long-subtraction, where some columns need to carry/borrow from others).
Normalising
Writing negative numbers with negative digits is fine, but our result has a mixture of positive and negative digits. Such representations are redundant, similar to writing a fraction like (which should be reduced to ). We can likewise reduce a number which mixes positive and negative digits.
When we think of such numbers as a sum, like , then the positive digits are pushing up the total, and negative digits are pushing it down. Numbers with mixed digits are pushing in both directions, which is the cause of redundancy: for example, is just an awkward way of writing , and is just .
The less-significant digits (those to the right) cannot represent numbers larger than the more-significant digits (to the left), so the overall sign of the result will match that of the most-significant/left-most digit. In our example that’s , which is positive, so the whole number is positive; and hence we can reduce it to using only positive digits. Thankfully we can split up the problem, replacing one pair of neighbouring digits that have opposite signs, and repeating until they all have the same sign.
We can start with the first two digits, : technically these represent , but we can ignore the common factor of and treat them like the two-digit number . This is just a convoluted way of writing the number , so we can replace those two digits and write our total as . This still has a mixture of digits, so we can replace the mis-matched pair to get ; then to get which no longer contains mixed digits, and is hence fully reduced.
Note that this reduction has not changed the overall number we calculated: all of the above steps are just different ways to write the same thing. We can check this by adding each of them to to ensure that we get every time.
First, we can see that the original mixed-digit answer does indeed work:
|
|
The first step of our reduction is also valid:
|
|
The next step of the reduction also works (although the check now involves a carry):
|
|
|
|
Finally we can show that the fully-reduced form, with all-positive digits, is indeed the correct answer (this time requiring two carries!):
|
|
|
|