Wednesday, December 21, 2011

Why 1 ≠ 2 (and how divide by zero can work)

So, the argument is posed that:

0 * 1 = 0
0 * 2 = 0


0 * 1 = 0 * 2

So far so good, but according to the rules of algebra, you can add any operation to 1 side as long as you do it to the other side so let's add a division by 0:

(0 * 1)/0 = (0 * 2)/0


0 * (1/0) = 0 * (2/0)


(0/0) * 1 = (0/0) * 2

and through simplification of x/x = 1:
(1) * 1 = (1) * 2

Obviously this is not correct...

As I talked about in my last blog entry, x/0 = {}, the answer to a division by zero is actually a set. Now the question is, what is returned in the set? Is it always -inf to inf? Or is there a relevance factor that has to be taken into account that returns a subset?

Let's say for a moment that 0/0 = {-inf, inf}.

the the above proof actually translates to:

{-inf, inf} * 1 = {-inf, inf} * 2

which is true. All numbers multiplied by 2 results in the same numbers as all numbers multiplied by 1.

But let's try breaking it by dividing both sides by {-inf, inf}:

({-inf, inf}/{-inf, inf}) * 1 = ({-inf, inf}/{-inf, inf}) * 2

Well, now we're back in trouble.

Or are we? If we treat these sets as matrices with an infinite number of values ranging from -inf to inf then we can almost do this! The only problem we face is that the matrices are all in the same dimension. What if we made a rule that said if the matrices are in the same dimension, that one (perhaps the bottom one) should always be transposed? From there we simply invert and multiply.

The result would simply become:
inf * 1 = inf * 2

Which is again true since infinity is as big as you can get. OK, it is said that some infinities are bigger than others, but really? Infinity literally means "boundless" or "without limit". You can get an equation that solves to 2*inf, but like any x*0=0, any x*inf really is just inf.

x / 0 = {}

It has been a very long time since I posted here, but I have just had a Eureka! moment.

Since I have started this blog, I have contemplated what 0^0 means, and what x/0 means, and I have been stumped by the lack of a truly real world example that has a neat mathematical equation to go with it. Sure pies are nice, but they leave room for debate.

Lately, I have been working with geometry for 3D image rendering, and I cam across an interesting problem: How do I get the Z coordinate of a point in a triangle when given the X and Y coordinates?

That's easy enough; Use the 3 vertices of the triangle to determine the plane the triangle sets on, and then solve the plane equation:

Ax + By + Cz + D = 0

for the Z coordinate:

z = (-Ax-By-D) / C = x(-A/C) + y(-B/C) + (-D/C)

So here is an obvious situation of x/0, and when you are programming, you need to define the answer so your program doesn't crash.

What does x/0 mean here?
It means you are looking at a plane parallel to the Z axis is what it means. And this is a very real world situation that has a very clear mathematical expression.

A real world example would be, say you are standing on a street corner and you point at the side of a building. Your finger (or what ever pointing apparatus you might be using) points at a single spot on the wall. You can clearly establish one answer. You are pointing at a spot that is 5feet above the side walk and 20feet from the front of the building and that spot is 150feet away from you. Your example may differ, but this illustrates the point.

Now, say you moved yourself so you were in perfect alignment with the wall (so you are on the same plane as it is) and you point at that same spot on the wall. What you will likely think is that you are now actually pointing at the front corner of the building, and you would be right. But imagine the line your finger (or pointing apparatus) makes. It goes through that front corner and extends all the way along the wall. By pointing at the wall, you are actually pointing at many points on that wall at the same time!

You are pointing at that spot on the wall, so that spot is real, and is a valid answer to the question "What are you pointing at?" But you should also realize that you are pointing at every spot on the line that is formed by you pointing at that one spot. This means that there is actually a whole set of correct answers. Remember how you were thinking you were pointing at the front corner of the building? That was ALSO a valid answer!

This proves that what divide by zero represents is multiple answers at once! It's not necessarily infinity, and it's not necessarily 0 or 1 or anything.

In the pure plane equation, for any given X and Y pair that looks down a plain parallel to the Z axis, all the answers from -infinity to +infinity are valid answers.

C = 0 therefore z = (-Ax-By-D) / C = {-inf, inf}

Now, my notation may not be perfect but I wasn't a math major, but this is clear enough to state the point.

In the case of our wall, only a subset of those answers are correct. We have stated that we are pointing at a point ON the wall. The wall does not extend for forever, so the answers are only valid from one side of the wall to the other.

Say you are the reference point so our wall starts 5 feet away and ends 100 feet away. We can say that the range of valid answers are between 5 and 100 feet.
C = 0 therefore z = (-Ax-By-D) / C = {5, 100}

You could even reduce the set to exactly one answer if you defined the parameters well enough. For instance you could just say you are pointing at the front corner of the building. Then our answer is simply:
C = 0 therefore z = (-Ax-By-D) / C = {5}

The whole set of the possible answers is made up of only 1 answer.

And thus x/0 IS defined as a set.