The fear of dividing by zero is a common affliction. I caught it at school when trying to get my head around this well-known “proof” of 1 = 2:

- suppose that a = b
- then a
^{2}= ab - subtracting b
^{2}from both sides gives us a^{2}– b^{2}= ab – b^{2} - factorising gives (a + b)(a-b) = b(a-b)
- dividing both sides by a-b gives a+b = b
- But also a+b = b+b = 2b, so 2b = b. Dividing by b gives 2 = 1.

The problem is in step 5, in which both sides of the equation are divided by zero: helpfully, this article with a similar wrong proof explains that you **cannot ever** do that.

Looking at the available evidence in popular culture, interest in dividebyzerophobia is prevalent: for example, this Numberphile video has over 2 million views. Even Siri has something amusing to say.

So I was understandably very nervous when I first realised that graphical linear algebra lets you divide by zero. I double checked everything: something must have gone seriously wrong.

Let me explain.

In the last episode we saw that ordinary fractions ^{v}/_{w} (where w≠0) can be represented as the sugar:

We then discovered that the usual rules for doing arithmetic with fractions follow from the equations of our algebraic system:

The derivations made use of the fact that q and s are not zero.

So far so good, but there’s an important difference between fractions and our diagrams. Fractions are inherently *asymmetric*: the numerator is allowed to be zero, but the denominator is not. On the other hand—as we saw two episodes ago—the generators and equations of graphical linear algebra are symmetric.

So, since by definition we have

if we can draw the diagram for ^{0}/_{1}, then there’s nothing stopping us from drawing the diagram for ^{1}/_{0}:

But we are **never** allowed to do this, right?

Stay calm and take a deep breath: dividebyzerophobia is an irrational fear, caused by a deficiency of the fraction notation that we all grew up with. I no longer suffer from it and, with the right dosage of graphical linear algebra, neither will you.

As we have seen, all fractions are diagrams with one dangling wire on the left and one on the right. But—as we just discovered—not all diagrams of this type are legal fractions. In fact, there are precisely three that fail to be of the right form, and they all involve dividing by zero in some way. Let’s give them names:

It makes sense to choose ∞, the symbol for infinity, as the name for the 1/0 diagram: for example ^{1}/_{x} diverges to positive or negative infinity as x approaches zero. And positive and negative infinity are one and the same in projective arithmetic.

We will come back to projective arithmetic in more detail in the next episode. For now, let’s verify whether our diagrams indeed tell us that positive and negative infinities are equal.

The remaining two elements, ⊤ and ⊥, are two ways of resolving what we might mean by ^{0}/_{0}, which is ambiguous. This ambiguity does not exist when talking about ordinary fractions: if w is nonzero, the following two diagrams are equal, using the fact that nonzero sugars commute with sugars heading in the opposite direction. We showed that in the last episode.

So both of these diagrams represent the fraction ^{v}/_{w}. But when v=w=0, the two diagrams are different: the first is ⊤, the second ⊥.

I’ve coloured ∞, ⊤ and ⊥ differently from our usual sugars, because, as we will see, they don’t behave quite as well as ordinary fractions. Nevertheless, we can try to do arithmetic with them as we did with fractions.

For example, what happens if we take some (legal) fraction ^{p}/_{q} and add it to ∞?

We seem to get stuck at this point because we don’t have any equation that tells us what happens when we plug the (wrong way) zero generator into a copy. It turns out that:

Here’s a derivation:.

Using what we know about symmetry in graphical linear algebra, we can immediately state the bizarro version, which is

Continuing our calculation ①, we get

So, given any fraction ^{p}/_{q} we have that ^{p}/_{q} + ∞ = ∞. In fact, using (†) and (‡), we can also show that ∞ + ∞ = ∞, ⊤ + ∞ = ∞ and ⊥ + ∞ = ∞. So anything plus infinity is infinity.

In the fifth line of the above calculation we used a property we have not yet proved, that whenever w ≠ 0, the w can come out of a discard. This property is related to one from the last episode: nonzero sugars can go the wrong way over copy. Here’s a reminder of what this means, together with its bizarro version:

To keep a clear conscience, let’s prove the new property. Its bizarro version, which says that the zero generator can swallow nonzero sugars, will also come in handy in proofs.

Using the usual symmetry argument, it’s enough to prove one.

Also, since we didn’t do it earlier, this seems a good time to check whether ^{0}/_{w} is actually the same as 0. In the second step we use our new fact about the zero generator and nonzero integer sugars.

We may as well fill out the full addition table, which takes account of all possible ways that (1,1) diagrams can be added. In the table below I separated 0 from the nonzero fractions, where both the numerator and the denominator are not zero.

Remember that our diagrammatic addition is commutative, so we don’t need to fill the table below the diagonal.

+ | 0 | ^{r}/_{s} |
∞ | ⊤ | ⊥ |

0 | 0 | ^{r}/_{s} |
∞ | ⊤ | ⊥ |

^{p}/_{q} |
– | ^{sp+qr}/_{qs} |
∞ | ⊤ | ⊥ |

∞ | – | – | ∞ | ∞ | ∞ |

⊤ | – | – | – | ⊤ | ∞ |

⊥ | – | – | – | – | ⊥ |

Perhaps the most mysterious equation in this table is ⊤ + ⊥ = ∞. It’s very simple to justify:

Multiplication is a bit more hairy, because although it is commutative on ordinary fractions—as we saw in the last episode—it is not always so when we consider the expanded system with the additional three elements. This means that now we need to fill in the entire table.

× | 0 | ^{r}/_{s} |
∞ | ⊤ | ⊥ |

0 | 0 | 0 | ⊥ | 0 | ⊥ |

^{p}/_{q} |
0 | ^{pr}/_{qs} |
∞ | ⊤ | ⊥ |

∞ | ⊤ | ∞ | ∞ | ⊤ | ∞ |

⊤ | ⊤ | ⊤ | ∞ | ⊤ | ∞ |

⊥ | 0 | ⊥ | ⊥ | 0 | ⊥ |

There are some interesting symmetries in the table. And we can resolve the old philosophical conundrum about what happens when we multiply infinity by zero! In graphical linear algebra it turns out that 0 × ∞ = ⊥ and ∞ × 0 = ⊤.

What do we really mean by “dividing by zero”? As Siri says, it does not make much sense to divide cookies amongst zero friends; even when the Cookie Monster is happy, you are still sad.

Graphical linear algebra comes with the mirror image symmetry. We will use the dagger (†) superscript to mean mirror image. So if d is a diagram of type (m,n) then its mirror image d^{†} is a diagram of type (n,m). Clearly, no matter what the d, we always have d^{††} = d.

When d is a nonzero fraction sugar, then it turns out that d† is the **multiplicative inverse** of d: this means that d ; d† = d†; d = 1. It’s an easy derivation:

When d is 0, ∞, ⊤ or ⊥ then this is no longer the case, as can be seen from the multiplication table. For example 0 ; 0† = 0 ; ∞ = ∞ × 0 = ⊤ and 0† ; 0 = 0 × ∞ = ⊥.

Since † does not always mean multiplicative inverse, what are some properties that it **does** satisfy for all (1,1) diagrams? Here is one: d and d^{†} are the weak inverse of each other.

d ; d^{†} ; d = d

d^{†} ; d ; d^{†} = d^{†}

I’ll leave this as a simple exercise. It will be great as the first step in your dividebyzerophobia treatment programme. For nonzero fractions, the equations follow from the fact that † gives us the multiplicative inverse. To treat the other cases, you will only have to do four calculations, because ⊤^{†} = ⊤ and ⊥^{†} = ⊥.

The mirror image symmetry will be very useful when we talk about inverting matrices in graphical linear algebra. I’m thinking of bringing some of this material forward—maybe already to the next episode—because it is a nice example of how dividing by zero can actually be useful in calculations.

Although it was fun to fill in the addition and the multiplication tables, there are good reasons not to give ∞, ⊤ and ⊥ the same status as we give to the numbers (naturals, integers, fractions) that we have seen so far, and others (reals) that we will talk about in the future. This is why we have been colouring their sugars differently.

I don’t plan to get bogged down in a philosophical discussion about “what is a number?” (Episode 17 did not seem to go down too well) but there are a number of useful properties that “numbers” ought to satisfy in graphical linear algebra. For one, the bizarro of a number should be itself. This works for ∞, but ⊤ and ⊥ are the bizarro of each other.

It is also very useful to know that numbers, whatever they are, satisfy the following:

We know from earlier episodes that they hold for the natural numbers and for the integers. Given what we now know about nonzero sugars going “the wrong way” over copy and addition, and into discard and zero, it is follows that they hold for fractions as well. So, the a in the above equations can be any legal fraction.

These properties allow us, amongst other things, to prove that multiplication distributes over addition. But all three of ∞, ⊤ and ⊥ fail some of these four tests. For example, we have:

And these two diagrams cannot be shown equal in our theory. For now, you could think about the underlying relations, but we will get more precise about characterising diagram equality in the next episode.

So—long story short—while we will not think of them as numbers per se, we will not panic when we see ∞, ⊤ and ⊥ popping up in calculations. They are all perfectly harmless.

In algebra, the notion of a set of elements with addition and multiplication, where multiplication is commutative and distributes over addition is called a commutative ring. If all nonzero elements also have a multiplicative inverse, the resulting structure is called a field. The rational numbers (i.e. fractions) and the real numbers are two examples.

Fields are a little bit peculiar from an algebraic perspective, because the operation of taking multiplicative inverse is *partial*: 0^{-1 }is left undefined. Having partially defined operations complicates things.

One classic way of addressing this defect is projective arithmetic, which we will see in more detail in the next episode. There ^{1}/_{0} makes sense, but ^{0}/_{0} is still typically left undefined. Recently, inspired by projective arithmetic, Youtube legend Norman Wildberger proposed to hack fraction notation so that 0 is allowed in the denominator: you can check out some videos starting from this one. I have not yet had the time to understand the details, but it seems that you have two new elements that correspond to ^{1}/_{0} and ^{0}/_{0}; the latter seems to be our ⊥ but there is no ⊤.

There are some other algebraic systems that go the whole hog and make all operations defined everywhere. Two that I’ve come across are *wheels *and *meadows*. If there is interest, I can write more about these; let me know in the comments.

There is one fundamental difference between the above approaches and arithmetic in graphical linear algebra. There, existing notation (e.g. addition, multiplication, fraction notation) and associated equational theories were *extended* in some way to make sense of dividing by zero. In graphical linear algebra, addition is not even a primitive operation, or at least it’s not primitive in the same sense. So instead of setting out to make sense of ^{1}/_{0}, we *discovered* that it was already happening, in a similar way to how we discovered the natural numbers lurking in the theory **B** of bimonoids.

I was in Edinburgh for a couple of days last week. I left Southampton on a cold, dark and wet morning and arrived in a Scotland bathed in glorious sunshine.

I was there as the external examiner for the PhD defence of Ricardo Honorato-Zimmer, a student of Vincent Danos. It was great to have the chance to catch up with Vincent. He is one of the few scientists I know who is a true polymath—his background is the French school of logic, and his early contributions to the proof theory of linear logic are pretty famous. Around ten years ago, Vincent became interested in stochastic formalisms and graph rewriting, and together with a number of people he developed the Kappa language for modelling protein interaction networks. Vincent’s group is now full of chemists, biologists, mathematical physicists, mathematicians and computer scientists who all manage to communicate (this is far from easy in my experience!) and moreover come up with real advances. Academic politicians like to throw around the term “multi-disciplinary research”, but often the reality behind the buzzword is somewhat underwhelming. It’s always amazing to see the real thing in action.

The day after the defence I gave a short talk about graphical linear algebra at the LFCS seminar. Afterwards I met Kevin Dunne, who is doing a PhD with Ross Duncan at the University of Strathclyde in Glasgow. Kevin told me his idea about how to develop the theory of eigenvalues and eigenvectors with graphical linear algebra: it sounded fantastic and I’m really looking forward to figuring out the details. I also met Nick Behr, who is a mathematical physicist working with Vincent. He told me about the Umbral calculus, used to reason about formal power series, and we tried to figure out the relationship with some related techniques that Filippo, Fabio and I developed using graphical linear algebra. He will visit Southampton for a few days in January; it’s going to be exciting!

I had to come back to Southampton not long after my talk. This time, I experienced some more common Edinburgh weather: I walked from the computer science department to Waverley station in rain and gale force winds. The locals seemed undisturbed.

Continue reading with Episode 27 – Linear Relations.