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):

10284367592 10284367592

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:

102843+(67592)plus102843unary_minus67592

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 00).

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:

102843+67592¯plus102843unary_minus67592

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 67592¯unary_minus67592

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:

142=1×102+4×101+2×100=100+40+2 142plustimes1 102times4 101times2 100plus100402

In exactly the same way, we can interpret negative numbers as having negative digits, e.g.

142¯=1¯×102+4¯×101+2¯×100=100¯+40¯+2¯ unary_minus142plustimesunary_minus1 102timesunary_minus4 101timesunary_minus2 100plusunary_minus100unary_minus40unary_minus2

In other words, we can read a negative number like 67592¯unary_minus67592 in two ways: as the negative of 6759267592 (which itself is a sum of multiples of 1010), i.e.

67592¯=1¯×67592=1¯(60000+7000+500+90+2) unary_minus67592timesunary_minus167592timesunary_minus1plus600007000500902

Alternatively we can read 67592¯unary_minus67592 as a sum of negative multiples of 1010, e.g.

67592¯=60000¯+7000¯+500¯+90¯+2¯ unary_minus67592plusunary_minus60000unary_minus7000unary_minus500unary_minus90unary_minus2

Setup

We’ll use the example above, and calculate 102843+67592¯plus102843unary_minus67592. 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 00 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):

102843102843
+ 067592¯unary_minus067592

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: 3+2¯plus3unary_minus2. Their sum is 11, so that’s the right-most digit of our answer:

102843102843
+ 067592¯unary_minus067592

11

Moving left one column, we need to calculate 4+9¯plus4unary_minus9, which equals 5¯unary_minus5, 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!

102843102843
+ 067592¯unary_minus067592

5¯1

Our result now contains positive and negative digits, but that’s fine. We can proceed through the rest: 8+5¯=3 plus8unary_minus53, 2+7¯=5¯ plus2unary_minus7unary_minus5, 0+6¯=6¯ plus0unary_minus6unary_minus6, 1+0¯=1 plus1unary_minus01. The overall result is:

102843102843
+ 067592¯unary_minus067592

16¯5¯35¯1

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 68 68 (which should be reduced to 34 34). We can likewise reduce a number which mixes positive and negative digits.

When we think of such numbers as a sum, like 16¯5¯35¯1=100000+60000¯+5000¯+300+50¯+1, 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, 10+7¯plus10unary_minus7 is just an awkward way of writing 33, and 30¯+2plusunary_minus302 is just 28¯unary_minus28.

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 11, 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, 16¯1unary_minus6: technically these represent 100000+60000¯plus100000unary_minus60000, but we can ignore the common factor of 1000010000 and treat them like the two-digit number 16¯=10+6¯ 1unary_minus6plus10unary_minus6. This is just a convoluted way of writing the number 0404, so we can replace those two digits and write our total as 45¯35¯14unary_minus53unary_minus51. This still has a mixture of digits, so we can replace the mis-matched pair 45¯=40+5¯=35 4unary_minus5plus40unary_minus535 to get 3535¯1353unary_minus51; then 35¯=30+5¯=25 3unary_minus5plus30unary_minus525 to get 3525135251 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 6759267592 to ensure that we get 102843102843 every time.

First, we can see that the original mixed-digit answer does indeed work:

16¯5¯35¯11unary_minus6unary_minus53unary_minus51
+ 6759267592

102843102843

The first step of our reduction is also valid:

45¯35¯14unary_minus53unary_minus51
+ 6759267592

102843102843

The next step of the reduction also works (although the check now involves a carry):

3535¯1353unary_minus51
+ 6759267592

9284392843
+ 1000010000

102843102843

Finally we can show that the fully-reduced form, with all-positive digits, is indeed the correct answer (this time requiring two carries!):

3525135251
+ 6759267592

9274392743
+ 1010010100

102843102843