December 1st, 2024

1/0 = 0 (2018)

The article explores the controversial claim that 1/0 can be defined as 0, arguing it is consistent in specific frameworks, while traditional mathematics views division by zero as undefined.

Read original articleLink Icon
1/0 = 0 (2018)

The article discusses the controversial mathematical assertion that 1/0 can be defined as 0, a claim that has sparked debate among mathematicians and programmers. The author clarifies that while traditional mathematics defines division as the inverse of multiplication, this definition does not extend to division by zero, which is typically considered undefined. However, the author argues that it is mathematically consistent to define 1/0 as 0 within certain frameworks, particularly in theorem provers. The piece emphasizes that this definition does not imply that 0 has a multiplicative inverse, nor does it lead to contradictions when properly applied. The author also addresses common objections to this definition, explaining that many arguments against it stem from misunderstandings of the underlying mathematical principles. The discussion highlights the fluidity of mathematical definitions and the importance of context in their application, particularly in programming and logic.

- The assertion that 1/0 = 0 is mathematically consistent under specific definitions.

- Traditional mathematics considers division by zero as undefined.

- The definition of division does not imply that 0 has a multiplicative inverse.

- Many objections to the definition stem from misunderstandings of mathematical principles.

- The article emphasizes the importance of context in applying mathematical definitions.

Link Icon 48 comments
By @sethev - 3 months
I debated this with my boss at my first programming job (this was 20+ years ago). He thought 1/0 should be 0 rather than an error because "that's what people expect". My argument was from mathematical definitions (the argument which this blog post picks apart).

In retrospect, I see his point better - practical use trumps theory in most language design decisions.

I haven't changed my mind but the reason has shifted more toward because "it's what a larger set of people expect in more situations" rather than mathematical purity.

By @rsp1984 - 3 months
As long as lim(1/x)_x->0 = inf, 1/0 = 0 doesn't make a whole lot of sense, mathematically speaking. I might be wrong but I don't think it was addressed in the article either.
By @tbrownaw - 3 months
So, how often do devs actually want a `/` that isn't the inverse of multiplication?

Trying to calculate... I don't know, how many 2-disk raid6 groups I need to hold some amount of data is an error, not "lol you don't need any".

If my queue consumer can handle 0 concurrent tasks, it will take literally forever to finish, not finish instantly.

By @lupire - 3 months
https://xenaproject.wordpress.com/2020/07/05/division-by-zer...

explains Lean's behavior. Basically, you use a goofy alternate definition of division (and sqrt, and more), and to compensate you have to assume (or prove based on assumptions) that the things you will divide by are never zero.

Hillel's pedantry is ill-taken, though, because he starts off with a false accusation that the headline tweet was insulting anyone.

Also, 1/0=0" is sound only if you change the field axiom.of division, which is fine, but quite rather hiding the ball. If you add " 1/0=0" as an axiom to the usual field axioms, you do get an unsound system.

By @d--b - 3 months
The only thing that truly matters is this:

When software engineers make mistakes dividing by 0 and end up with Exceptions being raised or NaNs being output, they'll usually blame themselves.

When the results are wrong numbers all over the place, they'll blame the language.

There are 2 cases when people are going to "use" x/0:

1. They made a mistake.

2. They KNOW that x/0 returns 0 and they take it as a shortcut for (y == 0 ? 0 : x/y)

Is that shortcut useful? No. Is it dangerous? Yes. Hence, this is a bad idea.

By @_Sycamore - 3 months
My head-canon with dividing by zero is that 1/0 = undefined and 1/-0 = -undefined, and that's where I leave it because anything less funny than that seems like an impractical answer.
By @dccsillag - 3 months
I find it odd that all of the mathematicians cited at the end are actually pretty much CS people, working on proof assistants. Kinda renders that section pointless, IMO (though the comment by Isabelle's author was interesting).

IMO, whether something like this makes sense is a separate matter. Personally I always just think of division in terms of multiplicative inverses, so I don't see how defining division by zero helps other than perhaps making implementation easier in a proof assistant. But I've seen people say that there are some cases where having a/0 = 0 works out nicely. I'm curious to know what these cases are, though.

By @MathMonkeyMan - 3 months
Not that anybody asked me, but I think about it like this:

You have a field (a set of "numbers"). Multiplication is defined over the field. You want to invent a notion of division. Let's introduce the notation "a/b" to refer to some member of a field such that "a/b" * b = a.

As Hillel points out, you can identify "a/b" with a*inverse(b), where "inverse" is the multiplicative inverse. And yes, there is no inverse(0). But really let's just stick with the previous definition: "a/b" * b = a.

Now consider "a/0". If "a/0" is in the field, then "a/0" * 0 = a. Let's consider the case where a != 0. Then we have "a/0" * 0 != 0. But this cannot be true if "a/0" is in the field, because for every x we have x * 0 = 0. Thus "a/0" is not in the field.

Consider "a/0" with a=0. Then "a/0" * 0 = 0. Any member of the field satisfies this equation, because for every x we have x * 0 = 0. So, "a/0" could be any member of the field. Our definition of division does not determine "0/0".

Whether you can assign "1/0" to a member of the field (such as 0) depends on how you define division.

By @enriquto - 3 months
I'd agree to some kind of 1//0=0 for ints; but for floats you'll take 1/0=inf from my cold, dead hands.
By @amai - 3 months
But 0/1 = 0. So 1/0 must be the inverse/opposite of zero.

And I think if you look at the Riemann sphere, the inverse of zero is the point where +infinity and -infinity meet. I would call that 0^(-1).

By @eqvinox - 3 months
Note 1/0 (or x/0 with x>0) isn't undefined or an exception in 754 FP math, it's +infinity. It's 0/0 that's the problem. Defining 1/0=0 isn't really helpful imho.
By @bubblyworld - 3 months
Consistency depends on your set of axioms. If you are willing to give up various nice properties of division, then you can obviously extend it however you like.

My gripe with arbitrary choices like this is that it pushes complexity from your proof's initial conditions ("we assume x != 0") into the body of your proof (every time you use division now you've split your proof into two cases). The former is a linear addition of complexity to a proof, whereas the latter can grow exponentially.

Of course, nothing is stopping you from using an initial condition anyway to avoid the case splitting, but if you were going to do that why mess with division in the first place?

By @benlivengood - 3 months
Most definitions of division that I have seen use q * d + r = n if q is unique and abs(r)<abs(d), which doesn't require the definition of an inverse. Rather, d that exist for n = 1 and r = 0 can be labelled q's inverse but it doesn't require a new definition.

Additionally, if inverses are defined as separate objects then what is 2 plus the inverse of 2? It doesn't simplify to 2.5 because there's no addition axiom for numbers and multiplicative inverses, or for that matter any rules for inverses with inverses. So you might have 1/2 and 5/10 but they're not equal and can't be multiplied together.

By @blablabla123 - 3 months
Sounds legit, infinity is singular and so is 0. I think one problem is also that division isn't the only mathematical operation which can produce dubious results. E.g. sqrt(x), arctan(x) which have multiple branches which is why there is often a separate arctan2(x, y) to select the correct branch. Oh well and then there's just addition which silently overflows in almost every programming language.

Without arbitrary precision numerics and functions which aren't explicit about corner cases it's always a simplification. However performance-/code-wise this is usually not feasible.

By @zzo38computer - 3 months
In uxn, the result of division of anything by zero is defined as zero (there are no error conditions in uxn). I did not know that Pony is also doing that. This is not a proper "division" (since it is not always a multiplicative inverse operation), but it does not necessarily have to be (and, as another comment mentions, the integer division operator in many programming languages is not a proper "division" either); it is something else which might use a "/" sign or the instruction name "DIV" or whatever.
By @TrianguloY - 3 months
I've always wondered what would happen if we defined /0 as a new symbol, for example 'z'. The same as we define sqrt(-1) as 'i'. So if you can do 4*sqrt(-1)=4i, you could also do 4/0 = 4z. These two seems similar, as in taking something that should not exist, and just letting it exists in a totally different and orthogonal domain.

I tried once to investigate the implications, but it quickly became far more complex that with 'i' and never went far. Still intrigued if this is somewhat interesting or a total time loss though.

By @mrfinn - 3 months
Disagreed. 1/0 should be infinity, and computers should be able to handle these concepts. Just look into what is 1/0.00000000000[etc]1. And no is not an error, you find out with a very real and tangible example, when you are developing a 3D engine and you want to make the camera to look at vector [ 0, 0, 0 ]. Quick resume: You can't, you need to force add a slight displacement so you can skip this silly error.
By @d_tr - 3 months
Whatever as long as the name does not imply that these are integers, because then it is just wrong. The same holds for overflowing results being clamped or resulting in smaller or negative values due to wraparound. These are not integers.

There is only one correct behavior for something named "int". Give the correct result or throw an error.

By @red_admiral - 3 months
EDIT: markup broke my operators

In combinatorics and discrete probability, `0**0 = 1` is a useful convention, to the point that some books define a new version of the operator - let's call it `***` - and define `a***b = a**b` except that `0***0 = 1` and then use the new operator instead of exponentiation everywhere. (To be clear, `**` is exponentiation, I could write `a^b` but that is already XOR in my mind.)

So one might as well overload the old one: tinyurl.com/zeropowerzero

This causes no problems unless you're trying to do real (or complex) analysis.

1/0 can cause a few more problems, but if you know you're doing something where it's safe, it's like putting the Rust `unsafe` keyword in front of your proof and so promising you know what you're doing.

By @IshKebab - 3 months
> It’s saying that Pony is mathematically wrong. This is objectively false.

Pff. The author wants to show off their knowledge of fields by defining a "division" operator where 1/0 = 0. Absolutely fine. I could define "addition" where 1 + 2 = 7. Totally fine.

What I can't do is write a programming language where I use the universally recognised "+" symbols for this operation, call it "addition" and claim that it's totally reasonable.

Under the standard definition of division implied by '/' it is mathematically wrong.

What they obviously should have done is use a different symbol, say `/!`. Obviously now they've done the classic thing and made the obvious choice unsafe and the safe choice unobvious (`/?`).

By @dang - 3 months
One megathread and a couple small ones. Others?

1 / 0 = 0 (2018) - https://news.ycombinator.com/item?id=42167875 - Nov 2024 (8 comments)

What is the best answer to divide by 0 - https://news.ycombinator.com/item?id=40210775 - April 2024 (3 comments)

1/0 = 0 - https://news.ycombinator.com/item?id=17736046 - Aug 2018 (570 comments)

By @hans_castorp - 3 months
MySQL has ignored math rules for ages as well. 1/0 yields NULL there
By @bee_rider - 3 months
Maybe division by zero should just not exist.

If you actually write 1/0 in a manner that can be discovered through static analysis, that could just be a compile time error.

If you compute a zero, and then divide by it… I dunno. Probably what happened was the denominator rounded or truncated to zero. So, you actually have 1/(0+-e), for some type-dependent e. You have an interval which contains a ton of valid values, why pick the one very specific invalid value?

By @jvanderbot - 3 months
Q on this post: Is the field rule "Every element Except Zero has ... " (the 9th rule) defined with respect to the additive identity "zero" or the magical other undefined "Zero" that is the number we're all familiar with?

If so, how weirdly arbitrary that the additive zero is omitted for all multiplicative inverse definitions. (At least it seems to me). I always figured this was a consequence of our number systems, not of all fields.

By @red_admiral - 3 months
Another version of this: P(A|B) is not defined for P(B)=0, but you can safely let P(A|B)P(B)=0 when P(B)=0. Half the time, these two terms appear as a pair anyway.

It's a version of "you can't divide by zero, but you can multiply the divisor on both sides of the equation and then use 0*a=0."

By @croes - 3 months
It’s unexpected and that makes it dangerous.
By @gweinberg - 3 months
The article goes way too long to say 1/0 = 0 isn't exactly wrong because slash can mean anything you want it to mean. As the article points out, it isn't really "right" either, you could equally validly say it's a wreath of pretty flowers which smell bad.
By @ganzuul - 3 months
In the computational domain we hold entropy in high esteem. Arbitrarily assigning a value of 0 does not preserve entropy. We could return a promise that eventually we will not overflow if we get to be very very clever (arbitrary time) so that we can maintain purity.
By @blueblimp - 3 months
This sort of convenient semi-arbitrary extension of a partial function is ubiquitous in Lean 4 mathlib, the most active mathematics formalization project today. It turns out that the most convenient way to do informal math and formal math differ in this aspect.
By @jmclnx - 3 months
I set this to zero and print a warning/error about divide by zero on the log with data that caused it. That log would be sent to the business person worry about.

If they ignore it, I do not care, it is the business problem anyway.

Worked for me for decades :)

By @ChrisMarshallNY - 3 months
> one rule I try to follow is do not mock other programmers.

I like that. I try to live by a similar protocol.

On topic: Each context has the right to establish their own rules.

If the rules work, the context survives. If not, then the context dies.

By @ne38 - 3 months
Letting 1/0 = 0 it's fine. but it is an isolated formula (from other field formulas). Mathematics is not about isolated facts.
By @daft_pink - 3 months
Wouldn’t the logical value when dividing by zero be infinity, because zero can go into any number an infinite number of times?
By @kstrauser - 3 months
I despise that answer because it’s so context-dependent. What’s? 10/10? 1. 5/5? 1. .3/.3? 1. .0000000578/.0000000578? 1.

Ergo, x/x=1, so 0/0=1. You can use the same logic for x/0=any rational number.

Defining x/0=0 is impossibly arbitrary.

By @ashoeafoot - 3 months
So,it gives you a infinite list with binary system digit values, that produces a ranked infinity?
By @est - 3 months
I might be wrong but this looks a lot like an re-implementation of Riemann sphere?
By @anthk - 3 months
1/0 = NOP in assembly. You just don't divide, you skip that operation.
By @worik - 3 months
Division has an intuitive meaning: A divided by B is the number of Bs in A.

That is an intuition why division by zero is undefined.

Defining it arbitrarily is uninteresting.

Disapointing

By @hoseja - 3 months
1/0 = (−∞, ∞)

0 ∈ (−∞, ∞)

By @MaxGripe - 3 months
Not zero. Infinity
By @jbverschoor - 3 months
-0
By @moomin - 3 months
Honestly this hurts my head but Hillel is inevitably correct. You can define an explicitly undefined operation to do whatever you like. But what’s the point? There’s no new mathematics you can do with it, no existing behaviours you can extend like this. Normally, when you divide by a small number, you get a large number. Now for some reason it goes through zero. Why not five? Why not seven?

Just because it’s formally consistent doesn’t mean it isn’t dumb.

By @dswilkerson - 3 months
Math major here: this is wrong. The expression 1/0 is NOT A NUMBER, even if you allow positive infinity or negative infinity. In particular, it is most certainly not 0.

Note that infinity would be a fine answer IF MATHEMATICS COULD BE CONSISTENTLY EXTENDED to define it to be so, but this cannot be done (see below). Note that using infinity does not "break" mathematics (as some have suggested below) otherwise mathematicians would not use infinity at all.

If we have an expression that is not a number, such as 1/0, you can sometimes consistently define it to be something, such as a number or positive infinity or negative infinity, IF THAT WOULD BE CONSISTENT with the rest of mathematics. Let's see an example of the standard means of getting a consistent definition of exponentiation starting with its definition on positive integers and extending eventually to a definition for on a much bigger set, the rationals (ratios of signed integers).

We define 2 ^ N (exponentiation, "two raised to the power of N") for N a positive integer to be 2 multiplied by itself N times. For example: 2 ^ 1 = 2; 2 ^ 2 = 4; 2 ^ 3 = 8.

Ok, what is 2 ^ N where N is a negative integer? Well we did not define it, so it is nothing. However there is a way to CONSISTENTLY EXTEND the definition to include negative exponents: just define it to preserve the algebraic properties of exponentiation.

For exponents we have: (2 ^ A) * (2 ^ B) ("two raised to the power of A times two raised to the power of B") = 2 ^ (A+B) ("two raised to the power of A plus B"). That is, when you multiply, the exponents add. You can spot check it: (2 ^ 2) * (2 ^ 3) = 4 * 8 = 32 = 2 ^ 5 = 2 ^ (2 + 3).

So we can EXTEND THE DEFINITION of exponentiation to define 2 ^ -N for positive integer N (so a negative integer exponent) to be something that would BE CONSISTENT WITH the algebraic property above as follows. Define 2 ^ -N ("two raised to the power of negative N") to be (1/2) ^ N ("one half raised to the power N"). Check: (2 ^ -1) * (2 ^ 2) = ((1/2) ^ 1) * (2 ^ 2) = 1/2 * 4 = 2 = 2 ^ 1 = 2 ^ (-1 + 2).

Ok, what is 2 ^ 0 ("two raised to the power of zero")? Again, we have not defined it, so it is nothing. However, again, we can CONSISTENTLY EXTEND the definition of exponentiation to give it a value. 2 ^ 0 = (2 ^ -1) * (2 ^ 1) = 1/2 * 2 = 1. This always works out no matter how you look at it. So we say 2 ^ 0 = 1.

I struggled with this for days when I was a kid, literally yelling in disbelief at my parents until the would run away from me. I mean 2 ^ 0 means multiplying 2 times itself 0 times, which means doing nothing, so I thought it should be 0. After 3 days I finally realized that doing nothing IN THE CONTEXT OF MULTIPLICATION is multiplying by ONE, not multiplying by zero, so 2 ^ 0 should be 1.

Ok, is there a way to CONSISTENTLY EXTEND the definition of exponentiation to include non-integer exponents? Yes, we can define 2 ^ X for X = P / Q, where P and Q are integers (a "rational number"), to be 2 ^ (P/Q) = (2 ^ P) * (2 ^ -Q). All the properties of exponentials work out.

Notice how we can keep EXTENDING the definition of exponentiation starting from positive integers, to integers, to rationals, as long as we do so CONSISTENT with the properties of the previous definition of exponentials. I will not do go into the details, but we can CONSISTENTLY EXTEND the definition of exponentiation to real numbers by taking limits. For example, we can have a consistent definition of 2 ^ pi ("two raised to the power of pi") by taking the limit of 2 ^ (P/Q) as P/Q approaches pi.

HOWEVER, IN CONTRAST to the above extension of the definition of exponentiation, there is NO SUCH SIMILAR CONSISTENT EXTENSION to division that allows us to define 1/0 as ANY NUMBER AT ALL, even if we allow extending to include positive infinity and negative infinity.

The limit of 1/x as x goes to zero FROM THE POSITIVE DIRECTION = positive infinity. Some example points of this sequence: 1/1 = 1; 1/0.5 = 2; 1/0.1 = 10; 1/0.01 = 100, etc. As you can see the limit is going to positive infinity.

However, the limit of 1/x as x goes to zero FROM THE NEGATIVE DIRECTION = NEGATIVE infinity. Some example points from this sequence: 1/-1 = -1; 1/-0.5 = -2; 1/-0.1 = -10; 1/-0.01 = -100, etc. As you can see the limit is going to NEGATIVE infinity.

Therefore, since positive infinity does not equal negative infinity, there is NO DEFINITION of 1/0 that is consistent with BOTH of these limits at the same time. The expression 1/0 is NOT A NUMBER, even if you include positive and negative infinity, and mathematics cannot be consistently extended to make it into a number. Q.E.D.

By @throwawaymaths - 3 months
Yes, it's all good and nice that your types are sound and you don't have panics, but I feel like this could get you in trouble in the real world (gleam also uses this division convention, and people very much use gleam for "real world" things). Suppose you took an average over an unintentionally empty list (maybe your streaming data source just didn't send anything over the last minute due to a backhoe hitting a fiber in your external data source's data center) and took some downstream action based off of what you think is the rolling average. You could get royally fucked if money is involved.

Crashing would have been preferable.

1/0 = 0 is unsuitable and dangerous for anyone doing anything in the real world.

By @freddealmeida - 3 months
God. No.
By @codeflo - 3 months
This article invents a new binary operation, calls it "division" and uses the "/" operator to denote it. But the article repeats multiple times that this new operation isn't a multiplicative inverse, so it's not actually division. For example, (a/b)*b=a isn't true for this new operation.
By @movpasd - 3 months
This is all well and fine, but feels like a lot of words to say "it's a matter of definition".

The question is what definitions will be useful and what properties you gain or give up. Being a partial function is a perfectly acceptable trade-off for mathematics, but perhaps it makes it difficult to reason about programs in some cases.

I suppose the aim of the article is to point out the issue is not one of soundness, which is useful — but I wish more emphasis had been put on the fact that it doesn't solve the question of what 1/0 should do and produced arguments with regards to that.