Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re (tilly) 1: More Fun with Zero!

by tilly (Archbishop)
on Jul 23, 2001 at 16:56 UTC ( #98996=note: print w/ replies, xml ) Need Help??


in reply to More Fun with Zero!

I have to agree with what everyone said, but I am going to try to give explanations that don't involve Calculus since most people don't know Calculus.

There is a field of mathematics called "Combinatorics". You may not know what that is, but it isn't as scary as Calculus because it is not nearly as complicated. This field is about studying the ways of combining a finite number of things, and typically what you study is the number of ways of counting things. So from the point of view of combinatorics, what are the operations +, *, **, and factorial?

Well m + n is the operation of taking two groups of m and n things, putting them together, and then counting the combined group. So 0+0 is putting nothing with nothing and counting nothing, so you get 0 again.

As we all know, m * n is the operation of taking m things along one axis, n things along another axis, creating a rectangle, and then counting up unit squares in the rectangle. So 0*0 is making a rectangle with no height and no width then realizing that its area is 0, so you get 0 back.

Analogies with these two familiar operations are probably why many people have incorrect expectations of what happens with powers and factorial.

When we write mn what we are counting are the number of ways there are to pick out n things from a set of m in order with repetition allowed. Since each choice you make gives you m times as many things, we are used to calculating it with m*m*...*m where the number of m's is n. But that calculation leaves many of us confused over what 00 is supposed to be. Well forget the formula, go back to basics. If I want to pick nothing from no things, I can do nothing! There is no other thing I can do, but I do have one way to accomplish the task. And that is to look back, grin, and say I have no work to do, the task is accomplished!

So 00 is 1 since there is one way to pick nothing from no things.

Similarly with factorial. n! is the number of ways to arrange n things in order. Again we have a well-known formula for it. But again the well-known formula does not give most people any insight as to what 0! should be. But right now take a look at a collection of no things. Well they are in an arrangement already, can we rearrange them? Not that I can see! So there is exactly one way to arrange 0 things in order, and that is to leave that space empty! Therefore 0! is 1.

Still not convinced? Well there is a more fundamental mathematical principle at work here. In many places in mathematics you have formulas where you have to add two sets of things together. So you can add them up separately and then add together the sums. In others you want to multiply two sets of things together. So you multiply them separately and then multiply together the products. ariels offers examples of both involving the binomial theorem and Taylor series. But the concept is clear.

But the special case that arises is what you do when one of the sets has no things in it? How do you add together no things? How do you multiply no things? What answer makes sense?

Well the overriding principle is that how you divide a set up first should make no difference to the final sum or product. So if I take a set of numbers and break it into that set and an empty set, add them separately, then add them together, I have to come to the actual sum. Which is only going to work if adding the sum of no things doesn't change anything. Ditto for multiplication. Multiplying a set of numbers together should be the same as breaking it into the entire set and an empty set, multiplying them separately, then multiplying them together.

As we all know, the only thing you can add and not change anything is 0, for which reason 0 is called the additive identity. Therefore the empty sum is always 0 in mathematics. Likewise 1 serves the same role in multiplication that 0 serves in addition. Multiplying by 1 changes nothing. So the only reasonable answer to get from multiplying nothing is 1. And since powers and factorial both work out to be formulas that involve a series of multiplications, not additions, the answer in the degenerate case (ie 0! and n0) is an empty product which is 1.


As for division by 0, there is a simple reason for making that a trappable error. The vast majority of the time when a programmer winds up dividing by 0, that wasn't what was intended and is a sign of a fairly serious bug. So you don't want to make it undef and sweep it under the rug. However there are times when the programmer needs to check the error so you make it trappable.

You might not believe me, but if you do a lot of programming with numbers, just pay attention. Most of the time when you get that error, was it a sign of something that was really wrong? (It is for me.)

UPDATE
jynx pointed out an obvious typo.


Comment on Re (tilly) 1: More Fun with Zero!
Select or Download Code
Don't be scared of Combinatorics
by John M. Dlugosz (Monsignor) on Jul 24, 2001 at 01:00 UTC
    Yea, Combinatorics should be much more interesting to the layman than Calculus. It was invented so that he could be a better poker player!
Re: Re (tilly) 1: More Fun with Zero!
by John M. Dlugosz (Monsignor) on Jul 24, 2001 at 01:06 UTC
    Hmm, how many ways are there to pick no things from n things, when n is not zero, but say 42?

    I can not pick the first item. I can not pick the second item. By your reasoning, the answer to n**0 should be the power set of n.

    If "doing nothing" is allowed as an operation, then that messes up the normal cases, too. Say you want to choose 3 items. You pick three, but then can optionally not pick any of the others.

      You are confusing yourself with verbal games.

      The ways of choosing spoken of have to do with what choices are made, in what order. They do not speak of whether the choice is made by entering an electronic record, shouting to a crowd, or with a quill pen. It is irrelevant how many bathroom breaks you take in your arduous task. It is all a question of what choices you made in what order.

      There is one way to make no choices from 42 things. It matters not whether you describe this as failing to turn your paper in, or turning in a blank paper.

      There are 42 ways to make one choice from 42 things. It matters not how many times you think of making no choices, they don't get recorded.

      There are 1764 ways to make 2 choices with repetition allowed from 42 things. If you think of the operation as making a choice, making no choices 500 times, and then making your second choice, it matters not. The number of pauses is not relevant, and each time you don't choose you have only 1 way to do that. With this strange model you have complicated the overall calculation by multiplying by 1 500 times, which changes nothing.

      I could go on, but I think the point is clear. From number theory to combinatorics to analytics it is widely accepted that an empty sum is 0 and an empty product is 1. This does not mess up the usual model of anything. In fact it is the usual model used by mathematicians...

      Given a set containing N elements, how many different subsets are there that contain P elements? For P==0, the answer is always 1, the empty set.

      Does that make it easier for you to understand? Update: Um, that sounds harsher than I intended it. For what it's worth, I found tilly's explanation hard to understand. I knew what he was getting at but the way he described there being only one possible choice of actions (no action) wasn't convincing to me, even leading me to thinking "there is no way to pick 0 things from 0 things because there is nothing to pick from". But changing terminology makes it very easy to understand, I think. The only choice I can make is to give you the empty set, the set that contains no items. So I'm not giving you zero sets, I am giving you one set.

              - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://98996]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-10-22 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (119 votes), past polls