Operators, Functions, and Properties – part 39

In this series, we’ve been looking at operators in various settings, and looked for ways to use them to shine a different colored light on some aspects school math.  In the last four posts, we’ve explored the notions of equivalence  and equivalence classes and representatives of equivalence classes – and saw a number of interesting things.  One, we saw that equivalence classes can be likened to contour lines on a geologic survey map, the number on the contour line that indicates the altitude can be likened to the property that is the same for all the members of the equivalence class, and that one useful kind of operator is the operator that takes us from any point on the contour line towards the point (the representative member of the equivalence class) that carries the label (the number).  Two, that many computations involving two numbers can be split into two parts: the first part locates the two numbers as a point on the map, and the second part moves us from that point along the contour line to the representative point which carries the label.  And there is additional stuff that we’ve hinted at but not anywhere fully developed, like the idea of introducing new kinds of numbers through equivalence classes.

In this post I want to get started on playing with what’s known as modulo arithmetic, also called modular arithmetic, from our framework of operators and equivalence classes and properties.

As a starting point, let’s take another look at the number line.  In this older post, I suggest that this one thing, the number line, takes on a different character as students progress from using it for counting to – much later – locate numbers like π and √3 on it.  When we are just counting, the fact that the numbers on the number line are carefully spaced is not critical – but what is important is that the mark for 4 comes after the mark for 3 and the mark for 5 comes after the mark for 4, etc.  The number line is usually drawn as a straight line, but this may only be critical once we start to use number lines as axes on graphs.

The measuring tapes shown above, whether in inches or centimeters, are essentially number lines also, though they aren’t necessarily straight lines.  If you measure things with them, you probably want to stretch them out to be straight – but if you want to use them for many of the functions you use a number line for, it may be quite sufficient to unroll the tape enough so you can see the numbers you care about.

You could even take a slinky and turn it into a number line.

To do so, you would have to put markings along the rim.  Though the slinky would never be suitable for measuring like a measuring tape, it might serve quite well as a number line.

A sketch of one possible such number line is shown below:

The numbers 1-7 are shown; the slinky extends in both directions, as indicated by dotted lines.  Numbers are shown evenly spaced – in this particular example, precisely 4 whole numbers are placed along each circle.  For example, by the time we get to “5”, we are exactly where “1” was, just slightly above it.

In prior posts, we’d look at a particular operation, and then decide on equivalence classes based on equal values of that operation, this time we’ll turn things around, and decide on the equivalence classes first.   Can we do this and get away with it?  Sure, if we cast it in terms of: “with respect to what operation(s) will these equivalence classes in fact be equivalent?”

On the slinky number line just sketched, we are going to consider the equivalence classes based on vertical alignment, like this:

Another way of talking about this equivalence is that we consider equivalent all numbers that are 4 apart.  The representatives of these equivalence classes, just like in our earlier posts, are found at the end points of the blue arrows.  So 1, 2, 3 and 4 are the representatives.  There is nothing magical about this particular choice, you can make a very good case for using 0, 1, 2 and 3 as the representatives instead.  We could also have picked -2, -1, 0 and 1.  In a sense, it is too early to argue which make for the best representatives – we haven’t looked at relevant operations yet.

In the next post, we’ll apply this particular equivalence structure to the operations of addition and subtraction.


Posted in Uncategorized | Tagged , , , , , , , , , | 1 Comment

Operators, Functions, and Properties – part 38

In the last three posts in this series, we played with addition tables, multiplication tables, and division tables, and looked at equivalence classes and representatives of each equivalence class.

As promised, a look at subtraction, but let’s look at subtraction in an unusual way.  Let’s suppose that we know almost nothing about subtraction, don’t know subtraction algorithms, don’t know much beyond that if I pay a certain amount for something (in cash), that amount has now been subtracted from how much cash I used to have.

Let’s imagine that I’m in the supermarket check out counter line, behind somebody who is laboriously collecting all his change out of his many pockets and putting it down and counting it off till there is the needed $7.65 to pay for the purchases.  You probably have been in this scenario more times than you care to recall.  Note that it is rare in these situations for the purchaser to hand over the money to the cash register person piece meal.  Rather, it is all collected and counted up to be $7.65, and then it is handed over as a whole.  Only after the counting-up is complete is the money handed over, and only at that moment is the purchase complete, and the subtraction of $7.65 from the original amount of cash has been accomplished.

Now let’s contrast this with the workings of this kind of vending machine:

which I encountered in a hotel some months ago.  Maybe these models are common, I don’t know – it had been many years since I purchased anything from a vending machine.  For this model, you select the soft drink you want by pressing the big, flat, button with the picture of the desired soft drink.  The cost of this drink then shows up on its screen: $2.25.  As you put in a quarter in the appropriate slot, the screen amount adjusts itself: $2.00.  Each time you put in a coin, the amount on the screen goes down.  At each moment, you have two choices: put in more coins, or hit the “Cancel” button.  If you hit the Cancel button, all the money you put in comes back out, and the transaction is complete.  If you put in the coin that has the amount go all the way down to zero, your drink comes out (and if you then hit “Cancel”, nothing happens).  At the end, with your soft drink in hand, your amount of cash has gone down by the precise amount of $2.25.  (I suppose that if your balance is $.10 and you throw in a quarter, that it gives you change along with the drink, but I didn’t check this out.)

Let’s think some more about how this machine views the world.  It doesn’t know if you have enough money to complete the purchase, and it doesn’t care.  At no point does it extend you credit.  When you start the process of purchasing a drink, you may not know if you have enough money in cash either.  The machine doesn’t care if you know, either.  It offers you the “Cancel” button so you won’t get unduly upset with it, but until the balance hits zero, nothing is settled either way, and everything is still reversible.  But just because nothing has yet been settled doesn’t mean that no work is being done.  The machine is counting down for you – telling you how much you still need to put in before you will get that drink.  Though the machine is counting down, it is not doing your subtraction for you: it doesn’t know how much money you had before you started and it doesn’t know how much money you end up with.  All it knows is how much more money you need to put in before it parts with the soft drink.

Now let’s make one more assumption, and that is that we encounter this machine in a strange country, in which there is only one kind of coin, and in which all money is expressed as a whole number of those coins.    So instead of coins that say 1, 5, 10, 25 cents, they have one coin that says 1© and when you select the drink the screen shows 9©.  This tells you that you need to put in 9 of those 1© coins.  Each time you’d put in one of those coins, the number on the screen would go down by 1.  If you started with 22 coins, what would you end up with?  Let’s  follow the journey: after putting in one coin, you’d have 21 left, and the machine tells you that you have 8 more to pay.  So: whatever 22-9 is, it is the same as 21 – 8.  We can write this as: 22 – 9  =  21 – 8.

Similarly, 22-9 = 21 -8 = 20 -7 = 19 – 6 =18 – 5 = 17 – 4 = 16 – 3 = 15 – 2 = 14 – 1 = 13 – 0 (and this is the moment your drink pops out and you’re left with 13 coins.

Now let’s look at the diagrams below, starting with the table on the top left:

In this table we’ve given up any pretense that we are supplying direct answers.  The entries in the table show the particular subtraction that we’re interested in.  The entry for row 6 and column 2 gives “6 – 2”, so this is the entry for subtracting 2 from 6.

The table on the top right shows us some equivalences, based on the idea of the Pepsi machine equivalences.  If we were to start with the entry 9 – 3, we could think of this as having 9 coins in the pocket, and the machine telling us we need to put in 3 more.  This doesn’t mean we are buying something that costs 3 coins, after all, we may be looking at a moment in time during our purchase – may be we started out a while ago with 15 coins to buy a 9© drink.  What we do know is that at this point we’re down to 9 coins in the pocket and down to only needing to put 3 more coins into the machine.  When we put one more coin into the machine, we will be down to 8 coins and the machine will tell us to put 2 more coins in.  So 9 – 3 = 8 – 2.  This shows us how the equivalence classes work for subtraction: you find equivalent subtractions by moving up diagonally to the left.  A blue arrow is shown from 9-3 to 8-2 to 7-1 to 6-0.

The table on the bottom left shows us all the equivalence subtractions (for numbers from 0 to 9) and the entries that we’ve left in place are the ones we regard as the representatives of each equivalence class.  Of these representatives, the ones on the left edge are the ones where the soft drink will come out, the screen indicating that there are 0 more coins to pay.)  For these representatives, it is also clear how much money you’ve got left.  For the representatives on the top edge, what situation do they represent?  They all have the form 0 – something and so show the situation where you don’t have any more coins, but the soft drink hasn’t yet come out: the screen indicates that there is more coins to pay.  The Pepsi machine is patient, though – it will wait while you search pockets you didn’t know you had, or wait with you for other hotel goers to stroll by who are willing to give you coins.  Though you can still cancel at any point, your current situation is pretty clear: 0 – 3 means you need three more coins before your drink will come out.  The Pepsi machine doesn’t care.

The diagram on the bottom right shows the standard abbreviations for the representative situations.  The column of the form something – 0 connects with the world you knew even before you knew anything about subtraction.  In fancy language, we’d say that we identify something – 0 with something: we’ve now anchored this new notion of subtracting one number from another, through the notion of equivalences, to the kinds of numbers we already knew.  Conversely, the row of the form 0 – something creates a new world, and a new kind of number, negative numbers, in a way wholly analogous to how the other subtractions were handled.  Though strange enough, these new numbers feel less strange, and act less strange, to the ext that we can see them as a straight extension of the numbers we were already familiar with, through this particular notion of equivalence classes.  The fancy way of saying this is that “-6” is the name for the equivalence class of all the subtractions p-q where the value of q is six more than the value of p.  In a similar vein, we could say that “6” is the name for the equivalence class of all the subtractions p-q where the value of p is six more than the value of q.

The notion of introducing new kinds of numbers or new kinds of mathematical objects through picking representatives of equivalence classes is a very productive one.  In the next post we will look at an example of modulo arithmetic to play with this idea some more.

Posted in Uncategorized | Leave a comment

Operators, Functions, and Properties – part 37

In this series we’ve looked at boxes that take certain inputs and then produce an output.  We’ve called such boxes operators, and we’ve thought of them in many different ways.  In some cases, the boxes perform arithmetic; in other cases, there doesn’t seem to be any arithmetic involved.  In some cases, it looks like the boxes must contain fancy electronics; in other cases, we’ve seen that the box might just contain a rodent who’s good at reading graphs.  Unless you need to build one of these boxes yourself, it might not matter in the slightest what’s in the box, as long as you have a good idea as to what the box does.  Maybe the box comes with instructions that tell you to replace the battery in the battery panel annually, or how to replace the food pellets for the rodent.

In the last two posts, we saw equivalence classes as well as contour lines that connected elements that were equivalent to each other.  The contour lines could be followed till you arrived at a specially marked entry that serves as the representative of that equivalence class.  The process of finding the marked representative of an equivalence class is itself something we can think of as an operator, as something done in a black box.  How the box does this may not be of our concern; the box might follow contour lines as in our examples, or it may have other ways – better ways perhaps – of finding the representative element in the equivalence class.
Typically, operators that find the representative member of an equivalence class are not invertible.  That is, many different elements can lead to the same representative member, and from the representative member alone, you can’t recover which of the elements led to it.
A complication with finding the representative member of an equivalence class is that there is some uncertainty about which element is the representative member.  Strictly speaking, there is nothing about the equivalence that shouts out which member is the representative member, it relies on an outside perspective.  With respect to one property, all elements in the equivalence class are the same – that’s how they get to be members in the equivalence class in the first place.  Yet with respect to some other property, one element of the equivalence class stands out and is marked and thus becomes the representative.  It’s time for an example to make this explicit.

The example we’ll play with in this post deals with fractions.  Just like the previous posts dealt with addition and multiplication, this time we will deal with division, but in a particular sense.  We’re not interested in divisions carried out using decimals, we will write the result like a fraction.  The following table shows this:

The table on top shows each of the fractions you can get when the numerator is between one and ten, and when the denominator is also between one and ten.  For fractions, there is an already existing notion of equivalence: equivalent fractions.  (If you are not familiar with that, just think of fractions as equivalent when both give the same decimal number when treated as a division on your calculator.  For example, 2/3works out to .6666… on your calculator when you divide 2 by 3, and so does 4/6 when you divide 4 by 6 on your calculator – thus they are regarded as equivalent fractions.)

In the table on the bottom, some of these equivalencies are shown.  All fractions equivalent to 1/2 are replaced by a contour line that connects them to 1/2.  The fractions 2/4, 3/6, 4/8 and 5/10 are so connected.  Turns out, these equivalent fractions form a straight line, and this line, when extended, goes through a point in the top left corner.  There are more equivalent fractions in the table than are shown, but I left them out to keep the main ideas visible.  The last (closest) fraction on the blue line towards the top left is marked in a special color, and is chosen to be the representative of the equivalence class of equivalent fractions.  These correspond to what are called reduced fractions or simplified fractions in school.  In school, reducing fractions often seems like a chore, and its purpose hidden in the mumbling and mist of “they are simpler”.  Later in school, you are asked to find a different kind of representative of the equivalence class: a fraction, equivalent to the one you start with, that has a denominator of exactly 100.  These are called percentages.  In the world of percentages, divisions where the denominator is 100 are more equal than others.

In the next post, we’ll look at equivalent subtractions.

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Operators, Functions, and Properties – part 36

In the previous post in this series, we broached the subject of equivalence classes.  We did so in the context of looking at an addition table and noticing how each value in the table occurred multiple times.  We drew a blue line to connect all the entries that had the same value in it, and this blue line now marks a particular equivalence class.  What all the entries in that equivalence class has in common is the value of the sum.  Same sum, same equivalence class; different sum, different equivalence class.  The value of the sum is the property that links the entries in the equivalence class together.

In this post, I’m going to develop a similar theme with multiplication and multiplication tables.  In the diagram on the left, I’ve drawn a simplified multiplication table, only going up to 5.  In the middle, I’ve repeated all that information but this time drew some contour lines connecting entries with the same value for the multiplication result (the product).  Compared to the addition case in the prior post, the contour lines are no longer straight.  Only some of the contour lines are shown, but you can get a good idea about the others, especially since 1.5, 2.5, 3.5 and 4.5 are marked also.  Finding the product associated with any point in that middle diagram is directly analogous with how you find the altitude on a topographical map such as the one shown on the right.

In such a topographical map, the contour lines represent locations of equal altitude.  You can see contour lines marked for elevations of 400 ft and 350 ft (this is  a US Geologic Survey map) with 4 contour lines separating them.  From this you can conclude that adjacent contour lines are 10 ft in latitude apart.  The altitude of any point on this map can be estimated fairly accurately by looking at contour lines below and above.

It’s the same with the product.  In the middle diagram, the contour lines are drawn 2.5 apart, from 0 to 25, though the contour line for 0 is not strictly on the diagram itself, but rather just beyond the top left corner.  You could draw contour lines 1 apart instead, and this certainly would remove the need for estimating if what is being multiplied is two whole numbers (from 1 to 5).  Of course, the need for estimating would rear its head in the same way, when you wanted to use the map for multiplying numbers that weren’t whole numbers.  And you could.  The  middle diagram is a simple (and somewhat crude) example of a class of computational devices called nomographs, of which the Wikipedia entry provides some interesting examples.  Now largely replaced by electronic devices, for centuries nomographs represented the most sophisticated computing devices available.  (A particularly versatile and useful one, for centuries,  is the slide rule.  I still have the slide rule I bought for college, in those days obligatory for math/science/engineering students.  The real geeks of the day had them hanging from their belt.)

Posted in Uncategorized | Tagged , , , , | 8 Comments

Operators, Functions, and Properties – part 35

In the previous post of this series, we looked more closely at the mathematical notion of equivalence, through the lens of operators.   Specifically, we looked at a split (pair) 2|13 and then looked at an operator that turns 2|13 into 3|12, turns 3|12 into 4|11, turns 4|11 into 5|10, etc., all leaving the total the same (15).  We said that the splits 2|13, 3|12, 4|11, 5|10 are all equivalent with respect to the + operator.

Let’s take another look at equivalence with respect to the + operator, by examining an addition table.  An addition table is similar to the more familiar multiplication table – works the same way, serves the same function – even though most of us never encountered one in grade school.  In fact, of the four operations +, -, ×, ÷, only multiplication seems to have been awarded its special table.  Have you ever wondered why that is?

The figure on the left shows an addition table,  though you may have expected us to start at 1 and end at 10.  Instead, we started at 0 and ended at 13, and we could make the table as large as we wanted.  To add 8 + 9, using the table, we would look at the row labeled “8” and the column labeled “9”, and then follow that row and that column till you find the place where they meet.  The number you find there is 17 – the sum of 8 and 9.

There are a lot of numbers in this addition table, but then many of them are the same.  The pattern of the numbers is not hard to pick up.  The figure on the right shows this by drawing blue lines that follow sums that are the same.  In the table on the right, to add 8 + 9, we would again look for the position in the table that’s in row 8 and column 9.  We would then follow the blue arrow to the number at its end, and read off the result: 17.

Each blue line, together with the numbers at either end, marks a set of equivalent splits (equivalent with respect to the + operator).  Same blue line, same sum.  Different blue line, different sum.  Each blue line marks an equivalence class, that is, a collection of items that are all equivalent to each other.  One of the items in the equivalence class may be designated as the representative of that class, the one that is more equal than the others.  In our example, the representative item of the equivalence class for the sum of 17 might be the split at the head of the arrow, 4|13.  If we had drawn a bigger addition table, we might have picked 0|17 as the representative of that same equivalence class.  From one perspective, it doesn’t matter one iota which element of the equivalence class is picked to be the representative.  Among those elements that are equivalent, we are free to pick one as being “more equal than the others”.  In our diagram (the one on the right), each blue line marks an equivalence class, and the arrow on the blue line suggests how to find the representative of the equivalence class.

What we did with the addition table could also be done using multiplication tables.   This is an idea we will pursue in the next post in this series.

Posted in Uncategorized | Tagged , , , | 2 Comments

Operators, Functions, and Properties – part 34

In the previous post in this series, we looked at some operators that take in two numbers and produce some kind of pair of numbers, an ordered pair, in a way that can be reversed.

Here’s another way to produce a pair, referring back to the work we did in this post:

Two sets of blocks, 2 red blocks and 13 green blocks, lined up as shown.  Suppose I want to find out how many blocks there are altogether.  In other words, I want to add up 2 blocks and 13 blocks, or 2 and 13.  I can picture this as an operator that takes the split as its input, and which produces as its output the sum, here 15.

Now let’s look at the effect of the operator “move the separator” – which we introduced here – on addition.

In terms of the blocks shown above, the split 2|13 can be thought of as two red blocks right next to 13 green blocks.  The “move the separator” operator can be thought of as the effect of painting the leftmost green block red – or imagine that each block is green on top and red on the bottom, and that the “move the separator” operator corresponds to a block being flipped upside down.

Note that the “move the separator” operator produces splits that are all different, and yet each produces the same sum (15).  No matter how important the differences among these splits are, from at least one perspective they all amount to the same thing: the + operator produces the same thing for each of them.  A useful name for this phenomenon is to say that all these splits are equivalent with respect to the + operator.  We can also say that the “move the separator” operator leaves the sum invariant.  Finally, we can say that the “move the separator” serves as an enumerator that produces splits that are equivalent – though we will not deal, at this time, with the question of whether this particular enumerator will find all equivalent splits.  Let’s emphasize again that when we call 2|13 and 3|12 equivalent, we only make this claim with respect to the + operator.  With respect to some other concern (e.g. how far the separator is from the far left, or how far the separator is from the far right, or how close the separator is to the middle), these splits will be very different indeed.

If all these splits are equivalent with respect to the sum, and I’m asked to calculate what that sum is (in other words, if I don’t happen to have a little machine lying around that acts like the + operator shown above), I am free to pick whichever of these equivalent splits I like best.  In George Orwell’s famous phrase, some are more equal than others!

Almost all computation is based on taking the original computation problem, and then selecting an equivalent problem that is more amenable to the computational tools available – and do so repeatedly until the computation is complete.

In the next post, we’ll be looking at equivalence classes and continue these ideas.

Posted in Uncategorized | Tagged , , , , , , | 1 Comment

Operators, Functions, and Properties – part 33

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.

Posted in Uncategorized | Tagged , , , , , , | 1 Comment

Operators, Functions, and Properties – part 32

In this series, we’ve been looking at a model for presenting and analyzing operators with an intention for it to have applications for students learning math in school.  In recent posts, we’ve looked for  interesting aspects of school math that aren’t usually thought of as involving operators.

In this post, I’d like to take another look at counting.  Counting was discussed earlier in this post.  We saw that counting means different things at different degrees of sophistication, starting with producing a sequence of counting numbers “one, two, three”  like a song similar to “a, b, c, d, e, f, g” to the melody of “Twinkle, twinkle, little star”.  For the purposes of this post, I’m interested in counting as the process by which we obtain the number of blocks in a pile of (identical) blocks.  Even more specifically, I’m going to be looking at counting a set of objects that are fixed in place and arranged linearly, as shown below:

Several stages of the counting process are shown, one below the other.  Each row shows the group of green blocks to be counted.  How far the green blocks extend towards the right we don’t know, because our view of them is blocked, for the moment, in our current position.  To visualize the process of counting, we imagine the progress being marked by a separator (the dotted vertical line) that we gradually move from left to right.  As the separator moves from the left of a block to the right of that block, the count (shown on the left of each row) is increased by one.

A key idea associated with counting is this separation of the whole pile into two groups: the group of stuff that has already been counted, and the group of stuff that is yet to be counted.  A key operation associated with counting is the moving of the separator, which has the effect of moving one of the blocks from the group of yet to be counted into the group of stuff that that has been counted.  This move, repeated until the pile of uncounted stuff is empty, is associated with the increase of the number.  Normally, it is the speaking of the increasing numbers that we call counting – yet unless the speaking of the increasing numbers occurs in lockstep with the action of moving the separator over, we would arrive at a meaningless number.

The same “moving over the separator” operation shows up in a related scenario, but one where the total count is already known.  Imagine a group of 15 students giving one-minute presentations one at a time.  At any moment during this affair, there is a group of students who haven’t yet given their presentations, a group of students who has, and at most one student who is in the middle of giving the presentation.  If we took snapshots right after a student completed a presentation, the series of snapshots might resemble the picture above quite closely.  Here is a representation of it:

Here, the students who have completed their presentation are on the left, those who haven’t yet are on the right, and the separator marks the split between the two groups.  As the student on the right of the split finishes the presentation the separator moves over one place.   Unlike the counting example, here we already know the total, we know how many students are going to be giving the presentation.  Here we can keep track of two numbers, the number of students on the left who have done their presentation, and the number of students on the right who haven’t.  As each presentation finishes, the separator moves to the right, the number on the left increases and the number on the right decreases, all in lockstep.

I think it is interesting to show an operator that matches this movement of the separator.  Above on the left, I’ve indicated how such an operator might be drawn – you see it has two inputs and two outputs.  If you don’t like multiple outputs, you may prefer the version on the right, which has a single object as its output, an object we might call a “split”.  If 2|13 is a split of 15, then “moving the separator” produces a different split of 15, namely 3|12.

You may have wondered why we wouldn’t just do the following:

and the short answer to that would be: yes, we could.  But the longer answer is more interesting, I think.  One of the most interesting things about moving the separator is that it really is just a single action: in one single movement, one of the sides gets bigger and the other side gets smaller by the same amount.   There are many, many real-life situations where this issue is critical.  I already discussed some of this in a post about transactions: no industrial-strength database could function without it.   When you get money from an ATM, you would not accept your account being dinged for the $100 you withdraw without actually getting the cash in your hands, and the bank would hate to give you the $100 in cash without also decreasing the balance in your account.  For you, as well as for the bank, the two sides of the exchange must happen as one, even if a power failure hits the bank at the worst possible moment.

And yet, in many ways the combination of the “add 1” and the “subtract 1” operators does in fact produce the same result as the “move the split by one” operator – they are almost equivalent.  Basically, we should take seriously the box drawn in dotted lines above, and give it a serious job.  The job we want it do is to guarantee that what’s happening inside of it happens as a single whole, indivisibly.  How it does this, we don’t care, but we don’t ever want to see the addition done without the corresponding subtraction being finished also, nor do we want to see the subtraction done without the corresponding addition being finished also.  It is possible to think of this issue in terms of synchronization; and it is worth noting that so far in this series we’ve been ignoring pretty much all issues of time, speed, delay and synchronization in connecting inputs to outputs.


Posted in Uncategorized | Tagged , , , , , , | 1 Comment

Operators, Functions, and Properties – part 31

In the prior post in this series, we looked at the kind of operators typically encountered in school (K-12), whether or not they are called operators.  Many of them are single number input – single number output, but not all.  In this post, I’d like to highlight some operators  that almost nobody thinks of as operators, though one could, and it would be interesting to do so.

I’ll start with the well-known multiplication table:

We usually think of this as the combined result of a large number of multiplication operations.  But we could think of it as a single operation, like this:

What the diagram shows is an operator (let’s call it “table multiplication”) that takes a column object and a row object, and then it produces the multiplication table we showed above.  The job of this operator is to pair numbers from the column with numbers from the row and find all the pair-wise products.  Let’s try out this operator on different column and row objects and see if this can give us anything interesting.

– or –


Other examples of familiar situations expressed through unfamiliar operators in subsequent posts.

Posted in Uncategorized | Tagged , , , , , | 1 Comment

Operators, Functions, and Properties – part 30

In many of the posts in this series we’ve shown operators that work on a single number coming in and that produce a single number coming out.  This is a hugely important subcategory of operators, but single-in single-out operators aren’t by any means the only type.  So let’s take a look at the operators typically encountered in K-12 mathematics in the United States.

The arithmetic operations from elementary school: add, subtract, multiply, divide – these are usually conceived as two-input, one-output operations.  There are some more you learn in secondary school: exponentiation, and perhaps the min and max operators we looked at in the previous post.  Interestingly, most of the new operations you learn in secondary school are single-input types: absolute value, square, square root; and later on sin, cos, tan and other trigonometric functions, and log.  Occasionally, secondary school students run into situations where there are more than two inputs (e.g. to find a slope of a line going through two given points) but these rarely rise to the level of standardized notation.

Even things like the quadratic formula, which looks for the value of x for which ax^2 +bx + c = 0 , and where the numbers a, b , and c could be regarded as the inputs, is rarely seen or treated as an operator.  Instead, it is treated as a series of one-offs: here’s an equation, solve it.  Here’s another equation, solve it too.

There is a vocabulary to distinguish these kinds of operators and functions, though the vocabulary is more firmly established in computer science than it is in mathematics.  The one-in, one-out kind are called unary operators and unary functions; the two-in, one-out kind are called binary operators and binary functions.  Functions with three values coming in and one coming out would be called ternary functions, and so on.  Sometimes you see the notation “n-ary function” for a function that has n values coming in (for some unspecified n) and one value coming out.

Some mathematicians might scoff at all this, and bring up that in some sense, all operators and all functions are of the one-in, one-out type.  What comes in, no matter what it is, is called the domain, and what comes out, whatever it is, is called the range.  Neither domain and range have to be numbers.  They can be whatever they need to be.

For example, subtraction can be seen as a single-in, single-out function where the domain (what comes in) consists of pairs of numbers.  The range (what comes out) consists of single numbers.  The image below compares the way we normally think of subtraction, on the left, and subtraction as an operator on a pair of numbers, on the right.

Though the view on the right may seem artificial, it seems less so if you see what we have to do to the diagram on the left to keep straight what input is what.

As another example, sort-by-due-date can be seen as a single-in, single-out operator where the domain consists of a bag of bills and the range consists of a linear arrangement  of these same bills – a special arrangement where the bills that need to be paid soon are up front and the bills that need to be paid later are in the back.

In prior posts in this series, we’ve looked at state machines, where the operators operate on the state of the machine.   We’ve played with stopwatches and calculators as examples of such machines.  Sometimes the state of these machines consisted of a single number, but more commonly, the state consists of multiple numbers and other things.  For example, the state of the tab in your browser window includes a history of sites, so that the “back” operator has a way to get you back to the site you were before you clicked on a link.

In the next post, we’ll play with some operators that have interesting domains and interesting ranges.

Posted in Uncategorized | Tagged , , , | Leave a comment