Negatives

“Negatives” (like negative numbers) are a great idea in many situations, but they can be tricky to learn and are a common source of mistakes. Here are some less-conventional ways to make them easier to work with, and hopefully easier to understand.

Caveat: I’m talking about normal, everyday maths here; nothing exotic, like finite fields or whatever!

NOTE: I will be using “over-bar” notation for negation (like 5¯unary_minus5)

You Ain’t Gonna Need It!

As always, we should avoid unnecessary complications where possible. Situations which are easily modelled without negative numbers shouldn’t have them shoe-horned in “for the sake of it”, or “by default” (the same way we shouldn’t default to fractions, complex numbers, surreal numbers, etc. when they’re not needed).

For example: Alice has 33 apples, Bob has 44 apples; Alice gives 22 apples to Bob, how many apples does Bob then have? Bob is gaining apples, so negatives aren’t needed. Of course, when a situation does make sense with negatives we should use them: e.g. extending the example to ask how many apples Alice ends up with, which we can model by adding 2¯unary_minus2 to her 33. We could instead use subtraction, but that also requires negatives (in case of “underflow”), so I prefer to stick with addition.

Whilst this may seem obvious, note that many programming languages get it wrong, e.g. encoding length as a (signed) integer, rather than an (unsigned) natural number; forcing callers to account for the negative cases.

Defining Negatives with Plus and Zero

We can define the “meaning” of negatives using the following property:

  1. x+x¯0 plusxunary_minusx0

In other words, the negative of something is whatever we can add to that thing to get a result of 00.

Note that this definition does not involve subtraction, since I consider subtraction to be more trouble than it’s worth.

The Negative of 00

We know that adding 00 to anything will leave that thing unchanged (00 is called the “identity” value for addition), i.e.

  1. x+0=x plusx0x

This tells us that, as a special case, 0+0=0 plus000 (in the case that x=0 x0). Since that sum equals 00, it fits our above definition of a negative. Hence the negative of 00 is itself 00:

  1. 0¯=0 unary_minus00

“Double Negatives” (Negatives of Negatives)

If we take the negative of something that’s already a negative, we get back the original thing:

  1. x¯¯=x unary_minusunary_minusxx
Proof

We can add 00 to a “double negative” without changing it (as per equation (2)):

x¯¯=x¯¯+0 unary_minusunary_minusxplusunary_minusunary_minusx0

We can replace 00 with the sum of a value and its negative (as per equation (1)). Let’s replace the 00 with the sum of xx and its negative x¯unary_minusx:

x¯¯=x¯¯+x+x¯ unary_minusunary_minusxplusunary_minusunary_minusxxunary_minusx

Let’s rearrange this sum, and introduce parentheses to make the next step clearer:

x¯¯=x+(x¯+x¯¯) unary_minusunary_minusxplusx(plusunary_minusxunary_minusunary_minusx)

The expression in the parentheses is the sum of a value (x¯unary_minusx) and its negative (x¯¯unary_minusunary_minusx), which is 00 (according to equation (1)):

x¯¯=x+0 unary_minusunary_minusxplusx0

Finally, we can get rid of the addition of zero since it doesn’t change the value (as per equation (2)):

x¯¯=x unary_minusunary_minusxx

QED

Hence such “double negatives” will “cancel out”.

Expanding, Contracting and Shifting Negatives

When negatives are multiplied, we can “expand” the bar to cover the whole multiplication:

  1. x¯y=xy¯ timesunary_minusxyunary_minustimesxy
Proof

Adding 00 to our multiplication won’t change its value (equation (2)):

x¯y=x¯y+0 timesunary_minusxyplustimesunary_minusxy0

We can replace that 00 with the sum of a value (xytimesxy) and its negative (xy¯unary_minustimesxy) as per equation (1):

x¯y=x¯y+xy+xy¯ timesunary_minusxyplustimesunary_minusxytimesxyunary_minustimesxy

The first two terms have a common factor of yy, which we can factor out:

x¯y=(x¯+x)y+xy¯ timesunary_minusxyplustimesplusunary_minusxxyunary_minustimesxy

Those parentheses contain the sum of a value (xx) and its negation (x¯unary_minusx), which is equal to 00 (equation (1)):

x¯y=0y+xy¯ timesunary_minusxyplustimes0yunary_minustimesxy

Multiplying by 00 always gives 00:

x¯y=0+xy¯ timesunary_minusxyplus0unary_minustimesxy

Finally we can remove the addition (as per equation (2)):

x¯y=xy¯ timesunary_minusxyunary_minustimesxy

QED

We can use the same approach for the second value (except we’ll get a common factor of xx in the proof), to show that:

  1. xy¯=xy¯ timesxunary_minusyunary_minustimesxy

These equations also tell us we can “contract” a bar from an entire multiplication down to just one of its factors.

In combination, these let us “shift” bars from one factor to another:

  1. x¯y=xy¯ timesunary_minusxytimesxunary_minusy

Multiplying Negatives

Consider the multiplication of two negatives: we can “expand” one of the bars to cover the whole product (as per equation (5)):

x¯×y¯=xy¯¯ unary_minusx×unary_minusyunary_minustimesxunary_minusy

From equation (6), we can replace xy¯timesxunary_minusy with xy¯unary_minustimesxy:

x¯×y¯=xy¯¯ unary_minusx×unary_minusyunary_minusunary_minustimesxy

This is a double negative, which cancels out (via equation (4)):

x¯×y¯=xy unary_minusx×unary_minusytimesxy

In this way, multiplications can always be simplified to contain either one negative, or no negatives at all.

The Role of 1¯unary_minus1

We can always multiply values by 11 without changing them, i.e. x=1x xtimes1x (we say 11 is the “identity” value for multiplication). This combines nicely with the expansion, contraction and shifting of negatives:

x¯=1x¯=1¯x unary_minusxunary_minustimes1xtimesunary_minus1x

This lets us think about a value’s “direction” (11 or 1¯unary_minus1) separately to its “size”; for example, whether a number is pointing “up” or “down” the number line.

Normal (Canonical) Forms

Having multiple ways to write the same thing can be convenient during a calculation, but we’d rather have a single way to write our “final result”; so it can be easily compared to other results (by just comparing the symbols).

Such notation is called a “normal form” (or “canonical form”), and may be familiar from dealing with fractions, where e.g. 2754 2754 and 36 36 appear to be different numbers. We can write these in normal form by removing common factors, to get 12 12 and 12 12; which are obviously identical.

In the case of products, we can introduce and eliminate factors of 11, and we can expand, contract and shift around negatives between factors. Hence there are many ways to write down the same value, and it would be nice to have a normal form for any “final results”. The most natural approach is the following:

For example, the following expression:

3x¯(y¯+z)+xy¯¯plustimes3unary_minusxplusunary_minusyzunary_minustimesxunary_minusy

Would have the following normal form:

3x(y¯+z)¯+xyplusunary_minustimes3xplusunary_minusyztimesxy

Note that the y¯+zplusunary_minusyz isn’t itself a product, so its negative can’t expand or shift around. We could also “multiply out” and factorise, but that’s more about “sums and products” rather than negatives, so I’ll leave it up to taste, e.g.

x(4y+3z¯)timesxplustimes4yunary_minustimes3z