How Does the Binary System Work: An Introduction

Before you start reading this article, I want you to take a trip back into your past when you were being taught the decimal system. Personally, when I was in elementary school (in the 70’s/80’s), teachers used to use a column system to teach us about numbers:

[Thousands] | [Hundreds] | [Tens] | [One]
1 2 3 4


The number 1234 is - 1 Thousands, 2 Hundreds, 3 Tens and 4 Ones.

A few years later, we learned about the composition of the decimal system in a more complex way.

Thousands became 10^3 (10*10*10)
Hundreds became 10^2 (10*10)

… and so on.

1234 then became:

((1*10^3)+(2*10^2)+(3*10^1)+(4*10^0))

As you already know, counting in decimals is done by using 10 digits, from 0 to 9. Each time we jump a “column” (from 9 to 10), we add 1 digit to our total and reset all subsequent numbers to 0 (999 becomes 1000). The binary system works exactly the same way, but instead of using digits that goes from 0 to 9, we keep things simple and only use 0’s and 1’s, just like computers do. But the question you are probably asking yourself now is why do computers only use 0’s and 1’s? The answer is simple: electronic circuits. Circuits that make the wheel inside your computer turn can only have 2 states, on and off. Since a computer is mostly made out of electronic circuitry, it is logical that it uses the binary system to send, receive or compute information.

How does the binary system work?

Let’s start with what a binary number looks like:

01001010

“What the heck does this mean, and how do I represent this in more familiar decimal format” you ask. First, you have to know that each digit of a binary number is based on 2 to the power of x (as opposed to the decimal system that is based on the number 10). Here is a quick and easy chart you should study before continuing:

2 to the power of 0 = 1 (2^0)
2 to the power of 1 = 2 (2^1)
2 to the power of 2 = 4 (2^2) or (2*2)
2 to the power of 3 = 8 (2^3) or (2*2*2)
2 to the power of 4 = 16 (2^4) or (etc.)
2 to the power of 5 = 32 (2^5)
2 to the power of 6 = 64 (2^6)
2 to the power of 7 = 128 (2^7)
2 to the power of 8 = 256 (2^8)

2 to the power of x = (2^x)

Ok, let’s apply this chart to the binary number I gave a few moments ago to get us the decimal equivalent. All digits that are 0 remain 0, and are only useful as position placeholders. All digits that are assigned a value of 1 have a decimal value that is equal to the power (2^x) of their position within the chart.

128 64 32 16 8 4 2 1
————————————–
0 1 0 0 1 0 1 0

01001010 = 64 + 8 + 2

which means that 01001010 = 74

Simple isn’t it?

Now let’s do the inverse. To convert 74 to binary, you’ll have to start by finding the biggest power of 2 that is valued less then 74. Finding this number is important because it will determine the positive value at the left of your binary number. In this case, it is 64.

Let’s put a 1 in the 2^6 (2*2*2*2*2*2 = 64) position.

01000000

After, take your initial decimal number, and subtract it by the value you just found out. 74 - 64 = 10. Now, let’s do the same procedure as before. What is the biggest power of 2 that is valued less then 10? It is 8.

Put a 1 in the 2^3 position ( 2*2*2 = 8 )

…and continue doing this until the total equals your initial decimal number.

01001010

Even numbers always finish with a 0 and odd ones end in 1. This is because the rightmost digit in a binary number can only have a decimal value of 0 or 1.

As a non-IT person, there’s no real reason why you should know about how to do this manually, except to sound smart in front of your peers. Most modern calculators (including the windows one) can also accomplish these operations quickly and painlessly.

So why bother with all this? The answer is simple: Because you’re a geek (or an aspiring one)!


Print this post

1 comments:

PastorDIC said...

Ok Ubergeek. Maybe this will be more challenging for you.

Someone gave me a puzzle I can’t seem to solve concerning binary.

He gave me a set of numbers that are supposed to be equivelant to coordinates to somewhere in SW WA. His only hint was “think binary”. Here are the numbers:

101, 333, 57, 2039, 6943, 123, 2048

2048, 4352, 65, 2060, 11707, 6712, 127, 1126

So how do I solve this?