What’s With All the 1’s and 0’s?

On a wall in the Computer Science wing hangs a silver plaque. Here is a picture of it:

deptmission

So what’s with all the 1’s and 0’s? Is that just for show, or does it actually mean something?

I’m not talking about “meaning something” in the philosophical sense. Whether those 1’s and 0’s actually translate into action and purpose on our part was a topic for a different post. Instead, in this article, I’m referring to something that is far more pedestrian, far more nuts-and-bolts. What do the 1’s and 0’s mean in our everyday language, and why do computers talk in this oddly limited language in the first place?

Let’s consider the second question first. Why do computers speak in 1’s and 0’s? That language of 1’s and 0’s is called binary. Computers speak in binary because of how they are built. A computer is nothing more than a vast collection of switches. There are millions of nanoscopically small electronic switches on those oddly etched boards within the computer. A switch, unless it’s busted, can be either on or off, closed or open. A switch that is “on” or “closed” passes electrical signal through it, while a switch that is “off” or “open” blocks that signal. Computer Scientists represent an “on” switch with a 1 and an “off” switch with a 0.

By expressing data in 1’s and 0’s, we package it in a way that mimics the organization of things inside the computer. The implications of this decision are profound and empowering, and it is actually unclear whether the first computer scientists knew how fortuitous their decision to express data as 1’s and 0’s would turn out to be. By patterning data precisely the way the computer that processes it is built, they enabled computers to process both data and instructions using precisely the same components and tools. This later gave rise to the now ubiquitous von Neumann architecture, which virtually every modern computer follows. The unbelievable computational performance and storage capacities we now enjoy would not be possible without this way of organizing the computer and the data it processes.

Let’s get back to the subject at hand, though: what do those 1’s and 0’s actually mean? Computers don’t work directly with text. Instead, they derive meaning only from numbers. It takes 8 of these 1’s and 0’s (in other words, 8 bits) to build a single number. For example, consider this collection of 8 bits:

0 1 0 0 1 0 0 1

You’ll notice that this is the first collection of 8 bits on our plaque shown in the picture. This collection of 8 bits is called a byte. In a byte, each bit has a value associated with it. This is no different than what you’re used to working with in your everyday experience with numbers. For example, if I say I owe you $1234, first of all, rest assured that I will never pay you, and second of all, consider what that means. Each one of those digits represents a power of 10. the rightmost digit is the least-valued one, and it is the number of ones. The second-to-the-right digit represents the number of 10s. The third-to-the-right digit represents the number of hundreds. Finally, the leftmost digit represents the number of thousands.

In our example, there is a 4 in the one’s place, a 3 in the ten’s place, a 2 in the hundred’s place, and a 1 in the thousand’s place. The total value of this number, then, is

1 * 1000 + 2 * 100 + 3 * 10  4 * 1 = 1,234

This is exactly the same interpretation we apply to the bits in a byte to determine the value it represents. The only difference is that, instead of each digit representing how many of a particular power of 10 we have, each bit in a byte represents how many of a particular power of 2 we have. The rightmost bit represents how many two-raised-to-the-0-power (i.e. how many 1’s) we have. The second-to-the-right bit represents how many two-raised-to-the-1-power (i.e. how many 2’s) we have. The third-to-the-right bit represents how many two-raised-to-the-2 power (i.e. how many 4’s) we have. The fourth-to …

Hey, shut up nerd. I’m dying here.

OK. Thanks for snapping me out of it. Let’s get back to our example.  Consider 0 1 0 0 1 0 0 1, and work with each bit starting from the rightmost one.

We have 1 in the 1’s place.

We have 0 in the 2’s place.

We have 0 in the 4’s place.

We have 1 in the 8’s place.

We have 0 in the 16’s place.

We have 0 in the 32’s place

We have 1 in the 64’s place.

We have 0 in the 128’s place.

Where did 1, 2, 4, 8, 16, 32, 64, and 128 come from? Each of those numbers is a power of two, which is what we said each bit in a byte represents. Each bit represents one of these powers of 2, and there either is that power of 2 in the overall number the byte represents, or there isn’t. In other words, either the switch that corresponds to that bit is closed, or it is open. Notice the perfect match between data and structure? It makes interpreting and representing data a lot easier than it otherwise would be.

So, let’s add up what we have: 1 + 0 + 0 + 8 + 0 + 0 + 64 + 0 = 73.

Eureka, the first byte of our department mission plaque is 73! 73? I thought the answer to all things of cosmic significance is 42. What’s the deal with 73?

Well, each number that we come up with in this way actually maps to a character. The mapping is defined by something called the American Standard Code for Information Interchange, or ASCII. If you search for ASCII, one of the first sites you’ll see is the web’s most spectacular, entertaining, insightful, mind-blowingly awesome site, www.asciitable.com. Read down the Dec column until you find 73. Then, scan to the right a bit until you get to the Chr column. You’ll see the letter “I” (capital eye) there. What does that mean? Our sequence 01001001 is a byte that translates to the number 73 which maps to the character I. So, the first character in our department mission is I.

That’s all there is to it. Each collection of 8 bits represents a number which, in turn, represents a character.

Test yourself. Try translating the rest of the message and see if you can figure out the rest of it. Here’s a hint. It does not say “Illinois football is going to go unbeaten this year.” I’m an optimist, but I gave up the hallucinogens long ago.

 

About Ray Klump

Professor and chair of Mathematics and Computer Science Director, Master of Science in Information Security Lewis University http://online.lewisu.edu/ms-information-security.asp, http://online.lewisu.edu/resource/engineering-technology/articles.asp, http://cs.lewisu.edu. You can find him on Google+.

Leave a Reply

Your email address will not be published. Required fields are marked *

Powered by sweet Captcha