20

I have come across this problem in a calculation I do in my code, where the divisor is 0 if the divident is 0 too. In my code I return 0 for that case. I am wondering, while division by zero is generally undefined, why not make an exception for this case? My understanding why division by zero is undefined is basically that it cannot be reversed. However, I do not see this problem in the case 0/0.

EDIT OK, so this question spawned a lot of discussion. I made the mistake of over-eagerly accepting an answer based on the fact that it received a lot of votes. I now accepted AakashM's answer, because it provides an idea on how to analyze the problem.

Community
  • 1
  • 1
Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
  • Why not? At which point would the theory break? – Björn Pollex Jul 13 '10 at 11:08
  • 3
    Nowhere - the theory says that the result of 0/0 is undefined. The implementation of your language on the computer will reflect this by sidestepping giving you a numerical answer. – Carl Smotricz Jul 13 '10 at 11:10
  • 21
    God divided by zero and as a result there are black holes, so do you really want to divide by zero? ^^ –  Jul 13 '10 at 11:15
  • 50
    Jon Skeet can divide by zero. – Phil.Wheeler Jul 13 '10 at 11:20
  • 3
    WARNING: Dividing by zero. Please wear safety glasses. – Brian Hooper Jul 13 '10 at 11:33
  • 6
    @Brian The goggles, they do nothing! – Mornedhel Jul 13 '10 at 14:58
  • 6
    To those who want to reopen this: First of all, it is pure mathematics, not programming (i.e. "off-topic"). Secondly, it is a matter of definitions (i.e. "subjective and argumentative"). Finally, it is stupid. sinc(x) = sin(x) / x can be defined to be equal to unity at the origin, because it makes sense. lim sin(x)/x = 1 as x -> 0. But lim x/y does not exist as (x, y) -> (0, 0). You get 1 if x = y, 0 if x = 0, and the limit diverges if y tends to zero faster than x. – Andreas Rejbrand Jul 13 '10 at 18:33
  • 9
    The wonders of Stack Overflow never cease. Among the upvotes on this trivial thread at the moment are 8 for the question and 48+31+7+… for answers, with the top voted answer being an *incorrect* one that says meaningless things like "anything divided by 0 is infinity". Wow. – ShreevatsaR Jul 13 '10 at 18:34
  • 2
    @ShreevatsaR I have to totally agree. Some of my answers (few, compared with the "big guys" here) took > 30minutes to write and think, and I get 0 for it, not evan "thank you for taking the time". I realy anger about such totally useless threads like this that ppl get massiv reputation for it. Its math, and only a mathematican can tell us exactly the whole "0/0" thing, which is at least totaly uninteresting when entering stackoverflow. – InsertNickHere Jul 13 '10 at 18:53
  • A compiler would generally have to output more code to force a particular result in the case of 0/0. Would enough programs benefit from such special-case behavior to justify adding special code to all of them? – supercat Jul 13 '10 at 19:10
  • 3
    I just voted to reopen. Yes it's a math question, but last time I checked, programming involved a lot of math. It's pretty clear that the issue for this person came up in the course of writing a program and not when doing his algebra homework. Will we next close all questions about color codes becauses that's "optics" and not programming? – Jay Jul 13 '10 at 20:09
  • 1
    @Andreas: The fact that you know the answer does not make a question "stupid". I'm sure that you have asked questions that others consider very obvious. Must we outlaw all questions that you know the answer to as unworthy of being asked? Are people who know less than you not allowed to learn? – Jay Jul 13 '10 at 20:16
  • @Jay: Everything useful has already been said, along with a lot of rubbish (including the accepted answer). There's nothing more to say, so no reason to reopen. – ShreevatsaR Jul 13 '10 at 20:57
  • 2
    @ShreevatsaR: If you believe that there is nothing more useful to say on this topic, then don't visit this question any more. Why prevent others from discussing it? If you think something said is incorrect, why not politely point out the flaw, rather than vandalizing other people's posts and spouting insults? What are you so excited about? Did someone insult your mother in here or something? – Jay Jul 14 '10 at 14:49
  • 1
    @Shr "There's nothing more to say, so no reason to reopen" is a terrible reason to leave something closed – Michael Mrozek Jul 14 '10 at 15:24
  • @Michael, @Jay: Questions should be open if further answers may add something. What we have here is a typical bikeshed problem. Worse, it appeared that incorrect answers were getting most upvoted, misleading not just those who read the answers now, but everyone who arrives this page in future. This is actual harm. (I never insult any persons but only contents of text. BTW, several people including myself politely pointed out the flaw and waited for hours/days but the user did not correct his post. It's ok to edit others' posts, that's why the feature is there. It should be used more often.) – ShreevatsaR Jul 14 '10 at 16:06
  • @InsertNickHere The only reason why I wrote the answer was that I was asked why... It wasn't a answer I expected a stupid number of upvotes for. In a way I am glad that it wasn't my answer that was accepted as I have the feeling that the people who wrote the answers with less than 10 upvotes have a far better understanding of the problem than I do. – Yacoby Jul 15 '10 at 23:39
  • Why can you never divide by zero? Dividing by zero would mean multiplying by the reciprocal of 0. But 0 has no reciprocal. Therefore, division by 0 has no meaning in the set of real numbers. – user 726941 Apr 02 '15 at 17:23

18 Answers18

76

Let's say:

0/0 = x

Now, rearranging the equation (multiplying both sides by 0) gives:

x * 0 = 0

Now do you see the problem? There are an infinite number of values for x as anything multiplied by 0 is 0.

John Topley
  • 113,588
  • 46
  • 195
  • 237
Yacoby
  • 54,544
  • 15
  • 116
  • 120
  • 1
    Not downvoted myself but multiplying by zero is undefined. Example x = 1 has a clear result for x , but x * 0 = 1 * 0 does not. So mult by zero is an invalid transformation. – josefx Jul 19 '10 at 20:38
  • 12
    Mutliplying by 0 has a clear result... 0. This is the basis of a lot of maths. – Yacoby Jul 19 '10 at 21:19
  • Yeah it is also good to prove 1 = 2. After all we can do 1 = 2 => 1 * 0 = 2 * 0 => 0 = 0 => true. Or x = 1 => x * 0 = 1 * 0 => x * 0 = 0 => every value of x is valid. Are those two examples good enough to show that multiplying by zero is not a good idea if you need valid results or do I have to add more? – josefx Jul 20 '10 at 08:10
  • @Yacoby could you name one of those maths? – josefx Jul 20 '10 at 08:12
  • 4
    @josefx. If you start with 1 = 2, it is possible to prove just about whatever you want. You can't use it as the basis for an argument that you can't multiply by 0. Anyway, take a look at [Wikipedia](http://en.wikipedia.org/wiki/Multiplication#Properties) – Yacoby Jul 20 '10 at 09:28
  • @Yacoby the basis of my first example is that we all know that 1 = 2 is wrong - the second one works without it. A multiplication with zero as your wikipedia link points out will result in zero for any values multiplied, so the wrong 1 = 2 becomes right with 1 * 0 = 2 * 0. Like x = 1 is only valid for x = 1 and x * 0 = 1 * 0 is valid for any value. Once multiplied with zero you have a completly different function with different valid values for x. This all is caused by the zero property. – josefx Jul 20 '10 at 11:09
  • @Yacoby to build on your link alone: the zero property causes anything multiplied by zero to become zero, so multiplying both sides of the equation with zero will result in 0 = 0 - this is not a property of 0/0 = x AFAIC using zero multiplication in any mathematical proof is an error because you can proof anything with it. – josefx Jul 20 '10 at 11:33
  • @josefx The fact that you have started with something that is false and got something that is true is meaningless. You can do the same thing by raising both sides to the power of 0. For example lets generalize the equation, x = y => x*0 = y*0 => 0 = 0. 0 = 0 tells us nothing. It in no way proves that 1 = 2 or x = y. – Yacoby Jul 20 '10 at 13:55
  • 4
    In summary, multiplying by 0 has a clearly defined result. 0. – Yacoby Jul 20 '10 at 13:57
  • 2
    There is a good [explanation here](http://mathforum.org/library/drmath/view/53093.html). I can't believe I am arguing about this. – Yacoby Jul 20 '10 at 13:58
  • @Yacoby that is what I wanted to point out, you do exactly the same with 0/0 = x. You multiply both sides with 0 to get your result. My examples show that the result of multiplying both sides with zero is in fact meaningles => my examples are just as meaningles as your x * 0 = 0 as both are only based on the wrong idea that multiplication with 0 can be used as a transformation without changing the results. – josefx Jul 20 '10 at 14:02
  • @Yacoby the midth of your explanation link shows why multiplying by zero is a bad idea, why would it be any better in your answer than in my examples? What makes your multiply both sides by 0 better than mine? There is no difference. – josefx Jul 20 '10 at 14:13
  • 10
    @josefx: This is incredible. Multiplying a number by 0 is always well-defined, and has the value 0. This is a basic property of 0 in any ring. x*0 = 0 for any x. I can't believe you're arguing about this. – ShreevatsaR Jul 20 '10 at 23:33
  • @ShreevatsaR im not arguing about multiplication by 0 itself being undefined, im arguing that the zero property makes the function meaningless. Yacobys explanation page states this too and I have jet to see anything that states that there are exceptions to this. The multiplication by 0 removes the x from the equation. Say x = y we know that x is always y. However if we multiply this by 0 => x * 0 = y * 0 - is that the same equation as before? No, here x and y can be anything and are independent of each other. This example is reversible in the same way as Yacobys – josefx Jul 21 '10 at 05:08
  • We can resolve x * 0 = y * 0 with x = 1 and y = 2, these are valid for this equation but not for the original equation x = y. So we can say that the multiplication by zero introduces a large number of invalid results. – josefx Jul 21 '10 at 05:13
  • 4
    @josefx: Um, do you realise you're saying the same thing Yacoby's original answer says? x*0 (= y*0) = 0 for any x, which is one reason we don't want to define 0/0 as 0. Multiplying by 0 does not introduce any invalid result; it's your inference that "x*0 = y*0 => x=y" that is false: this faulty inference involves division by 0. – ShreevatsaR Jul 21 '10 at 05:56
  • 1
    @ShreevatsaR Yacoby multiplies by zero => x = y multiplied by zero => x * 0 = y * 0; valid results for x = y only those where x = y; valid results for x * 0 = y * 0 any x is valid independent of y; x = 1 , y = 2 => 1*0 = 2 *0 valid, 1=2 invalid; so this result is invalid for the original equation, but valid for the one with zero multiplication. The only change i made is multiplication by zero (third line of Yacobys answer : multiplication by zero) now tell me where does this result come from?? x = 1 and y = 2 is not valid for the original equation! Note I did not use division in this equation. – josefx Jul 21 '10 at 10:12
  • 4
    Actually the flaw in the demonstration is that you cannot rearrange that equation. You have `x = 0/0`. Multiply both sides by 0 and you get `x * 0 = 0/0 * 0`. You cannot simplify the right term, as it involves dividing 0 by 0... Or, if you're just saying that anything multiplied by 0 gives 0 your equation just turns into `0 = 0`. That's why this demonstration does not hold. – nico Jul 23 '10 at 06:54
  • @nico That is why 0/0 is left as a fraction. I haven't evaluated it so can still manipulate it as I wish. It is designed to show that the range of possible values of x is infinite. – Yacoby Jul 23 '10 at 09:15
  • @nico What I am saying is that if the top equation is true, then the bottom equation must also be true but the values of x for which the bottom equation is true is infinite. i.e. it is true for all values of x. – Yacoby Jul 23 '10 at 09:25
  • @Yacoby: Yes, but (unless I misunderstood your point) you say that `x * 0 = 0/0 * 0` equals to `x * 0 = 0`, so you are essentially saying that `0/0 * 0 = 0` which you cannot as you are trying to demonstrate what the result of `0/0` is. You could use your proof if you already had defined the result of `0/0`, otherwise you're answering your question using the result of the question itself... which you don't know! – nico Jul 23 '10 at 09:28
  • @nico It is well known that for all real numbers and integers: `(a/b) * b = a` Now let `a = b = 0`. I am not evaluating the result of 0/0 is in any way shape or form because it is undefined. – Yacoby Jul 23 '10 at 09:30
  • 3
    @Yacoby: as far as I know `(a/b) * b = a` is not defined for `a = b = 0`, but I'm not a mathematician so I may be wrong. – nico Jul 23 '10 at 10:26
  • @nico Why wouldn't it be defined? – Yacoby Jul 23 '10 at 21:08
  • @Yacoby: Because 0/0 is not defined! To do `0 / 0 * 0` you can either do `(0/0) * 0` in which case you do not know the left term or `0 * (0/0)` in which case you do not know the right term. – nico Jul 24 '10 at 07:09
  • @nico the *result* of 0/0 is undefined – Yacoby Jul 24 '10 at 09:29
  • @Yacoby: exactly, so you are trying to say that `undefined * 0 = 0` which is clearly not the case... – nico Jul 24 '10 at 09:55
  • @nico No, the result is undefined. It is still possible to manipulate 0/0. So when I multiply everything by 0, I just cancel the denominator in the fraction 0/0 to get the result 0. – Yacoby Jul 24 '10 at 09:58
  • 2
    @Yacoby: Cancelling the denominator equals divinig and multiplying by 1. When you say that `2 / 3 * 3 = 2` you actually do `2 * 3 / 3 = 2 * 1 = 2`. But you cannot simplify `0 / 0 * 0` as ` 0 * 1 = 0`: that would imply `0 / 0 = 1`. – nico Jul 24 '10 at 11:00
  • @Yacoby: wow, you really remained patient here trying to explain them second-grade material. Don't kids learn this at age 8? – Konerak Mar 04 '11 at 16:07
  • @nico I came here from the [question asked on Math.SE](http://math.stackexchange.com/q/548) by the answerer here, Yacoby. The demonstration in this answer _does_ hold, because one of the equivalent definitions of the quotient `a/b` in a [field](http://en.wikipedia.org/wiki/Field_%28mathematics%29) is as the unique element `x` such that `b*x = a`. Again to emphasize, we are free to work in the system where this is not a rearrangement, but rather a _definition_. We don't and can't define `0/0` because the solution `x` to the equation is not unique for `a = b = 0`. –  Jan 31 '15 at 03:48
58

This is maths rather than programming, but briefly:

  • It's in some sense justifiable to assign a 'value' of positive-infinity to some-strictly-positive-quantity / 0, because the limit is well-defined

  • However, the limit of x / y as x and y both tend to zero depends on the path they take. For example, lim (x -> 0) 2x / x is clearly 2, whereas lim (x -> 0) x / 5x is clearly 1/5. The mathematical definition of a limit requires that it is the same whatever path is followed to the limit.

AakashM
  • 62,551
  • 17
  • 151
  • 186
  • 3
    +1 for the first answer I've seen that explains this in terms of limits – Martin B Jul 13 '10 at 12:50
  • It's good to learn the theory behind this, but limits aren't really meaningful in the discrete world. – Larry Wang Jul 14 '10 at 04:11
  • @Kaestur: Good point, hadn't considered the rationals when I made that comment. The "x * 0 = 0" argument is probably the most general one and works for any type of field, not just the reals... – Martin B Jul 14 '10 at 10:08
  • @Kaestur Hakarl: Actually, limits are meaningful in the discrete world too (in any metric space, not necessarily complete) — it's just that the limit (e.g. of rationals) may not lie within the discrete set. In other words: even if limited to some fixed accuracy, we can still observe things like 0.0000002/0.0000001=2, while 0.0000001/0.0000005=1/5. – ShreevatsaR Jul 14 '10 at 17:54
  • @ShreevatsaR Of course, everyone has their own definition of 'meaningful.' The standard representations of numbers in a computer (float, double, etc) are not closed, and metrics are maps to R anyways. It just bothers me a little that so many answers talk about limits when we don't really have a good definition for 'limit' in terms of numbers a computer understands. Your examples are correct, of course, but not terribly useful. Once we reach the limits of our accuracy, why make assumptions about what happens past that when a more robust explanation exists? – Larry Wang Jul 14 '10 at 18:58
  • A simple example: f(x)=0 for x<=2^100, 1 for x>=2^100+2^-100, and a straight line in between. We know the limit as x goes to 2^100+2^-101 exists, but anyone whose precision is not fine enough may think the limit does not exist, and of course, you can construct an example for any precision. Better to avoid dealing with limits in situations like the original question when you have a choice. – Larry Wang Jul 14 '10 at 19:03
  • @Kaestur: One can argue that math in the real domain is an anaylitic continuation of math in the integer of IEEE floating point domain, and that one can therefore use results derived from real (or even complex after we extend again) domain in integer arithmetic. 0/0 is fundamentally undefined, so it would be bad practice to assign it some usable value in the CPU. – dmckee --- ex-moderator kitten Jul 15 '10 at 01:19
  • 2
    @dmckee: It depends on the specific result. To use your example, if you were to tell someone that in the reals, exponential was a bounded function and sine unbounded, do you think they would accept the result because you say "it works in C, and R is part of C?" Some results may still hold, and 0/0 being undefined certainly does, but that doesn't mean the same proofs will all work. – Larry Wang Jul 15 '10 at 02:04
19

(Was inspired by Tony Breyal's rather good answer to post one of my own)

Zero is a tricky and subtle beast - it does not conform to the usual laws of algebra as we know them.

Zero divided by any number (except zero itself) is zero. Put more mathematically:

 0/n = 0      for all non-zero numbers n.

You get into the tricky realms when you try to divide by zero itself. It's not true that a number divided by 0 is always undefined. It depends on the problem. I'm going to give you an example from calculus where the number 0/0 is defined.

Say we have two functions, f(x) and g(x). If you take their quotient, f(x)/g(x), you get another function. Let's call this h(x).

You can also take limits of functions. For example, the limit of a function f(x) as x goes to 2 is the value that the function gets closest to as it takes on x's that approach 2. We would write this limit as:

 lim{x->2} f(x) 

This is a pretty intuitive notion. Just draw a graph of your function, and move your pencil along it. As the x values approach 2, see where the function goes.

Now for our example. Let:

 f(x) = 2x - 2
 g(x) = x - 1

and consider their quotient:

 h(x) = f(x)/g(x)

What if we want the lim{x->1} h(x)? There are theorems that say that

 lim{x->1} h(x) = lim{x->1} f(x) / g(x) 
                = (lim{x->1} f(x)) / (lim{x->1} g(x))  
                = (lim{x->1} 2x-2) / (lim{x->1} x-1)
                =~ [2*(1) - 2] / [(1) - 1]  # informally speaking...
                = 0 / 0 
                  (!!!)

So we now have:

 lim{x->1} h(x) = 0/0

But I can employ another theorem, called l'Hopital's rule, that tells me that this limit is also equal to 2. So in this case, 0/0 = 2 (didn't I tell you it was a strange beast?)

Here's another bit of weirdness with 0. Let's say that 0/0 followed that old algebraic rule that anything divided by itself is 1. Then you can do the following proof:

We're given that:

 0/0 = 1

Now multiply both sides by any number n.

 n * (0/0) = n * 1

Simplify both sides:

 (n*0)/0 = n 
 (0/0) = n 

Again, use the assumption that 0/0 = 1:

 1 = n 

So we just proved that all other numbers n are equal to 1! So 0/0 can't be equal to 1.

walks on back to her home over at mathoverflow.com

Clair Crossupton
  • 1,332
  • 2
  • 10
  • 16
  • 1
    From l'Hopital's rule (taking first derivatives): f(x)/g(x) = f'(x)/g'(x) Therefore: (2x-2)/(x - 1) = 2/1 = 2 ...I always thought this was cool. – Tony Breyal Jul 14 '10 at 10:30
  • I'll give you a point for bringing up l'Hopital, I love l'Hopital! – El Guapo Jul 20 '10 at 18:56
  • It's called l'Hopital's rule in English? You always learn something! I always assumed in English you would say "de l'Hopital's rule"... why do you guys truncate poor Guillaume's surname ? :) http://en.wikipedia.org/wiki/Guillaume_de_l%27H%C3%B4pital – nico Jul 23 '10 at 06:47
  • 1
    @nico it is also known as Bernoulli's rule :) – Clair Crossupton Jul 23 '10 at 21:32
  • @nico you say règle de L'Hôpital in French as well, so it's probably by analogy. For reference, the "Règle de trois" was not created by a frenchman called de Trois as far as I can tell. –  Sep 02 '12 at 04:24
5

Here's a full explanation:

http://en.wikipedia.org/wiki/Division_by_zero

( Including the proof that 1 = 2 :-) )

You normally deal with this in programming by using an if statement to get the desired behaviour for your application.

tovare
  • 4,027
  • 5
  • 29
  • 30
4

The problem is with the denominator. The numerator is effectively irrelevant.

10 / n
10 / 1 = 10
10 / 0.1 = 100
10 / 0.001 = 1,000
10 / 0.0001 = 10,000
Therefore: 10 / 0 = infinity (in the limit as n reaches 0)

The Pattern is that as n gets smaller, the results gets bigger. At n = 0, the result is infinity, which is a unstable or non-fixed point. You can't write infinity down as a number, because it isn't, it's a concept of an ever increasing number.

Otherwise, you could think of it mathematically using the laws on logarithms and thus take division out of the equation altogther:

    log(0/0) = log(0) - log(0)

BUT

    log(0) = -infinity

Again, the problem is the the result is undefined because it's a concept and not a numerical number you can input.

Having said all this, if you're interested in how to turn an indeterminate form into a determinate form, look up l'Hopital's rule, which effectively says:

f(x) / g(x) = f'(x) / g'(x)

assuming the limit exists, and therefore you can get a result which is a fixed point instead of a unstable point.

Hope that helps a little,

Tony Breyal

P.S. using the rules of logs is often a good computational way to get around the problems of performing operations which result in numbers which are so infinitesimal small that given the precision of a machine’s floating point values, is indistinguishable from zero. Practical programming example is 'maximum likelihood' which generally has to make use of logs in order to keep solutions stable

Tony Breyal
  • 5,338
  • 3
  • 29
  • 49
  • If n/0 = ∞, then n = 0 * ∞ = 0. If what you write is true then all numbers are equal to 0. – Yacoby Jul 14 '10 at 09:34
  • 1
    @Yacoby - Infinity is a concept, not a number and therefore you can not multiply it by anything and still expect to get a meaningful result. I think you're interpreting infinity to be a quantitative metric number in the equation you give, when instead it is in fact a qualitative descriptive concept. Hope that makes sense :-) – Tony Breyal Jul 14 '10 at 10:04
  • 1
    I would suppose it is going to be how you treat infinity. Using limits and defining infinity as a infinite limit, the result z/0 = ∞ would be correct. To my very limited knowledge this isn't true outside things like complex analysis. *shrugs* – Yacoby Jul 14 '10 at 10:19
  • 1
    @Yacoby Asymptomatically speaking that's true that it equals infinity in the limit. I don't see where that wouldn't be true to be honest... – Tony Breyal Jul 14 '10 at 10:44
3

Look at division in reverse: if a/b = c then c*b = a. Now, if you substitute a=b=0, you end up with c*0 = 0. But ANYTHING multiplied by zero equals zero, so the result can be anything at all. You would like 0/0 to be 0, someone else might like it to be 1 (for example, the limiting value of sin(x)/x is 1 when x approaches 0). So the best solution is to leave it undefined and report an error.

zvrba
  • 24,186
  • 3
  • 55
  • 65
3

You may want to look at Dr. James Anderson's work on Transarithmetic. It isn't widely accepted.

Transarithmetic introduces the term/number 'Nullity' to take the value of 0/0, which James likens to the introduction 'i' and 'j'.

IanField90
  • 171
  • 1
  • 6
2

The structure of modern math is set by mathematicians who think in terms of axioms. Having additional axioms that aren't productive and don't really allow one to do more stuff is against the ideal of having clear math.

Christian
  • 25,249
  • 40
  • 134
  • 225
1

How many times does 0 go into 0? 5. Yes - 5 * 0 = 0, 11. Yes - 11 * 0 = 0, 43. Yes - 43 * 0 = 0. Perhaps you can see why it's undefined now? :)

Will A
  • 24,780
  • 5
  • 50
  • 61
1

Since x/y=z should be equivalent to x=yz, and any z would satisfy 0=0z, how useful would such an 'exception' be?

Pontus Gagge
  • 17,166
  • 1
  • 38
  • 51
  • Normally, I tend to ignore downvotes, especially on questions which are borderline offtopic to SO, but I must say I'm curious: do you consider the answer wrong, misleading, unhelpful, irrelevant -- or do you just hate maths? – Pontus Gagge Jul 14 '10 at 07:56
1

Another explanation of why 0/0 is undefined is that you could write:

0/0 = (4 - 4)/0 = 4/0 - 4/0

And 4/0 is undefined.

Florin
  • 1,844
  • 2
  • 16
  • 21
0

0 means nothing, so if you have nothing, it does not imply towards anything to distribute to anything. Some Transit Facilities when they list out the number of trips of a particular line, trip number 0 is usually the special route that is routed in a different way. Typically, a good example would be in the Torrance Transit Systems where Line 2 has a trip before the first trip known as trip number 0 that operates on weekdays only, that trip in particular is trip number 0 because it is a specialized route that is routed differently from all the other routes.

See the following web pages for details: http://transit.torrnet.com/PDF/Line-2_MAP.pdf http://transit.torrnet.com/PDF/Line-2_Time_PDF.pdf

On the map, trip number 0 is the trip that is mapped in dotted line, the solid line maps the regular routing.

Sometimes 0 can be used on numbering the trips a route takes where it is considered the "Express Service" route.

0

If a/b = c, then a = b * c. In the case of a=0 and b=0, c can be anything because 0 * c = 0 will be true for all possible values of c. Therefore, 0/0 is undefined.

0

This is only a Logical answer not a mathamatical one, imagine Zero as empty how can you Divide an empty by an empty this is the case in division by zero also how can you divide by something which is empty.

Nighil
  • 4,099
  • 7
  • 30
  • 56
-1

why not make an exception for this case?

Because:

  • as others said, it's not that easy;)
  • there's no application for defining 0/0 - adding exception would complicate mathematics for no gains.
-1

This is what I'd do:

function div(a, b) {
    if(b === 0 && a !== 0) {
        return undefined;
    }
    if(b === 0 && a === 0) {
        return Math.random;
    }
    return a/b;
}
bluesmoon
  • 3,918
  • 3
  • 25
  • 30
-1

When you type in zero divided by zero, there's an error because whatever you multiply zero from will be zero so it could be any number.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
-7

As Andrzej Doyle said:

Anything dived by zero is infinity. 0/0 is also infinity. You can't get 0/0 = 1. That's the basic principle of maths. That's how the whole world goes round. But you can sure edit a program to say "0/0 is not possible" or "Cannot divide by zero" as they say in cell phones.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
subanki
  • 1,411
  • 10
  • 25
  • 48
  • 2
    It is possible to turn an indeterminate form into a determinate form using derivatives in order to evaluate the limit of an equation. See "L'Hôpital's rule" for further information. – Tony Breyal Jul 13 '10 at 12:03