Software Developers, evolved!

Menu

Widgets

Search

Contact Me

How Computers “Think” – Binary Numbers

Introduction

Since humankind first discovered how to harness the power of electromagnetism, we’ve strived to invent new and interesting ways to use that power. Arguably the most pervasive use of that power has been in the field of information management.

Starting with the invention of the telegraph, we have learned how to use electricity to communicate information quickly across vast distances. From those humble beginnings, we’ve since invented better and more meaningful ways to communicate – the telephone, radio, television, satellites, cell phones, computers, and the Internet. Even with all of these advances though, how we use electricity to communicate information hasn’t changed much since the telegraph. Samuel Morse used patterns of electrical pulses called Morse Code and translated those patterns into meaningful information that human beings could understand. Today, computers do pretty much the same thing, but not without a lot of help from pioneers in Mathematics! Like the telegraph, computers also use patterns of electrical pulses. But unlike Morse Code, computers use a very specific pattern based on a mathematical concept called “Binary Numbers”. In this atricle, we will explore the concept of the Binary Number system.

The Simple Act of Counting

So here is a trick question for you. How many numbers can you count on both hands? The obvious answer would be 10 of course. But as I said, this is a trick question. Hold up your hands, but don’t extend any fingers at all. Zero is just as important and just as valid of a number as the other 10 numbers we normally count with our hands! So already, we see that we can actually count 11 numbers with our hands. We may think we’ve arrived at the correct answer to my trick question, but of course, we are still wrong!

As a species, we’ve developed five digits per hand, so we’ve learned to count and do more complex math operations using a ten digit numbering system called the Decimal system. But, imagine some alien world where the intelligent species that lives there only has one hand and one finger – let’s call them the Binoids. How would Binoids learn to count and do math?

The answer is, “The same way a computer does!” Our hypothetical species has learned to count using only the digits 0 and 1. In the same way, computers use electrical pulses (a low voltage and a high voltage) to represent 0 and 1. Now obviously, the Binoids can count much higher than 1 just like we can count higher than 10. But what would their large numbers look like?

We’ve learned to represent numbers larger that the 10 digits we can count on our hands by using placeholders to represent higher values using the same digits. When we count and reach the limit of the numbers we use, we simply increase the next place by one and reset the current place to zero (…8…9…10…11…12…) The Binoids (and computers) do the same thing, only they’re limited to just the two digits 0 and 1. So when they count, it looks like this: …0…1…10…11…100…101…110…111…

…And Now It’s Time for Some Math (Ugh!)

Remember studying “powers” back in school? No? Quick refresher. Mathematicians came up with a way to represent a number multiplied by itself more than once using a superscript notation. So, for example:

In our example, the number 10 represents something called the “base” and the little superscript there, called the “exponent”, represents how many times the base should be multiplied by itself to come up with the value we’re actually trying to represent. “What about 100?” you ask. They came up with a rule for that too! And it is an important one as we shall see shortly: Any base raised to the power of 0 is equal to 1. So, we can also add 1 = 100 to our example.

Since it will become important later (and we will see why), we should also review powers for base 2:

Its also worth noting that mathematicians came up with another convention to tell numbers expressed in different bases apart – the subscript. In every day use, the number “1011” literally means “one thousand eleven”. The use of base 10 is inherently understood. But what if you’re a Binoid? The value “1011” would mean something completely different to you! To specifically communicate which base is meant when writing a number down, mathematicians apply a subscript to the value like this “101110” for base 10 numbers, or “1101012” for base 2.

The Binary System

So what does all this have to do with counting? Quite a bit actually. Without even realizing it, you’ve been using base 10 and powers since you first learned to count larger numbers! Let’s look at an example using what we’ve learned so far:

Much in the same way that we have 10 digits and learned to count and do math in base 10 using the Decimal System, the Binoids (and computers) only have 2 digits and therefore count and do math in base 2. Fortunately, math is a universal language, and we can use it to translate binary numbers into decimal numbers to make it easier for us to understand. Let’s look at an example of a binary number and figure out what decimal number it represents:

“There are 10 kinds of beings in the
universe…those who can count in Binary
numbers and those who can’t.”

As we can see, even though the Binoids (and computers) have fewer digits to work with, using the Binary System, they are still able to count large numbers! This example showing that “1101012” is equal to “5310” looks much like the previous decimal number example. The key difference is that we’ve replaced the base 10 powers with base 2 powers instead, since Binoids only have 2 digits to work with instead of 10.

Conclusion

Going back to the trick question I asked earlier, “How many numbers can you count on both hands?” The real answer, as it turns out, is 210, or 1,024! One one hand alone, we can count up to 32 using the Binary System. Don’t believe me? Look at the Binary Number column in the chart below. For any given number, extend your finger where a 1 occurs, and curl up your finger where a 0 occurs. The Binoids would be jealous!

Binary Number

Decimal Number

Binary Number

Decimal Number

00000

0

10000

16

00001

1

10001

17

00010

2

10010

18

00011

3

10011

19

00100

4

10100

20

00101

5

10101

21

00110

6

10110

22

00111

7

10111

23

01000

8

11000

24

01001

9

11001

25

01010

10

11010

26

01011

11

11011

27

01100

12

11100

28

01101

13

11101

29

01110

14

11110

30

01111

15

11111

31

Support for DevGorilla.net

If you want a really cool brain teaser of a toy uses binary number patterns to solve it (and maybe even will help you learn to count in binary numbers!), then check out this link here…