# “O Function! My Function!” Photo by Arash Asghari on Unsplash

I’m going to build a simple set of functions. This set will wind up being very familiar when I’m done, but let’s pretend for a few minutes first.

## Function and Operators

In case you’ve forgotten what a mathematical function is, there are a few quick ways to refresh your memory. A common way is to say that a function is a machine that takes some input and spits out a predictable output. The output may change with the input, but the key is: If you put a specific thing into the machine, you can always predict what you’ll get out.

More formally speaking, a function is a set of mathematical rules. We often don’t learn the word “function” until middle school, but we learn our first function pretty much from day one in math class in Kindergarten. Addition is a binary function: Given two inputs, the machine spits out a single output. +(4, 3) always spits out 7. Every time. (As long as we’re using base ten and standard addition, but that’s a different subject.)

At some point we learn subtraction as if it’s a different thing, but in reality, subtraction is the addition of the opposite: We could get rid of the binary operator subtraction by replacing it entirely with the unary operator opposite. -(4, 3) = +(4, ~3). That’s yet another sidebar.

Then we learn about multiplication, somewhere in the early grades. *(4, 3) = 12. Division is multiplication of the inverse, which is to say, ÷(4,3) = *(4, /3).

The notation I’ve been using is meant to reinforce this notion that operators are functions, but of course we much more typically write 4+3, 4–3, 4*3, and 4÷3. These are the four most basic operators, and while we might get hints of the others (particularly square root and exponents) in elementary school, that’s where we spend the bulk of the first half dozen years of our public school education.

## Algebra Before Functions

At the beginning of algebra, we usually introduce the concept of a variable before the concept of a function. We start with a statement with a single variable (usually x) and then “solve for x”: 4x + 3 = 7.

This is far too often taught as a “two-step” problem. I say “too often” because students learn an algorithm for “unwinding” to “solve for” the unknown value. Common sense starts to slip away from the student’s thought process: They seem to lose the ability to have a big picture approach, and just mindlessly follow those unwinding steps. Subtract three from both sides. Divide both sides by four.

If they grumble, we remind them that the word “algebra” comes from a book about keeping the two sides of an equation in balance. We don’t mention that Al-Khwarizmi himself (the one who wrote the book “Al-kitab almukhtasar fi hisab al-jabr wa’l-muqabala”) didn’t use modern algebraic notation. He used words and drawings. Mostly lots and lots of words.

What we’re really doing in these equations is finding a value for x that, when inserted in that equation, makes it true. There are different ways we could do that. We could just try some values that seem reasonable: 7 is bigger than 3, so 4x must be positive. Try 1: 4 * 1 + 3 = 7. Hey, lookie there. We got it on the first guess.

I hear the keening of many of my fellow math teachers: HOW DARE I! HOW DARE I ENCOURAGE GUESS-AND-CHECK!

Hey, colleagues: I’ve been to math training sessions with y’all. I’ve seen you guess-and-check on problems you’ve never solved before. It’s okay. If we do it, they can do it.

It’s not at all uncommon, for that matter, for mathematicians to try guessing for reasonable values when encountering a problem they’ve never seen before.

But I digress.

## Functions in Algebra

By the time we formally introduce the concept of functions in Algebra I or Pre-Algebra, students have already been dealing with the underlying concept for years. But they still need some basic scaffolding, if only in the form of pointing that out.

To turn our binary operator functions into unary functions, which are easier to deal with, we set one of the values as a constant and the other as a variable. So instead of the “add” machine, we talk about the “add two” machine and the “add seven” machine. Instead of the “multiply” machine, we talk about the “multiply by five” machine and the “multiply by forty-two” machine.

We might also talk about the set of “subtract” machines and the set of “divide” machines, but we don’t need to. “Subtract three” and “add negative three” have the same result. “Divide by two” and “multiply by one half”: Same result. (The “divide by zero” machine is invalid, which confuses students… another digression.)

It turns out that “add value” and “subtract value” machines can be strung together and compacted: “Add five” and then “subtract three” and then “add negative six”, together, have the same effect as “add negative four” (or, if you prefer, “subtract four”).

Likewise, “multiply by value” and “divide by value” machines can be strung together: “Multiply by two” and “divide by four” and “multiply by five” results in “multiply by 2.5”.

Point being: If we limit ourselves to just addition/subtraction or just multiplication/division, we can reduce things down to single-step machines.

## Mixing the Levels

So what if we string together machines that do any of our four basic operations?

It turns out that we can always simplify those, too… down to a machine that adds something, and a second machine that multiplies something.

Since we like multiplying before we add, let’s do that: Let’s rewrite any old combination of addition, subtraction, multiplication, and division into a function that multiplies a value, then adds something to its product.

For instance, if our machine is (((x+3)*10)–2)/5, how could we rewrite that to a machine that multiplies then adds?

Here’s a machine always has the same result as that more complicated one: Multiply by two, then add 5.6.

Which is to say, (((x+3)*10)–2)/5 = x * 2+ 5.6.

Without leaving the realm of our four basic operators, this is nearly the limit of what we can do: We can add something, we can multiply by something, or we can multiply by something then add something else. Just about any machine that’s more complicated than that would require us to use another operator.

I say “just about” because there’s one more thing we can do: Instead of “divide by value”, we can create a machine that takes some constant by our input; let’s call that the “value divided by” machine. For instance, instead of x/4, we could use 4/x. And while reversing our other three machines doesn’t have a significant impact (we can rewrite our reversed machines using our existing machines), reversing this one does.

Let’s mix our first four machines (“add value”, “subtract value”, multiply by value”, and “divide by a value other than zero”) in any fashion we please, chaining them together until we’re utterly bored. Every single machine we create this way has the same effect as some machine of the form x * a + b, where and b are real numbers.

This is a linear function. There are two important mathematical truths here:

• If we want a function that generates a line when graphed (other than horizontal or vertical lines*), we can always write it this way.
• If we want a function that does something other than generate a line when graphed, we need to do something other than add, subtract, multiply, or divide our input by some real number.

To me, that’s a pretty significant thing. No matter how much we hammer or jam or smoosh or shove, our machines will just keep generating functions which make lines when graphed.

This is awesome. This needs to be taught, preferably by teachers who stand on desks like Robin Williams, who shout their enthusiasm for this from the depth of their diaphragms.

## * Post-script: Darn horizontal and vertical lines!

Horizontal lines are graphs of functions that don’t change when x changes. The output is always the same. The only way to make the output always the same is to exclude x from the input. So 4 is a function; if you graph y = 4, you get a horizontal line. It’s a silly function from a machine that most people would consider broken: No matter what you put in, you get 4 out. But it’s still, by the strictest mathematical definition, a function.

Vertical lines are not graphs of functions. We can write an equation which, when graphed, will be a vertical line, but we don’t consider it a function. If it were a machine, it would only take a single input and spit out every possible output, which isn’t a very useful machine at all. If you graph x = 4, you get a vertical line.

Oh, and for the pedants out there: I realize that some of what I’ve said isn’t entirely rigorous. For instance, x = 4 can be the graph of a function, if we call the input of our machine and the output x. I am using the standard protocol here, instead of boring the socks off of casual readers by referring to “functions on x”. Clio Corvid