Building a Computer 1: Numerals

It’s been a long time since I’ve done much math with my kids or blogged about math. We’ve been busy with other things. But recently my kids have been asking me about how computers work. I like to give in-depth answers to such questions, so we set out on a quest to understand how they work. I saw the following video of a marble binary adder some time ago (see also woodgears.ca).

My short-term goal is to get my kids to understand the ins and outs of how it works and perhaps build one ourselves. The long-term goal is to understand and build as many components of an actual computer as we can and understand how they fit together to make a real computer. What would be really cool would be to see how much of this we can do with marbles!

Today I mostly wanted to introduce binary representations of numbers and how binary arithmetic works. I started by asking my kids about numeral systems. I made sure that they understood that though, for instance, the ancient Romans used different numerals than us, they had the same numbers as we do.

Next we play-acted a scenario that I dictated to them. “You have crash-landed on an alien planet. You need to communicate home, but your microphone was broken in the crash. All that you can use to communicate is a numeric key pad. What’s worse, the only button that works on it is 1. Also, you can only hit the button up to three times before transmitting.” As I asked them for numbers they quickly invented “unary”:

One    1
Two    11
Three  111

I asked them for four, but of course they couldn’t do it without being able to hit the button more than three times.
“After cryo-sleeping through the night you awake and set to work trying to repair your keypad. Finally, you get the 0 to work. You can still only hit three buttons before transmitting. Now what numbers can you make?” Again they started with unary, but I insisted that they make more than one, two and three. Here is what they came up with:

Zero     101
One      000
Two      001
Three    011
Four     110
Five     111
Six      010
Seven    100

As far as I can tell they chose the representation of each number randomly!

“After another night’s cryo-sleep you manage to get the keypad to allow ten key punches before a transmit. But now I need you to be able to send me numbers up to one thousand.” This had them stumped for a while. I decided to help. I suggested that they needed some sort of pattern, since making random assignments would be confusing and take a long time. they were still having a hard time, so I suggested we look at addition. I had them explain the algorithm they use to add multi-digit numbers together. Then we started a chart and I convinced them to try to use addition to continue it. Here was our beginning:

Zero     0000000000
One      0000000001

We agreed that these seemed like reasonable choices. They pointed out that we could have represented one as 1000000000 with about as much justification as our choice above, but we agreed that 0000000001 fit with our normal conventions better. I suggested we try adding one to itself to get two:

         1
 0000000001
+0000000001
 ----------
 000000001?

They decided that if we were going to have a process for adding similar to what they were used to in base-10 then there should be a 1 carried as shown above. The only question was what to make the ? be. There are only two choices. After experimenting with both we found that if two is represented by 11 this leads to unary again (which we knew was unacceptable for the required task). On the other hand two being represented by 10 leads to something nice. Once they had played with it for some time I told them that this numeral system had been invented by others already and that it is called binary.

Finally we were ready to watch the above video together. With the background of binary representations and binary addition, they were able to understand quite a bit of how the machine works. Next they need to understand each of the logic gates at work in the machine and how they fit together to actually make an adder, but all of that is for another day.

I am very much an outsider when it comes to computers. I’m just a math guy. I’m planning on looking at the book The Elements of Computing Systems to learn more about building a computer from the ground up. This is going to be a voyage of discovery for both me and my kids. Any suggestions from experts are welcome!

About these ads
This entry was posted in computers, Uncategorized. Bookmark the permalink.

15 Responses to Building a Computer 1: Numerals

  1. There’s a kids’ book they might like called How to Count Like a Martian.

  2. Pingback: Building A Computer 10: More Binary « MATH with my KIDS

  3. Jack says:

    Fascinating, but how do you manage to get your kids to sit down and think through something like this? Figuring out what the “?” in binary is, especially, sounds difficult for children to be interested in.

    • toomai says:

      Yeah, that (getting them to sit down and think about it) is the trick. Actually by the time we got to working out the “?” it was basically just my oldest who was still working on it. It was he (the oldest) who had gotten interested in computers in the first place and so a lot of what we have done has been fueled by that interest. Unfortunately I don’t have any magic ways of sparking the interest in the first place other than just throw a lot of things out there and see what they latch onto.

  4. Check out “Code: The hidden language of computer hardware and software “by Charles Petzold for a great book about the barebones and roots of computers.

  5. Dang Nguyen says:

    This was a great article! I think I’ll try it with my kids.

  6. Peter says:

    Have a look at this 16-bit ALU built in a gaming environment called Minecraft. Fabulous creative game.

  7. BrownishMonster says:

    Maybe it’s easier for children to grasp arithmetic binary than it is for us since they’re not as used to base-10 as we are.

  8. Bill says:

    Your kids’ primal representation is fascinating, I can just about follow the logic of it (but it’s a bit guessworky, and depends on arithmetical concepts of negative, less, more, and already-used).
    Did they really start with zero? That’s unusual.

    I wonder if other ‘unschooled’ kids, given same apparatus & conditions, would come up with same sequence.

    If I regress in mind a bit(:-), I would get a different sequence. (one=100,110,111,110,five=001,six=000,001,010,011,000)
    but then if I was told not to do unary (Chinese?), it introduces repression. So, for number one, I’d wannt 100, but if I mustn’t use 1 for 1, I have to say 000, which hasn’t got any 1s in it.
    Two is one more than that, 001 (as well as mustn’t be unary 110).
    Likewise, three can’t be 111, so it’s 001 with another 1 on top of the existing 1, that’s 011; etc. (cop-out, my brain hurts).

    Nice game for junior cryptographers.

    • toomai says:

      “Did they really start with zero? That’s unusual.”
      I think it was actually me that suggested they start with zero. There was quite a bit of prodding on my part that I haven’t included in my description.

  9. Bill says:

    Guided heuristics (/social conditioning?), yes, but good to transcend convention sometimes.
    It was eccentric math/logician Spencer, I think, who started with distinction (as distinct from nothing), but I for one certainly started with one (else I’d have nine fingers, four on each hand!).
    I still sometimes wonder “why the alphabet”, which serves once you have a dictionary, but I suspect alphabet came before.
    You’d think it would begin with “m”, but it was probably started A for some emperor or other. Kangxi Zidian starts with 1, yi, seems sensible, but probably still refers to number-one-father-leader.

    The ALU is impressive, by the way, takes me back in microprocessor time. I expect you’ve seen the efforts using GPUs to do stuff, as well.

    Anyway, good luck with that \:-)

  10. Pingback: Latin Squares, Squared Squares, and Legoed Squares « MATH with my KIDS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s