Saturday, October 26, 2019

Next week, no algebra, I promise


By Bobby Neal Winters

I have made a mistake.  Worse than that, I have made a mistake in print.  Please let me explain.

Last week my column was about how 57 is not a prime number and how I know.  I talked about tests for divisibility by 2, 3, 5, and--most to my current point--7.  The first three tests are widely known and, in my day at least, were taught in primary school.  You might not remember them, but they were.
The test for divisibility by 7 was new even to me, and I hadn’t worked with it much.  Indeed, working on that column was the first time I’d ever applied it, so, of course, I applied it wrong.

Rather than show you what I did wrong again, let me explain it correctly this time.  Let us take a number, say 149, and determine whether it is divisible by 7 by this test.  I chose 149 because I know that it is not. There is an easy way that doesn’t use this test, but I don’t want to muddy the water.

Take the number and remove the last digit, 9.  This leaves 14.  Now take 14 minus 2 times 9 (which is 18).  This 14 minus 18 is -4, which is not divisible by 7, so 149 is not divisible by 7. 
Let’s make it a little harder.  Consider 358.  Note that 35 minus 16 is 19 and that 19--being prime--is not divisible by 7.

How would this have worked with the number 57 that we used last week?  Well 5-14 is -9 which is not divisible by 7, so 57 is not divisible by 7 either.

Now I seriously doubt that anyone caught my error because in the era of calculators and computers, very few people worry about arithmetic anymore.  No one would’ve looked at it much because newspapers disappear having an afterlife of lining dresser drawers or wrapping fish. 

An obscure local columnist such as myself can reasonably hope his mistakes might disappear with the Wednesday trash pick-up.  Even with columns on the internet, what we write might live forever, but it does so like the Ark of the Covenant in a giant warehouse.

I seek to correct my mistake for a couple of reasons.  The first of which is my education as a mathematician.  We are so boring, if we aren’t right, then what are we good for?  The second is I would like to model what I consider proper behavior is when a person makes a mistake. 

If you make a mistake, you should ferret it out yourself, before anyone else has a chance to do it, and own it.  Don’t double down on it: Own it.  Everyone makes mistakes.

If you don’t catch it first, do the same thing: Own it.

When I found the test for divisibility by 7, I was in a hurry and I didn’t read it carefully enough, so I misinterpreted it.  I compounded this mistake by not proving the result myself.  What did Ronald Reagan say? Trust but verify! 

I trusted the Internet, but I didn’t verify.

For those of you who have hung in this long, let me now prove the result.  It is a simple proof, but it will take some algebra, so it you aren’t in the mood for algebra, I will see you next week.

When I say remove the last digit of a number, I am saying take a number of the form 10x + y where x is any positive integer and y is an integer between 0 and 9.  When you remove the last digit.  This leaves you with x.  Then the number you get by subtracting 2 times the last digit is x - 2y. 

We say that 10x + y is divisible by 7 exactly when x - 2 y is.  How do we know this is true.  Well (10x + y) minus 10 times (x - 2y ) is 21y.  Now 21y is definitely divisible by 7.  It follows from this that (10x+y) is divisible by 7 exactly when (x - 2y) is.  This is because 10 is not divisible by 7.

See, simple.

Next week, no algebra.  I promise.

Bobby Winters, a native of Harden City, Oklahoma, blogs at redneckmath.blogspot.com and okieinexile.blogspot.com. He invites you to “like” the National Association of Lawn Mowers on Facebook. )


Sunday, August 4, 2019

8÷2(2+2)

8÷2(2+2)

By Bobby Neal Winters

It is a rare day when a bit of mathematics is in the news, and it is an even rarer one when it is a bit that experts and laypersons can talk about with equal confidence, equal accuracy, and be equally wrong.

Today is one of those days.

This is because the 8÷2(2+2) meme has been going around the Internet.  It is a corker to be sure. Is it 16? Is it 1? Is it a communist conspiracy?

Well, as with all such things we should treat it as a teachable moment and in several directions.  The first thing if ought to say is that if you type it into a computer program interpretive interface, like the IPython console, for instance, it will give you 16 every time.

This is not a definitive answer, however, because dealing with computer input and output is HARD and allowances have been made.  It has been a special case since computers came into existence and there have been multiple methods of dealing with it.  One of these was quite good and it was called Reverse Polish Notation (RPN), and if you ever owned an old-fashioned HP programmable calculator in the eighties, then you’ve used it.  As you may have guessed, there is something called Polish Notation (PN) as well that has been used in dealing with computer input. It would take us too far afield to discuss either of these, but there are nice articles on Wikipedia that discuss both.

Whenever I get to teach Elementary Statistics, I use an Excel spreadsheet for some applications and I’ve learned that dealing with multi step calculations can be confusing, so I teach coping mechanisms as I go along.  We approach them with care because everything has to be typed in in a linear fashion and we can’t use all of the methods that mathematicians standing in front of a blackboard or writing in longhand on a piece of paper have at their disposal.

This brings me to something that has bothered me since the first time I saw this meme: The used of the symbol ÷ for division.  I haven’t used it in years.  You cannot find it on a computer keyboard.  To type this into a computer, you write 8/2(2+2).  When I see this, the ambiguity pops right out at me.  I would teach students to write either (8/2)(2+2) or 8/(2(2+2)) so that the problem goes away.  That ÷ symbol was put in there on purpose to make a point.

My dad was a truck driver and truck drivers have a saying about the right of way in driving: He was right, but he dead right.  As a mathematician, I need to keep that sentiment alive. If you follow the order of operations (parenthesis, exponentiation, multiplication division, addition, subtraction) you will get 1.  However, you can’t count on computers do that; you can’t count on people walking around on the street to do that; therefore, you need to order your mathematical communications in such a way as to be as unambiguous as possible.

So I’ve answered the first two questions, 16 if you are a computer and 1 if you are a mathematician, what about the third, is it a communist conspiracy?

Maybe not communist, but the use of the ÷ symbol makes me believe there is something going on here that requires a bit of technical sophistication.  I had to look up how to get my computer to do that symbol.  Maybe it is easier for others, I will be open to learning that, but I had to use [control][shift]uf7 to get Google Docs to do it. Its use in this meme not only hides the ambiguity of this expression from professional mathematicians, it makes the question accessible to people who’ve had no exposure to mathematics beyond eighth grade arithmetic.  Is this good? Is this bad? I don’t know, but it is interesting.

Perhaps I am sensitive to this because there is a fairly steady stream of anti-mathematics education memes that go around in social media.  They hate the new methods of teaching subtraction; they hate the common core; they think we should stop teaching algebra all together and teach how to balance checkbooks instead (that is not an either or, by the way, we do both, but the second we don’t do in math class).

So the final lesson that should be taken away from this is that we who teach math can’t ignore this.  We must engage it in some way.

So the answer to 8÷2(2+2) is that we need to talk.

Bobby Winters, a native of Harden City, Oklahoma, blogs at redneckmath.blogspot.com and okieinexile.blogspot.com. He invites you to “like” the National Association of Lawn Mowers on Facebook. )

Monday, May 20, 2019

Coding and Essays

Coding and Essays

“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”
― Robert A. Heinlein

By Bobby Neal Winters

I like to program computers.
I began back in the late seventies when I was in my mid-teens on a TRS-80 microcomputer that my high school had bought.  The math teacher (there was only one) didn’t know how to program it or have the time to learn, so he flopped the manual down on my desk and said to figure it out.

So I did.

From that day until this, I’ve had exactly one class in programming...and it shows.

From day one, I’ve approached computer programming as a problem solver, a redneck problem solver.  You’ve no doubt seen those pictures on Facebook of someone who has put a ladder in the basket of a cherry-picker to get to some hard-to-reach place to paint. Most of the code that I’ve written over the course of my life has looked like that.  My programs have been like Rube Goldberg devices: they do what they are supposed to, but not necessarily in the most straightforward way.

There is a solution to this, and it is amazingly similar to the way to improve writing.  It is...wait for it...rewriting.  Learning to rewrite was a revelation to me.  The fact that my words were not necessarily fit to be carved on stone was a hard lesson to learn, but when I did learn, I was a massive step forward.  (There are no doubt those of you reading this now who would tell me that I need to do even more of it, and I would agree.)

We are reluctant to rewrite our prose for many reasons that may include but need not be limited to: writing is hard for us in the first place; we really don’t like to write; and our belief that what we’ve written is just so marvelous the way it came out of our heads that it couldn’t possibly be improved.
These particular reasons can be taken care of by practice.  The more we write, the easier it becomes.  When something becomes easier, it becomes more enjoyable.  And when we return to a piece, look at it, and not understand it even ourselves, the penny drops and we realize that not everything we write down is golden.

Rewriting computer code is quite similar. Sometimes the programming problem is so treacherous that we feel lucky there is any solution at all.  The thought of reworking the problem seems ridiculous. Why waste your time rewriting unreadable code, when you could use it do go out and write more unreadable code, hmmm?

One gets insights in coming back to code that you have written a year before, needing it to solve another problem, but not being able to use it because you cannot make heads or tails of it.  When this happens a time or two, you start trying to be clearer.  Once you’ve gotten your code to work, you go back over it and make sure that it will be readable to your future self.

If you start taking this stuff seriously, it has an effect on you.  You see how well it works.  The approach spreads into other areas of your life.  From writing, to computer programming, to you name it.  You learn that you can stick with a job until it is done right.

This habit is the product of an education. Don’t misunderstand me by thinking this can only happen in school. No, far from it. If you’ve learned this in your home from your hard-working parents, then you are way ahead when enter the world. 

I’ve seen a quote on my Facebook feed from my South American friends: La escuela es la segunda casa, pero la casa es la primera escuela.  This translates as: The school is the second home, but the home is the first school.  The habit of hard work and the desire to do something well set us on a pathway to success in our endeavors.

So whether you are coding a computer program, writing an essay, setting a bone,  fixing a car, or whatever other task you are doing, the idea of sticking with it until it’s done right will pay off.

Bobby Winters, a native of Harden City, Oklahoma, blogs at redneckmath.blogspot.com and okieinexile.blogspot.com. He invites you to “like” the National Association of Lawn Mowers on Facebook. )