7. Copying, Discarding and The Slogan

Graphical linear algebra has five stars as its leading actors. We know two of them already: addition and its trusty sidekick zero. Two more make an appearance in this episode: their names are copy and its sidekick discard. We will have to wait a few episodes for the fifth star to make an appearance. Sometimes our main stars will have to play in the mirror; you will see what I mean when we get to that point in the story. There is also a supporting cast, by the way. We will them meet in due course, but they are nowhere near as important as the five central players.

In the Real World™, the ability to copy and discard things seems to be quite rare. When making Crema di Mascarpone, following our recipe from last time, it is not enough to just have one egg. We can’t just magically copy it. Also, after cracking the egg, you are also left with some eggshells. Unfortunately, I omitted this from the—therefore somewhat unrealistic—recipe, and this mistake was duly pointed out in the comments section. Even if you do throw the shells in the bin, they don’t just magically disappear.

Of course, one thing that can be copied is (the non quantum kind of) information. For example, a file on your hard disk can be copied and deleted as many times as your disk space will allow. Copying and discarding is the main topic in this episode. So without further ado, it’s time to meet the new generators.


 

First, the copy generator. It has one dangling wire on the left, and two dangling wires on the right, just like Crack Egg generator from the last episode. We will draw it with a black filled-in circle, so that we don’t confuse it with adding.

copying

We will continue to use our intuition of numbers travelling from left to right along wires for now. Copy takes one argument and has two results, and it lives up to its name by—wait for it—copying. For example, if a 42 arrives as an argument, two copies of 42 exit as results. Like so:

42Copy works the same way for any number that arrives as its argument, so we could summarise this behaviour by using a variable.

xcopy

That’s about all there is to say—copy does what it says on the tin. It’s not complicated.

So what about its sidekick, discard? It also gets a generator, with one dangling wire on the left and no dangling wires on the right.

discard

Discard, again as its name implies, simply throws away anything supplied as its argument. Simple enough — a 42 may arrive, and it is forgotten. Think of discard as an efficient number disposal system.

There is an interesting thing to notice about copy and discard; they look like adding and zero, but reflected, as if a mirror were placed on the side. More accurately, a special “colour inversion” mirror that turns white into black and black into white.  What I mean is that, while add has two dangling wires on the left and one on the right, copy has two dangling wires on the right and one on the left. Zero and discard are, similarly, reflections of the other.

Another interesting fact is that copy and discard satisfy three equations that are very similar to the ones that we already met for adding and zero. We will run through them now.

cocomm

First, there is the (CoComm) rule.  If I copy a number then its the same thing as copying that number and swapping the copies. It’s obvious right? The copies are exactly the same, so I can’t tell which one is which: the behaviour of the left hand side and the right hand side is the same.

By the way, I should explain the “Co” in front of “Comm” in “CoComm”. Mathematicians often use the “co-” prefix to talk about familiar things that have been turned around. And (CoComm) is just (Comm) reflected and coloured black.

coassoc

Next up is (CoAssoc), which is the reflected, photographic negative copy of (Assoc). If we copy something and then copy one of the copies again, then we have three equal copies. It doesn’t matter which of the two initial copies we copy again.

counit

Finally, I have (CoUnit), which is the bizarro version of (Unit) (for the non-nerds amongst you, the bizarro world is a strange “reverse” version of Earth in the Superman universe where cigarette butts are treasures, evil is good, and so on).  Again (Counit) is easy to understand: if I copy something and throw away one of the copies, it’s as if I have done nothing at all.

By the way, mathematicians sometimes call a structure that satisfies (CoComm), (CoAssoc) and (Counit)  by the rather grotesque name cocommutative comonoid. And because the word “cocommutative” sounds like it has something to do with mutant coconuts, we will just say commutative comonoid. Copy and discard are, therefore, an example of a commutative comonoid.

 

Remember the upside-down (Unit) law that we proved last time? Here is its bizarro version.

counitrev

Look again at the diagrammatic proof at the end of the last episode. We can use exactly the same steps, but in the mirror, using (CoComm) and (CoUnit) instead of (Comm) and (Unit). Take a break from reading now, grab some paper and a pencil, and draw the steps!

In fact, any diagrammatic proof about addition that uses only (Comm), (Assoc) and (Unit) can be reflected to give us a similar proof about copy and discard. This can potentially save a lot of work when proving things: we already know that the upside-down version of (Counit) is true because we proved the reflected version.

Mathematics in general, and especially category theory, is full of situations like this, which are often called dualities. In a duality, you prove one thing and you already know that its backwards version is true. This is because the two proofs are morally the same thing, one is just the bizarro version of the other.


It’s time for the first big reveal of the story. We have talked about the ways in which we can understand adding and copying numbers with diagrams. Linear algebra is all about adding and copying. Here is a nice, bold slogan:

Linear algebra is the mathematics of adding and copying.

By the way, I mean adding and copying together with their respective sidekicks, zero and discard. And I mean what the slogan claims quite literally: if you already know about linear algebra, then every concept you learned is a consequence of the very beautiful ways that adding and copying work together. Matrices, spaces, bases, eigenvalues, eigenvectors, and so on. If it’s a concept of linear algebra, it concerns some interesting interaction between adding and copying. It turns out, probably not surprisingly, that adding and copying are quite common in many areas of science and mathematics: hence the Makélélé status of linear algebra.

Why is it, then, that linear algebra is not usually taught as the thing that happens when addition meets copying? I think that it is because traditional mathematical notation is not well suited for expressing  the operations of copying and discarding in isolation. I can write 2 + 4 and everyone knows that I am adding two numbers. But how do I express the action “copy 2” or “discard 5“? This is not a problem for our graphical notation: addition and copying have equal status as generators. One is not any more awkward to talk about than the other.

As a consequence, the graphical language that we are using is perfect for showing off the inner beauty of linear algebra. Similarly,  it is more directly related to several of linear algebra’s glamorous applications than traditional notation. You will see what I mean if you stick around. Copying meets adding for the first time in the next episode.

Continue reading with Episode 8 – When Adding met Copying…

Advertisements

5 thoughts on “7. Copying, Discarding and The Slogan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s