What is Binary?

Learning how to understand Binary will change how you see all numbers.

What is Binary? I am sure you have had that question at least once or twice before. Usually for me what happened in the past was, I would ask that question and then end up in some article written for a college Computer Science course that would over-explain what is a pretty simple idea. Adding in poor un-intuitive examples to further muddy up the waters. So I want to remove the mystery about it once and for all. Taking your skills from zero to one when it comes to binary.

How to Count

In reality, binary is just as simple as the way we normally count, but at the same time it is harder to read. The reason for this is largely because we are just not used to it. Why learn it? Because as I said before, I believe having an understanding of binary will change the way you see numbers and number systems. If you look up ‘Binary Number’ on Wikipedia the definition is as follows:


In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically “0” (zero) and “1” (one).
The base-2 numeral system is a positional notation with a radix of 2. Each digit is referred to as a bit. Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used by almost all modern computers and computer-based devices.

https://en.wikipedia.org/wiki/Binary_number

Let’s Start with What We Know

See what I mean? That explanation makes things worse! So forget that definition for a moment and lets see if we can simplify things. Lets do a thought experiment. Okay, counting from 1 to 10 just like we normally do, how would you do it?

1…2…3…4…5…6…7…8…9…10

Great job! There is a part of that counting process that you might not have thought about before, or paid much attention to. I want to focus on the numbers ‘9’ and ’10’. What is going on here? Why is the number ’10’ the number that comes right after ‘9’? Well, there are a couple things going on here. First we see that the number ‘9’ is the highest single digit number we have in our system. So what do we need to do to get a higher number? We add another digit. So we add a digit but then we automatically reset the number ‘9’ to zero and the new digit is set to one. Let me re-write the sequence to see if I can help illustrate the process.

You see, conceptually as we are counting you can imagine an infinite amount of zeroes to the left of any number that you write. They wait there patiently until they are needed. They are needed every time we need an extra digit.

008…009…010………
018…019…020………
098…099…100……..

Armed with this perspective, lets look at binary. Binary works the exact same way, except instead of being able to use all the digits from 0-9 it is stuck with just using two digits 0-1. Lets start by looking at the number one.

Notice both are exactly the same. But the changes happen when we try to represent the number ‘2’. Remember Binary only has one’s and zero’s. So how do we proceed? Well we follow the same strategy as we do when counting from 9 to 10. We add a zero to the right of the number like so:

“There are 10 kinds of people in the world. People who understand binary, and people who don’t.”

Moving on, when trying to represent the number ‘3’ in binary we look at the number ‘2’ in binary. Since it still has space in it we don’t need to add a digit. We can represent it like so:

Can you guess what four would be?

Good guess, here is a GIF that will help to further cement your knowledge

By Ephert – Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=38752676

Reading Binary

So now that you know how to count in binary I wanted to address what is meant by a ‘base-2’ number. Let’s first go back to how we were taught to count in kindergarten. We were taught to count in a base-10 system. You were taught about digits having a ‘place’ (i.e. tens, hundreds, thousands and so on). But what you might not have realized is that those places are directly correlated with the number 10 being raised to some power. So if you think about it in that way the following table emerges.

What we can deduce from the chart above is that every time a digit is added, we are essentially raising the value of the number by an additional power of ’10’. This results in the following equation that the number ‘n’ (where ‘n’ is equal to the number of digits) will always be equal to or greater than the number 10n-1. Why the negative one? That is because we are starting from zero. This very same principle can be applied to Binary. The difference is that Binary is a base-2 system, and therefore, instead of raising ’10’ to the power of some number we are raising ‘2’ to the power of something. Which results in the following table.

Converting Binary → Decimal

Knowing this allows us to use that information and relatively quickly convert Binary into our easier-to-read Decimal form. Lets take the 16-bit number 1010101010101010. For simplicity’s sake we will assume that it is an unsigned number. Meaning that this number represents a positive number. How would we count it? Well it’s actually pretty simple. Starting from the left of the number (what is called the most significant bit) every time you find a one you take its value and add it to a running sum. This is where a graphic might help.

This same strategy of conversion works for all types of number systems. In fact it works for converting decimal to decimal like so:

A little redundant, but this demonstrates the universality of this counting method. I will not discuss converting decimals into binary other than to say it is the same process, just in reverse.

Quiz

Here is a little puzzler for you… What would 16 ‘1’s in binary represent after being converted into decimal? (Hint: you don’t need to do any conversions just think about the exponents.)

Why don’t you have to do any fancy conversions? Because if we have all 16 ones you know that the next number is going to flip all those ones to zero’s and add a digit. So we would end up with a ‘1’ followed by 16 ‘0’s, which is……216 or 65,536. Therefore 16 ‘1’s must be one less than 1 followed by 16 ‘0’s giving us the result of 65,535.

There are many more tricks and shortcuts like that which can be done with binary due to its simplicity. I will probably try and tackle some of them in a later post. Hopefully this has been helpful in your pursuit of understanding what binary is and how to read it.

Leave a Comment