Multivariable calculus was never my best subject—I don’t have great intuition about graphs and equations, so I often had trouble visualizing the questions. I tend to approach shapes more like a topologist or a toddler with some Play-Doh: the exact equation isn’t terribly important to me, just the large-scale features. I think about mathematical shapes as if they are made of clay, not graphed using precise formulas. All that to say I still feel a little intimidated when someone shows me an equation and I’m supposed to know what it will look like if you graph it, or when I’m supposed to make the picture I see using equations.

Earlier this summer at an enjoyable conference about illustrating mathematics, one of the speakers introduced us to Surfer, and I started playing. Surfer is a free program you can download from the open mathematics website Imaginary, and it has an easy learning curve. The program has a lot of equations and their graphs built in, and you can start tinkering with them as soon as you’ve installed it.

While we were playing with Surfer, another conference attendee made a shape that astonished me: two linked hollow rings, or tori, pictured at the top of this post. “How did he do that?” I wondered, “It must be so difficult to find an equation that will create both of those tori at once!”

Then he showed me the equation he used, and I had an epiphany: when you’re graphing equations, it isn’t that hard to graph multiple objects at the same time because graphing lets you turn addition into multiplication.

Usually we think of multiplication as more complicated than addition, so turning addition into multiplication seems like the wrong direction. Ben Orlin of the excellent blog Math with Bad Drawings recently wrote a post about the rhythm of the logs (or less poetically, logarithms) that highlights one of the most important aspects of logarithms: they turn multiplication into addition.

As a refresher, taking a logarithm is the inverse operation to exponentiation. Exponentiation is taking a power: 34 means 3×3×3×3, for example. Because the logarithm is the inverse of the exponential, the equation 34=81 is equivalent to log3(81)=4. To generalize, y=bx and x=logb(y) encode the same relationship between the base b and the numbers x and y

Logarithms turn addition into multiplication by exploiting this property of exponentials: bxby=bx+y, so logb(xy)=logb(x)+logb(y). (For details on how that works, check out this page about logarithms and exponentiation.) Slide rules, which were essential computational tools before modern calculators supplanted them, exploit this relationship. They might seem unwieldy now, but before everyone had a calculator or computer to do arithmetic for them, logarithms enabled people to do calculations much more rapid than the traditional multiplication algorithm allows.

When we’re doing arithmetic, addition is easier than multiplication, so we change multiplication problems into addition problems using logarithms. But as I realized playing with Surfer, when we’re graphing polynomials, multiplication is easier than addition. We can “add” two shapes by multiplying their equations together.

To see what I mean, let’s look at how to graph an equation in Surfer.

The interface lets you type an equation in the variables x, y, and z on the left of an equals sign, but the right is always fixed at 0.

At first, this seems limiting. For example, the equation of a sphere with radius 1 is x2+y2+z2=1, and we can’t enter that into Surfer. But by subtracting 1 from both sides of the equation, we get the perfectly acceptable, if slightly less aesthetically pleasing, x2+y2+z2-1=0. As a reward we get a shiny pink sphere.

Why is the right side always 0? If you think back to math classes that asked you to work with polynomials, you might remember that 0 was a magic number. If I asked you to solve x2+x=12, for example, you might instinctively subtract 12 from both sides (or “move the 12 to the other side”) to get x2+x-12=0, then factor the left side to (x+4)(x-3) and tell me that x is either -4 or 3. That’s because factoring is extremely useful when one side of the equation is 0 and not so useful if it’s not.

If we had the equation (x+4)(x-3)=2, we wouldn’t have much to go on. If two numbers multiply together to be 2, one of them could be 1 and one could be 2, or one could be π and the other could be 2/π, or one could be -1/2 and the other could be -4. But if two numbers multiply to 0, one of them must be 0 itself—and it goes the other way: if you multiply two things together and one of them is 0, the product must be 0 as well.

Another way to think about it is that in multiplication, 0 is like the word or. If we have two polynomials, f and g, and multiply them together to get 0, the statement f×g=0 is equivalent to “either f or g is 0.” It could be that both f and g are 0, but or is all that's necessary. When you think about it this way, to borrow a line from Stephen Sondheim via the baker's wife in Into the Woods, or means more than it did before.

We can exploit this property of multiplication to make addition easier. If we know how to write equations for two different shapes, or the same shape in two different places, we can multiply the two equations we get together. The resulting equation will be satisfied whenever either one of them is, which is equivalent to drawing both shapes at once. We’ve made the addition problem of drawing two shapes into a multiplication problem with polynomials.

Some of you are probably bristling at the way I’m playing fast and loose with the word addition. Addition is for numbers. What does it mean to add shapes? You got me. The word I should really use here is union

In math, taking a union of two things just means you combine the two things. If you take the union of the odd whole numbers and even whole numbers, you get all the whole numbers. If you take the union of one donut and another donut that doesn’t overlap with it, you get two donuts.

Like 0 in multiplication, a union is similar to the word “or.” Something is in set A union set B if it’s in either set A or set B. This is a contrast to the intersection of two sets, which is like “and.” If something is in set A intersect set B, it has to be in both set A and set B.

Back at the conference when I first saw the linked tori my fellow Surfer-er had created, I was intimidated because I was thinking of the problem as an and question. But it was or, and or was easier.