Back to Basics: Decoding Binary (It’s Not as Hard as it Looks)

By Taryn Engmark

Associate Editor

Embedded Computing Design

March 06, 2024

Story

Back to Basics: Decoding Binary (It’s Not as Hard as it Looks)

For most people, binary is a mystifying concept of nonsensical zeroes and ones, the understanding of which is reserved for computer nerds and the computers they use. Well, today you join their ranks!

Welcome to Back to Basics, a series where we’re going to be reviewing basic engineering concepts that may require a more complex explanation than a quick Google search could provide.

To start understanding binary, we need to first understand what a numbering system is. We use a specific numbering system every day, but we don’t really think about it. Every time you count, do math, or pay bills, you use the decimal numbering system.

Learning to Count to Ten

So what is a numbering system, and how do they work? Let’s start by looking at decimal, since it’s the one that we’re all familiar with. A numbering system is broken up into two parts: numerals, and place values. Numerals are the numbers that you use to count: 0,1,2,3,4,5,6,7,8,9. Place values are a little bit more complicated. 

Let’s think about counting to ten. At first glance, this seems trivial: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Notice how something changed when we reached ten. We added a new place value — why did that happen?

Understanding the answer to this question is the key to understanding numbering systems, and for us, understanding binary. In decimal, we have ten numerals, ranging from zero to nine. 

Think of each place value as a box that can only hold up to nine things. When we start counting, we start with zero things in our box. We then add one more, and then one more, and so on until we reach nine things in our box. We now add one more. We have ten things, but our place value can only hold nine.

So what do we do? We take all of our ten things, bundle them up into one group of ten, and put them into the next place value: the tens place value. We now have one ten and zero ones: 10. As we count upward, we eventually will reach 18 (one ten, eight ones), 19 (one ten, nine ones), and then 20 (two tens, zero ones). This keeps going until we reach 99, where we suddenly need a new place value: 100 (one hundred, zero tens, zero ones). 

Every time we reach a nine of some place value, we create a new one that is ten times the last place value. (ten is 10 x 1, one hundred is 10 x 10, and so on). This system of “tens” is why we call decimal decimal (“deci” is the Latin prefix for “ten”).

Two is Good Enough for Me

This brings us to binary. Binary is a numbering system built around two, rather than ten. Let’s start by looking at our numerals for binary: 0,1. That’s it. With decimal, we had ten numerals, so with binary, it makes sense that we only get two.

Let’s start counting! We start with 0 (zero ones) and then add one to get 1 (one one). Now, we add one more and realize that each box or place value in binary only has space for one of something. We have two, but it can’t fit into our place value.

To accommodate this, we do the same thing that we did in decimal: we take our two somethings, bundle them together, and add them to the next place value: the twos.

We now have 10 (one two, zero ones). We can add a third thing to get 11 (one two, one one). 

The next place value works the same way: we add one more to get four, but our ones place value and twos place values are full, so we create the next place value: the fours. We now have 100  (one four, zero twos, and zero ones).

In decimal, each place value is ten times bigger than the last. Similarly, in binary, each place value is two times bigger. When we list out the first five place values of each system, we can see this in action.

Decimal:

1 (ones), 10 (tens, 10x1) 100 (hundreds, 10x10), 1000 (thousands, 10x100), 10000 (ten thousands (10x1000)

Binary: 

1 (ones), 10, (twos, 2x1), 100 (fours, 2x2), 1000 (eights, 2x4), 10000 (sixteens, 2x8)

That’s it! Binary is just a different way of counting, where we limit ourselves to only use two numerals and have place values built around two rather than ten.

We’ll leave you with a binary joke:

There are 10 types of people in this world: those who understand binary, and those who don’t.

Categories
Software & OS