# Why You Cannot Divide by Zero: Granting 0 a Reciprocal Collapses the Number System to a Point

> The school rule 'never divide by zero' explained from the definition of division as the inverse of multiplication. 5÷0 has no solution, 0÷0 has too many, and granting 0 a reciprocal forces 1=0, wiping out every number.
> https://rikai.mugen-giken.com/en/mathematics/math-columns/division-by-zero

## 0. Key points

- The quotient $a \div b$ is by definition "the number which, multiplied by $b$, gives $a$". Returning to this definition makes the ban on division by zero visible through pure computation.
- When $b = 0$, anything multiplied by $0$ gives only $0$. Hence $5 \div 0$ has **no answer at all**, while $0 \div 0$ has **far too many** (every number is an answer).
- Admitting even a single "reciprocal of $0$" forces $1 = 0$ through the distributive law, and then every number in that world becomes $0$. The prohibition is not a moral rule; it is a measure that prevents the system from destroying itself.
- Looking at the graph of $y = 1/x$: approaching $0$ from the right sends us to $+\infty$, from the left to $-\infty$. Since the destination depends on the direction of approach, we cannot "fill in" the value at $x = 0$ by a limit either.
- There are escape routes nonetheless: the Riemann sphere, obtained by adjoining exactly one point $\infty$ to the complex numbers; differentiation, which handles limits of the type $0 \div 0$; and the computational convention of simply declaring $a \div 0 = 0$. Each of them settles the matter by reshaping what "division" means.

## 1. Motivation: why teachers never explain the reason

In primary school we are told "you must not divide by $0$". Ask why, and the answer is usually "that is the rule" or "there is no answer". In secondary school, whenever a denominator could vanish, the clause "assume $x \neq 0$" is attached in silence, and the reason for avoiding that point is often left unsaid.

As a result, the prohibition tends to be treated as one of mathematics' arbitrary taboos. Type `1 ÷ 0 =` into a calculator and you get `Error`. A spreadsheet snaps back with `#DIV/0!`. A program halts with an exception. It looks as though all the machines have agreed on a common story.

The reason, however, is remarkably simple. **If we return to the definition of the word "division", we can check on the spot that the answer to a division by $0$ either fails to exist or fails to be determined.** Pushing one step further and asking "what happens if we force an answer anyway?" reveals the number system itself falling apart. This article follows both stages, writing out every computation.

Many rules in mathematics have exactly this structure: what looks like an arbitrary edict turns out to be nothing but a consequence of a definition. For practice in reading rules as consequences rather than as items to memorize, see [Why mathematics is hard](/en/mathematics/math-columns/why-math-is-hard), and in particular <Ref to="mathematics/math-columns/why-math-is-hard#def-proof" text="what a proof is" />. The procedure of fixing the meaning of a symbol before producing an answer is used in the same form in [Is 1 equal to 0.999…?](/en/mathematics/math-columns/one-equals-0-999), at <Ref to="mathematics/math-columns/one-equals-0-999#def-infinite-decimal" text="the definition of the value of an infinite decimal" />.

## 2. Preliminaries: what division was

Let us first make the meaning of "division" explicit. Why is $12 \div 3 = 4$ correct? Because $3 \times 4 = 12$. Division, in other words, is the operation that retraces multiplication backwards.

<Definition id="def-division" title="Division as the inverse of multiplication">
Let $a$, $b$ be real numbers. When the equation
$$
b \times x = a
$$
has **exactly one** solution $x$, we write that solution as $a \div b$ (or $\dfrac{a}{b}$) and call it the quotient of $a$ by $b$. When no solution exists, or when two or more solutions exist, $a \div b$ is undefined.
</Definition>

The clause "exactly one" deserves emphasis. The symbol $a \div b$ is a name for a single number. A name whose referent does not exist, or is not unique, cannot function as a name. (The converse situation is harmless: one number may carry several names. That $0.999\ldots$ and $1.000\ldots$ are two names for the same number is an example — <Ref to="mathematics/math-columns/one-equals-0-999#thm-double-rep" text="double representation of decimal expansions" />.) The same consideration is why $\sqrt{4}$ is defined not as "a number whose square is $4$" but as "the **non-negative** number whose square is $4$".

<Definition id="def-reciprocal" title="Reciprocal">
For a real number $b$, when there is exactly one real number $x$ satisfying $b \times x = 1$, we call it the **reciprocal** of $b$ and write it $b^{-1}$ or $\dfrac{1}{b}$.
</Definition>

For $b \neq 0$ the reciprocal exists: for instance $b = 3$ gives $x = 1/3$. Moreover $a \div b = a \times b^{-1}$ holds. Indeed $b \times (a \times b^{-1}) = a \times (b \times b^{-1}) = a \times 1 = a$, so $a \times b^{-1}$ really is a solution of the equation in <Ref to="def-division" />.

<Aside type="note">
Throughout this article we freely use the following properties of arithmetic on the real numbers: associativity $(ab)c = a(bc)$, commutativity $ab = ba$, distributivity $a(b+c) = ab + ac$, the fact that $1$ is the multiplicative identity, $a \times 1 = a$, and the availability of additive inverses (subtraction) at all times. These hold not only for the reals but for the rationals, the complex numbers, the set of polynomials, and many other systems. Extracting only the properties common to several objects and using them as the basis of an argument is called <Ref to="mathematics/math-columns/why-math-is-hard#def-abstraction" text="abstraction" />. As we shall see, the prohibition on division by zero follows from these properties alone.
</Aside>

## 3. $5 \div 0$ has no solution; $0 \div 0$ has a flood of them

Everything hinges on the following lemma. "Anything times $0$ is $0$" looks self-evident, but it is not a slogan: it is a fact provable from the distributive law.

<Lemma id="lem-zero-product" title="Absorption property of zero">
For every real number $a$ we have $a \times 0 = 0$.
</Lemma>

<Proof of="lem-zero-product">
Since $0$ is the additive identity, $0 = 0 + 0$. Multiplying both sides by $a$ and using distributivity,
$$
a \times 0 = a \times (0 + 0) = a \times 0 + a \times 0 .
$$
Now $a \times 0$ is a single real number, so its additive inverse $-(a \times 0)$ exists. Adding it to both sides of the equation above, the left-hand side becomes
$$
a \times 0 + \bigl(-(a \times 0)\bigr) = 0,
$$
and the right-hand side becomes
$$
a \times 0 + a \times 0 + \bigl(-(a \times 0)\bigr) = a \times 0 + 0 = a \times 0 .
$$
Therefore $0 = a \times 0$.
</Proof>

What this lemma says is that **inside multiplication, $0$ is a black hole**: whatever we throw in, only $0$ comes out. Retracing that operation backwards is therefore bound to go wrong.

<Proposition id="prop-no-solution" title="A nonzero number cannot be divided by 0">
Let $a$ be a nonzero real number. Then no real number $x$ satisfies $0 \times x = a$. Consequently $a \div 0$ is undefined in the sense of <Ref to="def-division" />.
</Proposition>

<Proof of="prop-no-solution">
Suppose some real number $x$ satisfied $0 \times x = a$. By commutativity $0 \times x = x \times 0$, and applying <Ref to="lem-zero-product" /> to $x$ gives $x \times 0 = 0$. Hence $a = 0$, contradicting the hypothesis $a \neq 0$. So no such $x$ exists.
</Proof>

<Proposition id="prop-indeterminate" title="0 ÷ 0 is indeterminate">
The equation $0 \times x = 0$ holds for every real number $x$. Hence the solution is not unique, and $0 \div 0$ is undefined in the sense of <Ref to="def-division" />.
</Proposition>

<Proof of="prop-indeterminate">
For an arbitrary real number $x$, commutativity together with <Ref to="lem-zero-product" /> gives $0 \times x = x \times 0 = 0$. Thus the solution set of the equation $0 \times x = 0$ is all of the reals, and in particular contains at least $2$ elements (for instance $x = 0$ and $x = 1$). Since the solution is not unique, there is no way to decide which number to select as the quotient.
</Proof>

So division by zero fails in two distinct ways. For $5 \div 0$ the number of candidates is **zero**; for $0 \div 0$ it is **infinite**. We call the former "no answer" and the latter "no determined answer (indeterminate)". Both are equally guilty in that the symbol $a \div b$ cannot point to a single number.

<Figure caption="How many solutions does a ÷ b have?">
<Mermaid code={`flowchart TD
  A["Look for solutions of b × x = a"] --> B&#123;"Is b ≠ 0?"&#125;
  B -- yes --> C["exactly 1 solution<br/>x = a × (1/b)"]
  B -- no --> D&#123;"Is a ≠ 0?"&#125;
  D -- yes --> E["0 solutions<br/>(the case 5 ÷ 0)"]
  D -- no --> F["infinitely many solutions<br/>(the case 0 ÷ 0)"]`} />
</Figure>

<Example id="ex-cookies" title="Thinking with cookies">
$12 \div 3$ asks: "if $12$ cookies are shared equally among $3$ people, how many does each get?" What then is $12 \div 0$? "If $12$ cookies are shared among $0$ people, how many does each get?" There is nobody, so there is no number of cookies per person to report. Worse, the question of where the $12$ cookies went remains. However many we hand to each of $0$ people, the total handed out is $0$ cookies, never $12$. This is <Ref to="prop-no-solution" /> in everyday language.

By contrast, $0 \div 0$ asks: "if $0$ cookies are shared among $0$ people, how many does each get?" Give $1$ cookie to each of $0$ people and the total is $0$; give $100$ each and the total is still $0$. Every answer is consistent. This is <Ref to="prop-indeterminate" />.
</Example>

## 4. Admitting a "reciprocal of $0$" collapses the world

At this point the persistent reader objects: "If the answer does not exist, why not create it? There was no answer for $\sqrt{-1}$ either, and we invented a new number $i$."

This is a good objection. Mathematics has in fact expanded the number system by exactly that move: negative numbers because subtraction failed, fractions because division failed, imaginary numbers because $x^2 = -1$ had no solution. Why not create, by the same move, "a new number $\infty$ satisfying $0 \times \infty = 1$"?

The answer is: "You can create it, but then you must give up one of the laws of arithmetic." The following theorem shows how large the price is.

<Theorem id="thm-collapse" title="Giving zero an inverse collapses everything">
Let $K$ be a set on which addition, subtraction and multiplication are defined, which has an additive identity $0$ and a multiplicative identity $1$, and in which associativity, commutativity and distributivity hold (a commutative ring). If some element $e$ of $K$ satisfies
$$
0 \times e = 1 ,
$$
then every element of $K$ equals $0$. That is, $K = \{0\}$, and in particular $1 = 0$.
</Theorem>

<Proof of="thm-collapse">
By hypothesis $0 \times e = 1$. On the other hand, the proof of <Ref to="lem-zero-product" /> used only distributivity and additive inverses, so it goes through verbatim in $K$, giving $0 \times e = 0$. The same element equals both $1$ and $0$, whence
$$
1 = 0 .
$$

Now take an arbitrary element $a$ of $K$. Using the fact that $1$ is the multiplicative identity together with the identity $1 = 0$ just obtained,
$$
a = a \times 1 = a \times 0 = 0
$$
(the last equality is again <Ref to="lem-zero-product" />). Since $a$ was arbitrary, every element of $K$ is $0$.
</Proof>

This result is drastic. Admitting a single reciprocal of $0$ turns $1$, $2$, $-7$ and $\pi$ all into $0$, and the number line collapses to a point. In a world where $0$ is the only distinguishable number, equations, functions and graphs all lose their meaning. Nothing broke when we introduced the imaginary unit: the arithmetic of the reals carries over unchanged inside the complex numbers. On the contrary, new relations such as $e^{i\theta} = \cos\theta + i\sin\theta$ came to light (<Ref to="mathematics/math-columns/famous-mathematicians#thm-euler-formula" text="Euler's formula" />). Division by zero is decisively different on this point.

<Corollary id="cor-no-field" title="No number system contains a reciprocal of 0">
In a commutative ring with $0 \neq 1$ — the integers, the rationals, the reals, the complex numbers, and the polynomials with real coefficients are all of this kind — there is no element $e$ satisfying $0 \times e = 1$.
</Corollary>

<Proof of="cor-no-field">
If such an element existed, <Ref to="thm-collapse" /> would give $1 = 0$, contradicting the hypothesis $0 \neq 1$.
</Proof>

<Remark id="rem-zero-ring">
Conversely, there is exactly one system that accepts $1 = 0$: the **zero ring**, whose only element is $0$. Division by $0$ genuinely works there ($0 \div 0 = 0$). But since there is only one number, every computation — not just division — reduces to $0 = 0$. The price of permitting division by zero is that mathematics falls completely silent.
</Remark>

### 4.1. The fake proof that $1 = 2$

What concretely goes wrong when the prohibition is violated? Let us look at the famous "proof".

<Example id="ex-fake-proof" title="A fake proof that 1 = 2">
Let $a$ and $b$ be nonzero real numbers with $a = b$. Multiplying both sides by $a$,
$$
a^2 = ab .
$$
Subtracting $b^2$ from both sides,
$$
a^2 - b^2 = ab - b^2 .
$$
Factoring the left-hand side and taking out $b$ on the right,
$$
(a+b)(a-b) = b(a-b) .
$$
Dividing both sides by $a - b$,
$$
a + b = b .
$$
Since $a = b$, the left-hand side is $2b$, so $2b = b$. Dividing both sides by $b\ (\neq 0)$,
$$
2 = 1 .
$$

Where is the mistake? We assumed $a = b$, so $a - b = 0$. The single line "divide both sides by $a-b$" was precisely an act of dividing by $0$. By <Ref to="prop-no-solution" /> and <Ref to="prop-indeterminate" />, that operation has no meaning.

To be more precise: the equation $(a+b)(a-b) = b(a-b)$ is itself correct (both sides are $0$); what is wrong is the inference from it to $a+b = b$. Concluding $x = y$ from $xc = yc$ is legitimate only when $c \neq 0$, and the justification was that one may multiply both sides by $c^{-1}$. For $c = 0$ the required $c^{-1}$ does not exist (<Ref to="cor-no-field" />).
</Example>

<Aside type="caution">
Losing solutions by writing "divide both sides by $x$" while solving an equation has the same structure as this fake proof. For example, dividing $x^2 = x$ through by $x$ to get $x = 1$ makes the solution $x = 0$ disappear. Correctly, one writes $x^2 - x = 0$, factors it as $x(x-1) = 0$, and concludes $x = 0$ or $x = 1$. Remembering "do not divide; move terms across and factor" prevents many such accidents.
</Aside>

## 5. A graphical view: what $1/x$ does near $0$

From the algebraic side the verdict was "no answer, or too many". From the analytic side — graphs and limits — a different face appears. Let us draw the graph of $f(x) = 1/x$.

<Figure caption="The graph of y = 1/x. There is not a single point directly above x = 0.">
<svg viewBox="0 0 400 260" width="100%" role="img" aria-label="The graph of y = 1/x, with two branches diverging upwards and downwards near the origin">
  <line x1="0" y1="130" x2="400" y2="130" stroke="currentColor" stroke-width="1" opacity="0.5" />
  <line x1="200" y1="0" x2="200" y2="260" stroke="currentColor" stroke-width="1" opacity="0.5" />
  <line x1="200" y1="0" x2="200" y2="260" stroke="var(--sl-color-accent)" stroke-width="2" stroke-dasharray="6 5" />
  <polyline points="222,0 227,22 233,43 244,65 267,87 300,101 333,108 400,116"
    fill="none" stroke="var(--sl-color-accent)" stroke-width="2.5" />
  <polyline points="178,260 173,238 167,217 156,195 133,173 100,159 67,152 0,144"
    fill="none" stroke="var(--sl-color-accent)" stroke-width="2.5" />
  <text x="386" y="146" font-size="13" fill="currentColor">x</text>
  <text x="207" y="14" font-size="13" fill="currentColor">y</text>
  <text x="243" y="200" font-size="13" fill="currentColor">x = 0 is a "wall"</text>
</svg>
</Figure>

The right branch rises without any ceiling as $x$ approaches $0$. The left branch, approaching $0$ likewise, drops through the floor. Let us confirm this numerically.

<Example id="ex-table" title="A table of values of 1/x">
Values of $1/x$ as $x$ approaches $0$.

| $x$ | $0.1$ | $0.01$ | $0.001$ | $0.0001$ |
|---|---|---|---|---|
| $1/x$ | $10$ | $100$ | $1000$ | $10000$ |

| $x$ | $-0.1$ | $-0.01$ | $-0.001$ | $-0.0001$ |
|---|---|---|---|---|
| $1/x$ | $-10$ | $-100$ | $-1000$ | $-10000$ |

Approaching from the right, the values grow arbitrarily large in the $+$ direction; approaching from the left, they become arbitrarily small in the $-$ direction. Far from narrowing, the gap between the two widens as $x$ gets closer to $0$. At $x = 10^{-4}$ the difference between the two values is already $20000$.
</Example>

Let us pin down "grows arbitrarily large" with a formula rather than intuition. The essential point is that, however large a target value we fix, there is always an $x$ close enough to $0$ to exceed it. (What guarantees that arbitrarily small positive numbers are available is the Archimedean property of the reals — <Ref to="mathematics/math-columns/one-equals-0-999#lem-archimedes" text="the Archimedean principle" />.)

<Definition id="def-divergence" title="Divergence to positive infinity">
We say that a function $g(x)$ **diverges to positive infinity** as $x \to 0^{+}$ (that is, as $x$ approaches $0$ through positive values) if, for every number $M > 0$ however large, one can choose a corresponding $\delta > 0$ such that
$$
0 < x < \delta \implies g(x) > M .
$$
In this case we write $\displaystyle\lim_{x \to 0^{+}} g(x) = +\infty$. Divergence to negative infinity is defined in the same way, replacing $g(x) > M$ by $g(x) < -M$. For $x \to 0^{-}$ (that is, as $x$ approaches $0$ through negative values), replace the condition $0 < x < \delta$ by $-\delta < x < 0$.
</Definition>

<Proposition id="prop-divergence" title="One-sided limits of 1/x">
$$
\lim_{x \to 0^{+}} \frac{1}{x} = +\infty, \qquad \lim_{x \to 0^{-}} \frac{1}{x} = -\infty .
$$
</Proposition>

<Proof of="prop-divergence">
We prove the first statement. Take $M > 0$ arbitrarily and set $\delta = \dfrac{1}{M}$ (since $M > 0$, we have $\delta > 0$). Suppose $0 < x < \delta$. As $x$ and $\delta$ are both positive, multiplying through by the positive number $\dfrac{1}{x\delta}$ leaves the inequality direction unchanged:
$$
0 < x < \delta \implies \frac{1}{\delta} < \frac{1}{x} ,
$$
that is, $\dfrac{1}{x} > M$. Since $M$ was arbitrary, the condition of <Ref to="def-divergence" /> is met, and $\lim_{x \to 0^{+}} 1/x = +\infty$.

The second statement follows because $1/x = -\,1/|x|$ for $x < 0$: applying the first part to $|x| \to 0^{+}$ gives $1/|x| > M$, that is, $1/x < -M$.
</Proof>

<Corollary id="cor-no-limit" title="The limit as x tends to 0 does not exist">
$\displaystyle\lim_{x \to 0} \frac{1}{x}$ exists neither as a real number, nor as $+\infty$, nor as $-\infty$.
</Corollary>

<Proof of="cor-no-limit">
For the limit to exist, the destination when approaching from the right must agree with the destination when approaching from the left. By <Ref to="prop-divergence" /> the former is $+\infty$ and the latter is $-\infty$, so they disagree. More concretely, however small we take $\delta > 0$ (a narrower interval makes the claim stronger, so we may assume $\delta \le 1$), the interval $0 < |x| < \delta$ contains both an $x$ with $1/x > 1$ (for instance $x = \delta/2$) and an $x$ with $1/x < -1$ (for instance $x = -\delta/2$). Hence the values of $1/x$ never accumulate at a single place.
</Proof>

Removing $x = 0$ from the domain of $f(x) = 1/x$ is not merely because "the values get too big there". It is because **the destinations disagree depending on the direction of approach, so no assigned value can make the function continuous**. Even if we decreed $f(0) = 42$, the graph would merely leap around $42$ between the value $10000$ at $x = 0.0001$ and the value $-10000$ at $x = -0.0001$.

### 5.1. The $0 \div 0$ type: "the answer can be anything"

The indeterminacy of $0 \div 0$ becomes vividly visible in the language of limits.

<Example id="ex-indeterminate-limits" title="Different answers from the same 0 ÷ 0 shape">
In each of the following three cases, both numerator and denominator tend to $0$ as $x \to 0$. Formally, all three are of the shape "$0 \div 0$".

$$
\begin{aligned}
\lim_{x \to 0} \frac{3x}{x} &= \lim_{x \to 0} 3 = 3, \\[4pt]
\lim_{x \to 0} \frac{x^{2}}{x} &= \lim_{x \to 0} x = 0, \\[4pt]
\lim_{x \to 0^{+}} \frac{x}{x^{2}} &= \lim_{x \to 0^{+}} \frac{1}{x} = +\infty .
\end{aligned}
$$

Every manipulation above is carried out only in the range $x \neq 0$, which is legitimate because a limit does not ask about the value at $x = 0$ itself. The last line uses <Ref to="prop-divergence" />.

Depending on the ratio of the "speeds" at which numerator and denominator approach $0$, the answer comes out as $3$, as $0$, or as $+\infty$. Choosing coefficients similarly, one can produce any real number ($\lim_{x\to 0} cx/x = c$). Hence no single value can be assigned to $0 \div 0$. This is the analytic version of <Ref to="prop-indeterminate" />.
</Example>

<Aside type="tip">
The definition of the derivative taught in secondary school,
$$
f'(a) = \lim_{h \to 0} \frac{f(a+h) - f(a)}{h} ,
$$
is exactly a limit of this "$0 \div 0$ type". Numerator and denominator both tend to $0$, yet the ratio settles on a finite value. Differentiation may be described as the art of carefully circumventing the forbidden $0 \div 0$ by means of a limiting procedure. Had division by zero been simply fixed to be $0$ or $\infty$, differentiation would never have been born.
</Aside>

## 6. For those who still want to divide

So far the story has been one of impossibility. Has mathematics then given up on dividing by $0$ forever? Not quite. **If we reshape the meaning of division, or of number, we can permit it in a limited way.** Here are three representative approaches.

**Approach 1: the Riemann sphere.** Consider the set $\mathbb{C} \cup \{\infty\}$ obtained from the complex numbers $\mathbb{C}$ by adjoining exactly one new point $\infty$, called the point at infinity. Here one declares $z / 0 = \infty$ for $z \neq 0$, and $z / \infty = 0$. There is no conflict with <Ref to="thm-collapse" />, because this set is not a number system in which all four arithmetic operations hold. Indeed $\infty + \infty$, $\infty - \infty$, $0 \times \infty$, $\infty / \infty$, and $0/0$ are all left undefined. The problem of disagreeing destinations on the left and the right also dissolves: in the complex plane one can approach $0$ by circling around it, so $+\infty$ and $-\infty$ join into the single point $\infty$. The price paid was the freedom to subtract.

**Approach 2: circumvention by limits.** As we saw in <Ref to="ex-indeterminate-limits" />, an expression of type $0/0$ acquires a value once a specific mode of approach is prescribed. Differential and integral calculus pursue this policy systematically, and tools such as l'Hôpital's rule have been developed to handle the $0/0$ type in an organized fashion. Here one is not "dividing by $0$" but "watching where the result of dividing by a number close to $0$ goes". Since the reals contain no "smallest positive number closest to $0$" (<Ref to="mathematics/math-columns/one-equals-0-999#cor-no-infinitesimal" text="there are no infinitesimals in the reals" />), tracking such destinations is the only way to approach $0$ at all.

**Approach 3: declaring $a \div 0 = 0$ for convenience.** Proof assistants such as Isabelle/HOL and Coq, and the integer division of some programming languages, sometimes define $a \div 0 = 0$. This is an engineering compromise that saves the trouble of writing "undefined when dividing by $0$" every time. Even this convention does not conflict with <Ref to="thm-collapse" />: no reciprocal of $0$ has been created; the symbol $\div$ has merely been given a two-case meaning, "the quotient if $b \neq 0$, and $0$ if $b = 0$". What breaks instead is the basic property $(a \div b) \times b = a$ when $b = 0$.

**Approach 4 (a bonus): floating-point numbers.** In the real-number arithmetic of calculators and computers (the IEEE 754 standard), $1.0 / 0.0$ returns `inf`, $-1.0 / 0.0$ returns `-inf`, and $0.0 / 0.0$ returns `nan` (not a number). This implements, directly as values, the distinction between <Ref to="prop-no-solution" /> and <Ref to="prop-indeterminate" />: infinity for "no solution", not-a-number for "indeterminate". It is well designed.

```python
import numpy as np

with np.errstate(divide="ignore", invalid="ignore"):
    print(np.float64(1.0) / np.float64(0.0))   # inf
    print(np.float64(-1.0) / np.float64(0.0))  # -inf
    print(np.float64(0.0) / np.float64(0.0))   # nan

# Integer division raises an exception
try:
    1 // 0
except ZeroDivisionError as e:
    print("ZeroDivisionError:", e)
```

`nan` has the property of being equal to no number whatsoever, so `nan == nan` evaluates to false. The value itself declares that the answer is undetermined.

<Remark id="rem-history">
Historically, attempts to divide by $0$ go back a long way. The seventh-century Indian mathematician Brahmagupta, among the earliest to write down systematic rules treating $0$ as a number, stated that $0 \div 0 = 0$ (an error by modern lights). In the twelfth century Bhāskara II took the position that $a \div 0$ is an "infinite quantity", coming close to the idea behind the Riemann sphere. Once $0$ ceased to be "nothing" and became a number one computes with, this problem became unavoidable. For the people who made the history of number, see also [Famous mathematicians (Ramanujan and Euler)](/en/mathematics/math-columns/famous-mathematicians); the anecdote about Ramanujan, heir to the same Indian mathematical lineage, is at <Ref to="mathematics/math-columns/famous-mathematicians#ex-1729" text="the story of 1729" />.
</Remark>

## 7. Exercises

<Exercise id="exr-six-div-zero" difficulty="Easy">
Returning to <Ref to="def-division" />, explain why $6 \div 0$ is undefined. Then state **how** the reason that $0 \div 0$ is undefined differs from the reason in the case of $6 \div 0$.

<Solution>
$6 \div 0$ denotes the solution of the equation $0 \times x = 6$. By <Ref to="lem-zero-product" />, $0 \times x = 0$ for every real number $x$, so the left-hand side is always $0$ and never $6$. Hence not a single solution exists, and there is no number for the symbol $6 \div 0$ to denote (<Ref to="prop-no-solution" />).

$0 \div 0$ denotes the solution of $0 \times x = 0$, but here every real number $x$ is a solution (<Ref to="prop-indeterminate" />). So $6 \div 0$ has $0$ candidates and "does not exist", while $0 \div 0$ has infinitely many candidates and "is not determined uniquely (is indeterminate)". Since the definition demands that a solution "exist and be unique", both fail.
</Solution>
</Exercise>

<Exercise id="exr-fake-proof-two" difficulty="Standard">
Point out the error in the following "proof", stating explicitly at which line an illegitimate step is taken and what it is.

"Let $x = 1$. Then $x^2 = x$. Subtracting $1$ from both sides gives $x^2 - 1 = x - 1$. Factoring the left-hand side gives $(x+1)(x-1) = x-1$. Dividing both sides by $x-1$ gives $x + 1 = 1$. Hence $x = 0$. Since we assumed $x = 1$, we get $1 = 0$."

<Solution>
The error is the line "dividing both sides by $x-1$". From the hypothesis $x = 1$ we have $x - 1 = 0$, so this operation amounts to dividing by $0$.

In more detail: the equation $(x+1)(x-1) = x-1$ is correct — substituting $x = 1$ makes both sides $0$. The inference from it to $x+1 = 1$ has the general form $ac = bc \implies a = b$, and that inference is valid only when $c \neq 0$, that is, only when one may multiply both sides by $c^{-1}$. By <Ref to="cor-no-field" />, $c = 0$ has no reciprocal, so the inference is unavailable for $c = 0$.

Note that the conclusion $1 = 0$ of this "proof" is exactly what <Ref to="thm-collapse" /> predicted: allow the operation of dividing by $0$ even once, and precisely this equation appears.
</Solution>
</Exercise>

<Exercise id="exr-limit-computation" difficulty="Standard">
Evaluate the following limits. Besides the answers, explain that the intermediate manipulations are not divisions by $0$ at $x = 0$.

$$
\text{(1)}\ \lim_{x \to 0} \frac{x^{2} + 3x}{x}, \qquad
\text{(2)}\ \lim_{x \to 0} \frac{(x+2)^{2} - 4}{x}, \qquad
\text{(3)}\ \lim_{x \to 0^{+}} \frac{x + 1}{x^{2}} .
$$

<Solution>
**(1)** Factoring the numerator gives $x^2 + 3x = x(x+3)$. In the limit $x \to 0$ we look only at the values passed through on the way to $0$, never at $x = 0$ itself. Hence we may assume $x \neq 0$ and cancel $x$:
$$
\frac{x^{2}+3x}{x} = \frac{x(x+3)}{x} = x + 3 \quad (x \neq 0).
$$
The right-hand side tends to $3$ as $x \to 0$, so the answer is $3$.

**(2)** Expanding the numerator gives $(x+2)^2 - 4 = x^2 + 4x + 4 - 4 = x^2 + 4x = x(x+4)$. As in (1), cancel for $x \neq 0$:
$$
\frac{(x+2)^{2}-4}{x} = x + 4 \quad (x \neq 0),
$$
and the limit is $4$. (This is precisely the computation of the derivative $f'(2) = 4$ of $f(t) = t^2$ at $t = 2$.)

**(3)** The numerator tends to $1$ as $x \to 0^{+}$, while the denominator $x^2$ tends to $0$ while staying positive. This is not of type $0/0$, so no cancellation occurs. Indeed, for $0 < x < 1$ we have $x + 1 > 1$, so
$$
\frac{x+1}{x^{2}} > \frac{1}{x^{2}} > \frac{1}{x}
$$
(the last inequality because $x^2 < x$ when $0 < x < 1$). By <Ref to="prop-divergence" /> the rightmost expression diverges to $+\infty$ as $x \to 0^{+}$, so $\displaystyle\lim_{x \to 0^{+}} \frac{x+1}{x^{2}} = +\infty$.

In all three problems, what was cancelled was a "nonzero number close to $0$", not $0$ itself. This is exactly the dividing line between division by zero and limits.
</Solution>
</Exercise>

<Exercise id="exr-convention-cost" difficulty="Hard">
Suppose we adopt the convention introduced in Section 6 of "defining $a \div 0 = 0$". Explain why this convention does not conflict with <Ref to="thm-collapse" />, and give one concrete example of a property that is lost in exchange.

<Solution>
**Why there is no conflict.** What <Ref to="thm-collapse" /> forbids is the existence, within the set of numbers, of an element $e$ satisfying $0 \times e = 1$. The convention creates no new number. The set of real numbers is left as it is, and only the symbol $\div$ is given the two-case meaning
$$
a \div b = \begin{cases} a \times b^{-1} & (b \neq 0) \\ 0 & (b = 0) \end{cases} .
$$
Writing $0 \div 0 = 0$ is not a claim that the reciprocal of $0$ is $0$ (were that claimed, we would have $0 \times 0 = 1$, hence $0 = 1$ by <Ref to="lem-zero-product" />, and everything would collapse). Therefore none of the laws of addition, subtraction and multiplication break.

**The property lost.** The most basic property of division,
$$
(a \div b) \times b = a ,
$$
fails for $b = 0$. Indeed, taking $a = 1$ and $b = 0$, the convention gives $1 \div 0 = 0$, so
$$
(1 \div 0) \times 0 = 0 \times 0 = 0 \neq 1 = a .
$$
Likewise "$a \div b = c$ implies $a = c \times b$" fails. In other words, this $\div$ is no longer the inverse of multiplication in the sense of <Ref to="def-division" />. Since using $(a \div b) \times b = a$ while forgetting to write the condition $b \neq 0$ yields false conclusions, a system adopting this convention retains the responsibility of stating that condition on the side of the theorems. The trouble has not disappeared; it has merely moved.
</Solution>
</Exercise>

## References

- Kazuo Matsuzaka, *Daisūkei Nyūmon* (Introduction to Algebraic Systems), Iwanami Shoten, 1976 (in Japanese) — the chapters on rings and fields; the standard treatment of the non-existence of an inverse of $0$ and of the zero ring.
- Mitsuo Sugiura, *Kaiseki Nyūmon I* (Introduction to Analysis I), University of Tokyo Press, 1980 (in Japanese) — Chapter I; rigorous definitions of limits and divergence.
- Lars V. Ahlfors, *Complex Analysis*, 3rd ed., McGraw-Hill, 1979 — Chapter 1; the introduction of the Riemann sphere and the point at infinity.
- Kim Plofker, *Mathematics in India*, Princeton University Press, 2009 — the treatment of zero by Brahmagupta and Bhāskara II.
- [IEEE Standard for Floating-Point Arithmetic (IEEE 754-2019)](https://standards.ieee.org/ieee/754/6210/) — the specification of `inf` and `nan` in division.

## Appendix: Exceptions or special values — which is better?

**In practical programming, division by zero is handled in two ways.** For integer division, many languages throw an exception and stop the computation; for floating-point numbers, the prevailing implementations return `inf` or `nan` and carry on. The Python example in the previous section showed the two coexisting inside one language.

**Both have their reasons.** Stopping with an exception is safe in that it never lets a mistake slip by. A vanishing denominator usually indicates a logical error in the program, so halting on the spot makes the cause easier to locate. Returning `nan`, on the other hand, comes into its own when a large numerical computation must not be interrupted. If, among a million data points, the denominator vanishes at just one, it is more practical to mark that one point as `nan` and finish computing all the rest. The `nan` acts as a tag reading "this value cannot be trusted", propagating into subsequent computations (any sum or product involving `nan` is again `nan`).

**What they share is that both refuse to return an ordinary number.** If $1/0$ silently returned $0$, that $0$ would be indistinguishable from a legitimate result, and the error would spread quietly downstream. What <Ref to="prop-no-solution" /> and <Ref to="prop-indeterminate" /> say is precisely that there is no ordinary number to return. Exceptions and `nan` alike are simply reporting this mathematical fact honestly, each in its own way.
