Is Coding Math? Yes & No.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Recently a friend asked me if programming should be counted as mathematics in school. That is a really good question, and I’m going to tell you why I think it should (and when I think it shouldn’t).

A long time ago, in a high-school far far away, I learned how to program. My teachers would tell horror stories of the old days when they had to program room sized computers using stacks of punch cards, and now it is my turn to regale you with tales of coding uphill both ways in a blinding snowstorm. The computer lab in my high-school had 386s, and the language we used was Turbo Pascal. My buddies showed me a little C++ on the side, because, by the second year of programming, we had learned the basics and more — class had become open lab time. (Programming is a lot like chess, in that once you learn the moves, practice is what makes you better.)

Senior year, my project was an RPG in the style of Final Fantasy and many others. Our family didn’t own a computer (few did then), so at the end of each class I would print off stacks of pages of my code on the dot matrix printer. At home and in my other classes I would hand-write out new code or streamline the existing code so that in class all I would have to do is type, debug, and play test. I never quite finished the game, but I was able to create a program that would turn a simple ASCII map into a world you could walk around in by the end of the year.

I was so enamored with programming that after high-school, I briefly pursued computer science as a major. That was a long, long time ago. Why am I telling you all this? Well, eventually, I went on to study mathematics. Once I was in the upper level stuff, I was stunned at how much my programming knowledge helped out when it was time to do a proof. Proof by Contradiction is an awful lot like tracking down bugs in code (something which I was quite familiar with). Induction and Loops are intertwined in my mind. One of the trickiest things for new math students to learn is conditional statements — If, Thens.

So, even though, by the time I was a student of mathematics, my syntax was hopelessly out of date (and it is even worse now) by learning the logic of problem solving, it made me better at mathematics.

It has been more than 20 years since I wrote my first program in Turbo Pascal, I have a PhD in mathematics, and I’ve been teaching math in various colleges for 13 years. This Summer, I have decided to learn a modern programming language — Python — by working through the Project Euler problems.

Why now, after all these years? Because I realized my kids need the benefit of programming, and I plan to teach them. I believe there is no better modern and practical introduction to logic and problem solving. If this is so, then why doesn’t it count as math, since the purpose of math in the curriculum is mainly to teach logic and problem solving? Some of it is entrenchment. But, some of it is how programming tends to be taught in the lower grades.

I’ve recently come across a fun series from Usborne: Coding for Begineers. I say fun, because it is a very simple tutorial. You read the instructions, type the code they give you, and if you don’t make any syntax errors, you get a little game. Don’t get me wrong, I think this is a fantastic way to introduce some of the things that coding can do, but there is absolutely no logic and problem solving. (There is still come other benefit like attention to detail and looking for syntax issues.) For parents and teachers that don’t understand programming, methods like this are the default method of teaching about programming. Methods like this are no more math than asking students to copy a list of worked out problems.

No bug-free code

How does programming become “math”, then? Not by having them use programing as a calculator. By giving students interesting problems to solve (or even better yet letting them come up with their own problems to solve). Admittedly, this is difficult if you are unsure of what coding can accomplish. Project Euler is great for people with an already strong math background (like an advanced high-school student), but some of the problems can be daunting.  Don’t be afraid to skip around some or even google for help (although beware that many people have put full solutions on-line).

For the younger students, I recommend a choose your own adventure style text adventure. Have them sit down and write or draw out the choices and branches (work together if you can). Then, let them program it a bit at a time. Programs like this make great use of conditional statements and loops can be incorporated as well. When they are done, parents and siblings make great play testers.

Stay tuned for more problems to solve using programming. If you have an idea, share it in the comments.

(By the way, I’m not getting paid by anyone to tell you any of this. Links are only provided to save you time googling.)

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Infinity is not a Real number (or an Imaginary one, either)

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

One of the mistakes students often make is assuming (justifiably) that infinity is a number. It’s a natural assumption. Numbers are the things we talk about in math, after all, and we treat infinity as a number in some ways. We say things like, “You have an infinite number of toothbrushes.” (It’s clearly none of my business what you are doing with that many toothbrushes.)

What does infinity mean? Let’s go back to the playground for a minute. Double dares turn into triple dares, which eventually turns into cries of, “I infinity dare you!” It is the numerical trump card. Something larger than any other number. In Division by Zero I made the assertion that infinity is either a number or it’s not. That’s how properties work. If it is both a number and not a number that would be a contradiction, which we cannot accept.

So, let’s assume that infinity is a real number. If we couple this with our schoolyard knowledge, then we must say it is the largest real number. (If it weren’t the largest number, then we would just take some larger number to be infinity instead — just like our childish predecessors.)

Since we are assuming infinity is a real number, then ordinary operations like addition are defined for it. This means that infinity + 1 is also a real number. Adding one to a number makes it larger. So infinity + 1 larger than infinity. This is a contradiction. So, we must conclude that our assumption was wrong. Infinity is not a real number.

So, if it isn’t a number, what is infinity? It is a concept — the notion of going on forever. I cringe with Woody every time I hear Buzz’s catchphrase.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Division by Zero

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

http://vignette1.wikia.nocookie.net/powerlisting/images/9/93/Divded_by_zero_6848.jpg/revision/latest?cb=20130416015539Have you ever been told that division by zero is undefined? What do we mean by undefined, anyway? It sounds like mathematicians just never bothered getting around to defining it. Imagine Newton and Leibniz (the fathers of Calculus) sitting down at a café in Paris, sipping on coffee. Newton says, “Should we define this whole division by zero thing?” Leibniz pauses a moment, swirling the last drops in his mug, “No, let’s order another round instead.”

That’s not actually what we mean by undefined. Perhaps a better term would be undefinable, although that isn’t quite right either. We could define what 5 divided by 0 is. It’s just that our definition would generate contradictions. In math a definition that causes contradictions is said to not be well defined. We could actually make any number of (infinitely many) poor definitions, but no perfect one that works every time. So, we leave it undefined.

Consider 5 divided by 0. Suppose we said it was a number. Any number will work equally well here. Actually any number will work equally unwell, I suppose. Let’s say that 5 divided by 0 is 100. This is silly, but it turns out to be no sillier than anything else.

For any definition we make, we want everything else defined to still work. The usual way to define division is in terms of multiplication. We say 8 divided by 4 is 2 because 2 times 4 is 8, and so on.

Let’s try that with our definition for 5 divided by 0. Since 5 divided by 0 is 100, then 100 times 0 is 5. But, 100 times 0 is supposed to be 0. (That is called, unimaginatively enough, the multiplication property of 0.) This means either our definition is wrong or 0 equals 5. Wait, what? Well we just said 0*100 = 0 and 0*100 = 5. Since both left hand sides are the same, that would imply that the right hand sides are also the same. We know that 0=5 is absurd (properly we call it a contradiction), so we conclude that our definition is wrong.

Perhaps 100 was just a bad choice. Let’s say it is some other number. To save time I’m going to use the number x — a variable. We’ll say 5 divided by 0 is some number x, and that we’ll figure out which one it is later. By the definition of division, that means that 0 times x is 5. So, x is the number that gives you 5 when you multiply it by 0. But any number times 0 is 0, and we’ve already ruled out the possibility that 5 and 0 are the same, so that means any number we choose for x gives us a contradiction. 5 divided by 0 is not a number.

Hey, that’s not too bad. Maybe 5 divided by 0 is a non-number like the word Aardvark. That would cause even more problems. We have only defined our operations like add, subtract, multiply, and divide for numbers. So, 0 times Aardvark is undefined. Oh no! Not that again! Yep. We’ve just pushed the problem on to the next statement. That doesn’t work either.

But, maybe you’ve heard on the street that 5 divided by 0 is infinity. That is unfortunately misinformation spread about by people learning Calculus that haven’t quite grasped it yet. I could go into more detail, but instead I’ll appeal to the Rule of Two. Either infinity is a number or it is not a number. In either case it doesn’t work by our previous discussion. (In fact, infinity is not a number, but that is a discussion for another time.)

I’ve avoided the case 0 divided by 0, because this is long enough already. If you are clever, you’ll see that you could define 0 divided by 0 in such a way to not violate what we said about 5. I promise to show you why we still don’t define 0 divided by 0 in a future post (probably after we’ve discussed whether infinity is a number or not).

Hopefully I’ve convinced you that division by zero is not defined because it cannot be defined well. If I haven’t reached you with this, you should know that in the mid 1990s a secret organization of retired math teachers was formed to combat the problem of people dividing by zero. Equipped with black helicopters, night-vision goggles, and stun guns (all grant funded, I assure you) they take turns listening in to classrooms all over the nation.

When their surveillance detects someone dividing by zero, they swing into action. A strike team of 4 expert pedagogues repel from their helicopter. Unfortunately, retired math teachers are not known for their peak physical condition or combat operations training. They have spent long careers sitting in uncomfortable chairs drinking too much coffee and grumbling as they grade page after page of division by zero errors. To date, every attempted intervention has resulted in at least one heart attack, stroke, or loss of consciousness from misjudging the distance to the ground. To conceal their nature the mission is then aborted and the poor retired teachers are shuttled to the nearest hospital where the luckiest are treated for shortness of breath and high blood pressure.

Some are not so lucky. So far, 431 retired math teachers have given their lives in service to the mathematics community. So, the next time you are tempted to give any other answer besides undefined for a division by 0 problem, please, think of the huddled squad of out of shape, caffeine addicted, former educators. Don’t let number 432 be on your hands.

http://math-fail.com/images-old/divide-by-zero5.jpg

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

The Rule of Two, Part I

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Do you know how old you were when you first learned to count? You might be thinking 3 or 4. If you were precocious, then your parents might have told you you could count as soon as you could talk, though I doubt you remember. Regardless of your (or your parents’) memories, you have been counting for longer.

Babies imprint — usually on their mother. The first number you learn is actually a pair of numbers, which I call, “Mom” and “Not Mom” but are more recognizable as 1 and 0.

The count of something is a description, and the simplest case of this is presence or absence of some characteristic. Numerically we use 0 and 1 — 0 for absence and 1 for presence.

Why must there be two choices. A characteristic that is universal is frankly not newsworthy. If everything was blue, for instance, we wouldn’t even have names for colors, blue included. So, while there are some categories that literally everything (or nothing) belongs to, you’ll seldom find the need to mention it. (Such statements are also incredibly difficult to verify. Is it necessarily true that everything shares a universe with us?)

The number system with only two digits — binary (or base two) — is therefore the most basic number system for counting. I don’t mean basic in the sense that everyone knows it but basic in the sense that it contains the least number of digits.

How rampant is this sort of binary characterization? How many times have you heard a statement that begins with, “There are two kinds of people…”?

Yes, that’s right, the number two is represented in binary as 10. The system you are most familiar with is decimal or base ten. In base ten, the number 10 is 1 ten (the base) and 0 ones. In base two, 10 means 1 two (the base) and 0 ones.

Isn’t decimal the norm? Base ten is widely accepted on our planet, but historically it has had some competition. The Babylonians used a base 60 (fancy word sexagesimal) number system. The Mayans had a system that was base twenty (vigesimal).

So, how old is this binary thing, anyway?

And God said, “Let there be light,” and there was light. God saw that the light was good, and he separated the light from the darkness.  God called the light “day,” and the darkness he called “night.” And there was evening, and there was morning—the first day. Genesis 1:3-5 NIV

Did you catch that? When Genesis says God created light he got darkness (or absence of light) as a free gift for his troubles. Furthermore, the act of separating them is a characterization — exactly what a young baby does when it distinguishes between the source of food and comfort and everything else.

So, you’ve been using binary for almost your whole life. The underlying notion is as old as creation. And, there are only two symbols to remember (or teach).  As a bonus, learning about other bases improves your own understanding of decimal, in a similar way as learning a foreign language teaches you about the grammar of your native tongue.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Favorite Numbers

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

What’s your favorite number? No really, I’m curious. I’ve been asking students that every semester for eight years now, and I’ve learned quite a bit about people from that simple question. Single digit numbers are incredibly popular. Likely, if you fit in that crowd, you chose your number at such an early age you can’t remember having any other. You are decisive and have not lost your inner child. Unless, perhaps, your number is 7. Seven is the classic response, and is therefore the default choice for someone without a strong feeling for any other number.

Thirteen is nearly as common. If 13 is your number then you like to be different, but not too different. You probably enjoy pushing people’s buttons. The next most common category is dates of the month and then jersey numbers. Usually a date is an anniversary or a child’s birthday. I find these to be most common in women with at most one child. Jersey numbers are common in the 18-25 year old students with a fond recollection for high school athletics.

23 and 42 have their own cult followings, but identifying with numbers like this mainly serves as a shibboleth — connecting members of the same cultural tribe.

So, what about you? What does your favorite number say about you? My generalizations aside, numbers are something that resonate deep within us. Why is that? We live in a society that decries mathematics, but almost everyone you ask has a favorite number. It’s deeper than that, though. Imagine you are sitting in a classroom with 20 other students and I ask the question. What is your response to hearing that Mike’s favorite number is zero. Did you just sigh a little?

What if Mike said his favorite number was π? Did I hear someone mutter “nerd” under their breath? Have you ever met someone with a negative favorite number? Or a fraction? Admit it. Most of us are experiencing numerical prejudice at the thought of it. How is it that numbers elicit a response that visceral? Is it innate, or has the sum of your frustrations and pains in learning mathematics influenced your opinions about something as innocuous as a number?

I don’t know. What is a number anyway? It is possible that they are just tools for measuring and counting. I believe otherwise. I think that numbers are an alphabet to a universal language. That language is mathematics.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn