In this series we have looked at various examples of operators, and most of our attention has been on operators where what comes out is a number, and what comes in is one or two numbers. Some examples of two-numbers in one-out are here, and examples of one-number-in one-out are here. In an earlier post in this series, I showed how the pre-occupation with the number of inputs/outputs can be a tad misleading, since inputs and outputs don’t have to be numbers at all. Whatever comes out, that’s the output – number or not.
Below, I show three examples of operators with two numbers as input, and with a single output, and yet no information is lost between input and output.
All these examples take two individual numbers as input, and produce a single output, which is the pair of numbers that were present on the input. This is more than merely a semantic trick – in school math you see it used most often for coordinate pairs, and you can see it in fractions even if most people don’t think of fractions as a special kind of pair. In the third example, we turn the individual inputs into a vector, using the notation we’ve played with at length in our series on vectors, e.g. in this post about shopping list and price lists. In school math, the notation typically used for vectors is closer to that shown in the left example.
Mathematicians tend to use the phrase “ordered pair” for all three of these examples. A standard notation for an ordered pair is the one shown on the left: the numbers, separated by a comma, enclosed in parentheses. This notation is a fairly useful one, though perhaps a bit overused.
These various pairing operators are all invertible – that is, you could reconstruct the inputs from knowing the output. It is interesting that most of the operations we’re familiar with from elementary school mathematics (addition, subtraction, etc) are not invertible in this sense. Knowing the sum does not allow you to uniquely reconstruct what the numbers were that led to that sum.