Using The Concept Of "machine" To Teach Algebraic Concepts To Elementary School Students

The ideas presented in this article came about as a response to a perfectly awful third grade text book lesson which my wife was forced to present when she was student teaching. The lesson was intended (I suppose) as an introduction to algebraic concepts.

Without any motivation or other rationale, the text introduced a problem:

If 3 × X = 12 what is X?

This was followed by a description of the standard algebraic procedure for solving the problem:

  • Divide both sides of the equation by three;
  • “Cancel” the “3”s on the left hand side;
  • Divide 12 by 3;
  • Conclude that X = 4.

This procedure was described by a sequence of diagrams, each showing the next step in the transformation. The authors of the text were clearly under no illusion that a typical or even advanced third grader would understand the meaning and justification behind an algebraic derivation. The level of abstraction required to understand the concept of variable, the meaning of an equation, the idea that equations are assertions which can be transformed to logically equivalent assertions and the strategy for deriving a solution is light years beyond anything a normal third grade student has encountered or could possibly understand. The goal was simply to teach the students a mechanical procedure in the way one might program a computer.

In attempting to recast this lesson in a form that might be meaningful and even valuable to third grade students the challenge is how to make the concepts involved concrete. When a child thinks of a (whole) number she can imagine a basket of apples or a stack of pennies. When a child thinks of addition the child can think combining baskets of apples or stacks of pennies. But what interpretation can a young child give to an equation or a variable?

We start by considering how we might visualize a variable and an equation involving a variable in terms of some kind of more or less concrete object that would make sense to an eight year old. A variable is a kind of object, which can be assigned different values. An equation involving a variable is a statement which depending on the value we assign to the variable may be either true or false. We may thus think of an equation as a kind of question answering machine. This machine accepts a number, which is to be assigned as the “value” of the variable, and the machine answers the question: “Is the equation true when this value is assigned to the variable?” We can picture such a machine operating as in the following diagrams.

The machine has a part we have labeled the input where values are placed and a part called the output where answers are produced. We will call machines that produce an output when presented with an input, Input/Output Machines. When presented with an input value, the machine illustrated above, which we have labeled “3 × X = 12?” substitutes that value for the variable X in the equation 3 × X = 12, evaluates whether the resulting equation is true or false, and outputs the result. Thus when we enter the input “3,” the machine substitutes “3” for “X” in the equation “3 × X = 12,” resulting in the equation “3 × 3 = 12” which, when we substitute the value of 3 × 3 for “3 × 3,” gives the equation “9 = 12” which evaluates to “False” which is then output. Using this machine, we can restate the original problem as: “Find an input for the “3 × X = 12?” machine which causes this machine to output True.

While this machine may help students to visualize the meaning of an equation as a machine that outputs True or False, it seems questionable whether young students would understand the manipulations involved in substituting a value for a variable or substituting values for expressions as when we substitute “9” for “3 × 3.” Further it seems likely that the interpretation of an equation not as an assertion but as a predicate, i.e. an expression that may be “true” or “false” would be confusing to students. We can simplify the problem in two ways. First we can get rid of the equation by considering the following Input/Output machine.

Here we’ve replaced the equation, “3 × X = 12?,” by the expression “3 × X”. Like the equation machine, when presented with a value as input, this machine substitutes the value for the variable and evaluates the expression and outputs the value. The difference is that in this case the value of the expression is a number rather than “true” or “false.” For example, when presented with input “3”, this machine produces the value “9”. In terms of this machine we can restate our problem as “Find an input value which causes the ‘3 × X’ machine to output 12.”

While we have eliminated the need to interpret an equation as a predicate, it still requires the student to make sense out of the concept of a variable and the process of substituting into a symbolic expression and simplifying. So our final step in the reduction of the problem is to eliminate the use of the variable. After all, what does the “3 × X” machine do? It takes whatever input you present to it and multiplies by 3. We can describe this without using a variable. We simply call this the “Times 3” machine (or if you prefer the “Times by 3” or perhaps the “tripling” machine.)

Now our problem can be stated entirely in terms of the Times 3 machine: find a number which when input to the Times 3 machine produces output 12.

No doubt some would argue that in this formulation we have “watered down” the lesson precisely in that we have eliminated the use of a variable, the notion of an equation as a predicate, and the symbolic manipulation of expressions. Our counter to this has two elements. The first is that even if a typical third grader can be programmed to carry out these manipulations their meaning, justification, and value are totally beyond his capabilities. Put differently, if a student can make sense of variables, equations as predicates, and symbolic manipulation then she is actually ready to learn algebra “for real” and as far as we know no one is seriously proposing algebra as a standard for the third grade curriculum. Our second point is that, as we hope to make clear in the following discussion, we have replaced notions that are beyond the ken of a third grader with concepts and principles the student can understand and which are ultimately far more fundamental and important to the student’s mathematical development.

These concepts include that of a mathematical function and relations and operations on functions as represented here by an “input/output machine.” The significance of these concepts cannot be overstated and given their importance, time spent developing the student’s intuition about them is time well spent. For this purpose we need not be restricted to numeric or even mathematical machines.

We have experience with many examples of objects or systems that behave like input/output machines. A vending machine provides a good example. The input to the machine is money and the output is candy or whatever products the vending machine is vending. Real vending machines are a little more complicated than this of course because the input is usually the money plus an item selection, which we may make by pressing a button or pulling a knob. We could picture such a machine this way.


There is no problem to extending the notion of input/output machine to allow multiple inputs. There is also no problem allowing input/output machines to have more than one output. For example, we might have an additional output for change.


A factory is another example of a kind of input/output machine. The inputs are the raw materials and the outputs are the finished goods. The factory below takes cocoa and sugar as inputs and outputs chocolate bars.

Of course, an input/output machine needn’t be made of brick or metal. A person baking cupcakes can be thought of as an input/output machine. The inputs are the ingredients (flour and so on) and the output is a cupcake. A leaf can be thought of as an input/output machine that takes sunlight, water, and carbon dioxide and outputs sugar and oxygen. An animal can be thought of as an input/output machine that takes oxygen and sugar as input and outputs water and carbon dioxide. You can even think of yourself putting on your shoes and socks as an input/output machine. The input is you in bare feet, a pair of socks and a pair of shoes and the output is you with your socks and shoes on.

The really interesting and important thing about input/output machines is that sometimes you can take two or more input/output machines and connect them together to make a new kind of input/output machine. As an example, suppose I sell machines and I’ve got two kinds of machines. One is a cupcake-making machine that makes cupcakes from mix. The other is a chocolate frosting machine that takes whatever you give it, (dogs, cats, kids, bats, balls, cookies, fruit, whatever!) and puts chocolate frosting on it.

One day I get a call from someone who wants a special machine that makes chocolate frosted cupcakes. I say, “Well we have a machine that makes cupcakes and we have a machine that puts chocolate frosting on things but I don’t have a machine that makes a chocolate frosted cupcake. Maybe the chief machine maker (the CMM) can figure out a way to make one?” The CMM says, “No problem, we’ll take a cupcake maker and a chocolate froster and connect the output of the cupcake maker to the input of the chocolate froster and we’ll put the whole thing in a box and call it the Chocolate Frosted Cupcake Maker.”

So now I’m selling three machines: my cupcake maker, my chocolate froster, and my chocolate frosted cupcake maker. After a while I add a “Cherry Topping” machine to my product line. The cherry topper takes whatever you put in and puts a cherry on top.

Things are going along well and then one day I get a call from a customer who wants a machine that will make a chocolate frosted cupcake with a cherry on top. I don’t make one so I go to my chief machine designer. He says, “No problem” and designs a machine consisting of a chocolate frosted cupcake-making machine connected to a cherry-topping machine with a box around the whole thing. So the contraption looks like this.

The operation of connecting two input/output machines is also called composition, as in forming a “composite” or “compound”. As any mathematician will agree, composition is the most fundamental operation in mathematics. Composition is what allows us to build arbitrarily complex assemblies, concepts, and theories from simple components. It is also the basis of logical deduction: if A can be derived from B and C can be derived from B then C can be derived from A. Not surprisingly, the most fundamental principle of mathematics concerns composition. We can describe this principle using a dishwasher.

As illustrated below, our dishwasher is built out of three component machines: a washer, a rinser, and a dryer.


The dishwasher is a machine that takes dirty plates as input and produces clean dry plates as output. Looking inside the dishwasher we see that the dirty plate first enters a washer which produces a clean but soapy plate as output. The soapy dish then enters the “rinser” which produces the clean but wet plate as output and the wet plate is then put through the dryer that produces the final output: a clean dry plate.

There are a number of different ways of organizing the components of the dishwasher. One way is just to view them as three separate elements of the dishwasher. Another, illustrated below, is to associate the Rinser with the Washer and view the pair as forming a Washer-Rinser machine which is then connected to a dryer.


Another way of viewing the components is to associate the Rinser with the Dryer to form a Rinser-Dryer machine and connect the Washer to the Rinser-Dryer.


Now we ask the question: does the way we view the organization of the components:

  • A washer connected to a rinser connected to a dryer or
  • A washer-rinser connected to a dryer or
  • A washer connected to a rinser-dryer

make any difference to the behavior of the dishwasher? To answer this question, consider the behavior of the dishwasher from the point of view of the plate. No matter how we view the organization of the components, all the plate “sees” is that it first gets washed by the washer and then gets rinsed by the rinser and then get dried by the drier. So the results are the same. This is the most fundamental principle of mathematics. It is sometimes called the associative law of composition. It says that no matter how we associate the components in a composition of input/output machines, for example associating the rinser with the washer vs. associating the rinser with the dryer, the behavior of the composite machine is the same.

The associative principle might lead us to ask whether the order in which machines appear in a composition matters. The answer is a definite yes! Consider a composite made up of two clothing machines: One accepts a person as input and puts on underwear and the second takes a person and puts on outerwear. If we connect the machines in one order we get a machine that properly dresses a person with underwear underneath and outerwear outside. If we connect the machines in the opposite order then we get machine that puts our underwear over our outerwear. These machines are definitely not equivalent. So in general, when connecting machines the order matters!

The crucial concept for solving problems like the one in our lesson, is the concept of inversion which we will represent by an “Un-machine.” Let’s consider an example.
Billy and Sally like to send love notes to one another in class. Since they don’t want other people to read them, they use a secret code. The way the code works is that each letter in the message is replaced by the letter that comes after it in the alphabet. So, “A” is replaced by “B”, “B” is replaced by “C”, and so on. Of course, “Z” have a following letter so we replace it with “A.” To decode the message we do just the opposite: replace “B” with “A”, “C” with “B”, …, “Z” with “Y”, and finally “A” with “Z”. We can picture this process in terms of an “alphabet circle” as illustrated below. The coding process substitutes the next letter in the clockwise direction and the decoding process substitutes the next letter in the counter clockwise direction..

When Billy sends the message, he codes it using the coding method, and when Sally receives it, she decodes it using the decoding method. We can visualize this in terms of input/output machines as in the following diagram.

So, what is done by the coding machine is undone by the decoding machine, so if I feed the output of the Coding machine into the decoding machine I get my input back. Put another way, if I connect the coding machine to the decoding machine I get a machine that outputs exactly what you put into it. For example we put “I love you” in and we got “I love you” out. A machine whose output is always identical to the input in is called an Identity machine. A telephone provides another example of an identity machine.


When you speak into the phone, a part of the phone called the microphone takes the sound as input and produces an electrical signal as output. The electrical signals are then sent to the phone of the person you are talking to where another machine called a speaker takes the electrical signal as input and produces the same sound for the other person. Again we have an example of a machine, in this case the speaker, which undoes what another machine, the microphone, does so that when the two are connected we get an identity machine for sounds. We will call a machine which undoes what another machine does an unmachine for the first machine. Thus the decoder is an unmachine for the coder and the speaker is an unmachine for the microphone.

If we have an unmachine for a machine then we can answer questions of the form: “What was the input that produced this output?” by feeding the output into the unmachine. Consider the “Add 2” machine. You put a number in and it outputs the number + 2. So if you input 5, it will output 7, and if you input 12 it will output 14. Suppose the output is 23 and we want to find the input? We can solve this problem if we can find an Un-Add 2 machine. How do we undo adding 2? Let’s look at some examples where we know the input.


So when we input 3 to Un-Add 2 we get 1 and when we input 4 we get 2 and when we input 11 we get 9. After we look at enough examples or perhaps we see immediately because our teacher explained subtraction that way, we realize the way you undo adding 2 is to subtract 2. So the Un-Add 2 machine is the Subtract 2 machine and feeding 23 into the subtract 2 machine gives us the answer 21. After a few more problems we realize that the way you undo adding any number is by subtracting that number. In mathematical terms addition of a number and subtraction of that number are inverse operations. In the same way we can discover that division by a number is the unmachine for multiplication by the number and thus we can solve problems like the one we started with.


To make things more interesting let’s combine multiplication and addition. Suppose the result of multiplying some number by 6 and then adding 14 is 56. What is the number?


So our problem is how to undo “Times by 6 and then adding 14”. After computing the value of times by 6 and then adding 14 for some different input we realize that a times by 6 and add 14 machine can be built by connecting a “Times 6” to an “Add 14” machine.


Now we know that “Divide by 6” undoes “Times 6” and “Subtract 14” undoes “Add 14”. Is there some way we can use these unmachines to build an unmachine for the composite?
Let’s consider a more familiar example: a two stage “dressing machine.” As illustrated in the first diagram below, the first component puts on my underwear and the second component puts on my pants and shirt. The second diagram shows the Un-dressing machine. It has two components: one that undoes putting pants and shirt and the other undoes putting on underwear. But notice that the order of the unmachines is the reverse of the order of the machines. If the last thing you did getting dressed was to put on your pants and shirt then the first thing you do in getting undressed is to take off your pants and shirt.


This is a general principle that works for all input/output machines, arithmetical or otherwise. If un-A is an unmachine for A and un-B is an un-machine for B then un-B connected to un-A is the unmachine for A connected to B. This is illustrated in the diagram below. An input “x” enters the A-B machine where it is first passed through A which generates an output “a” and then “a” is passed through B to produce an output “b.” If we then feed “b” into Un-B-Un-A, “b” is first passed through Un-B which must give us “a” back, and then “a” is passed through Un-A which must give us “x” back


Thus to undo Times 6 and then Add 14 we first subtract 14, to undo adding 14, and then divide by 6 to undo multiplying by 6. Feeding 56 to this unmachine we have


Indeed, 7 × 6 + 14 = 42 + 14 = 56.

In this article we have barely scratched the surface of what can be explained at an elementary level using concepts based on the notion of machine. In addition to using these concepts to prepare students for more advanced areas like algebra they can be used to provide a much deeper understanding of the meaning and use of numbers and operations on numbers. We will explore these ideas in a future article.

Leave a Reply