Lair Of The Multimedia Guru

July 21, 2006

Division by zero

Have you ever been curious why you cant divide by zero?

The intuitive explanation with division of positve integers

To divide a by b means to remove b as often as possible from a and assign the number of times which you could do that to a/b, and whats left as the remainder of the division
if b is 0 you can remove it as often or as rare as you want, nothing will ever change

The intuitive explanation with division as the inverse of multiplication

If you have a number a and multiply that by b then divide
by b, so a*b/b then you should get a again if division reverses what multiplication did, but if b is 0 then a*b is a*0 which is 0 no matter what a was, so theres no information left about the value a had and consequently no way to reverse it

The Analytical explanation

if a is non zero constant, then a/b diverges to infinity as b approaches 0, and it converges to x if a=xb
note its important to remember here that the limit of a/b as b approaches 0 is not the same as a/0

The Algebraic explanation

All the above really just deals with the common numbers like integers, reals, complex numbers, …
so you might ask yourself if its not maybe possible to invent some other algebra (set of elements with some operations like addition and multiplication) in which we can divide by zero, well the awnser is of course you can, the problem is just that you have to give up some of the well known properties of common numbers
Lets see which set of properties is incompatible with division by zero
to speak about division by zero we need at least

  1. a set of elements S for our algebra A
  2. an additative identity element (x + 0 = 0 + x = x for all x)
    we use “0” here for simplicity even though the element doesnt need to be related to our well known zero
  3. of course a + and * operation, which again of course doesnt have to be the same as common addition and multiplication
  4. 0 to have a inverse ((x*0)*0-1 = x for all x)

with that set of rules one can easily find many algebras in which you can divide by zero, for example just define the * operation to be identical to + and that identical to the common addition, division by zero is just subtraction by zero, totally useless but it works :)
anoter property we likely want is a multiplicative identity element (x * 1 = 1 * x = x for all x) and the distributive law (a+b)*c= a*c + b*c and c*(a+b)= c*a + c*b sadly that already starts causing problems:

0*0 + 0= 0*0 definition of the identity element of +
0*0 + 1*0 = 0*0 definition of the identity element of *
(0 + 1)*0 = 0*0 distributive law
1*0 = 0*0 definition of the identity element of +
1 = 0 inverting the multiplication by 0

so our algebra would need the identity element of + and the identity element of * to be identical, hmm …

and another odd result:

x*1 = x definition of the identity element of *
x*(1+1) = x definition of the identity element of + and 1=0
x+x = x distributive law

now the question is, is there actualy a non trivial (more then 1 element) algebra left at all?
it seems there is: assume our algebra has 2 elements: “0” and “#”
and we define addition and multiplication like:

+/* 0 #
0 0 #
# # #

its immedeatly obvious that the rules for the 2 identity elements hold
does the distributive law hold too? it does which can be proofen by simply looking at the 8 possible cases, and an inverse element for multiply by 0 well 0 is its own inverse obviously

next, we drop the multiplicative identity element again and try to add a unique multiplicative inverse element x for every element instead of just for zero (a*x=b for all a,b), without that we would either just change the division by zero in a division by foobar problem or we wouldnt be able to reach some elements, sadly only the trivial 1 element algebra is left then:

a*b = a*(b+0) definition of the identity element of +
a*b = a*b+a*0 distributive law
0 = 0+a*0 choose b so that a*b=0
0 = a*0 definition of the identity element of +
0*0-1 = a invert multiplication by zero

the last line means: every algebra with the properties above will have exactly one element and be useless
alternatively if we replace the property that every element must have a unique multiplicative inverse by requiring addition to be invertable ((a+b) + (-b) = a) then we too end up with the useless 1 element algebra:

a=(a*0)*o-1 definition of the inverse of 0
a=(a*(0+0))*0-1 definition of the identity element of +
a=(a*0 + a*0)*0-1 distributve law
a=(a*0)*0-1+(a*0)*0-1 distributve law
a=a + a substituting from row 1
0=a inverting the addition of a

i guess thats enough math for today, and enough chances to embarrass myself with a trivial typo somewhere …

Filed under: Uncategorized — Michael @ 11:25

2 Comments »

  1. Sure but if you generalize your algebraic system a bit and give up some (or all?) of the nice properties, you can have an algebraic division by zero. Just look at IEEE floating point. :-) I’m sure there’s a good deal of disagreement over whether or not IEEE inf/nan semantics are “nice” but it tends to do “the right thing” and sure beats exception handling IMO.

    An interesting aside: one might thing that having an infinity element is “wrong” because it’s destructive or absorbing, in the sense that INF+x == INF for all x (except -INF). However this is actually true of almost all floating point numbers. For instance if y=2**80 then y+x == y as long as x is fairly small (how small is left as an exercise to the reader). So in a sense, this “misbehavior” is nothing special about infinity, but a nasty property of fixed precision floating point in general. Said differently, infinity is just like a “really big” floating point number at least 2**n times as large as any other, where n is the number of bits in the significand.

    Interested readers unfamiliar with floating point should read this classic article:
    http://docs.sun.com/source/806-3568/ncg_goldberg.html

    Comment by Rich — August 2, 2006 @ 0:07

  2. > Sure but if you generalize your algebraic system a bit and give up some (or all?) of
    > the nice properties, you can have an algebraic division by zero. Just look at IEEE
    > floating point. :-) I’m sure there’s a good deal of disagreement over whether or not
    > IEEE inf/nan semantics are “nice” but it tends to do “the right thing” and sure
    > beats exception handling IMO.

    i do like the IEEE inf/nan semantics, and about loosing nice properties, well how many are strictly true for floating point numbers at all?
    associativity : try huge_val – huge_val + 1
    distributivity: try (huge_val – huge_val)*huge_val (overflow)
    inverse : a * (1/a) (here 1/a probably cant be represented exactly)
    a*b=0 requires a or b to be 0: try 2 really small numbers

    Comment by Michael — August 2, 2006 @ 1:18

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress