# Binary

Contributors: Jimb0

## ABC's of 1's and 0's

Prepare to have your perception of reality shattered. Everything you ever thought you knew about something so simple as numbers is going to change. All your life you thought having 100 somethings meant having this many:

When, really, it only meant having this many:

No, Rod Serling’s not about to cross into the frame, and you haven’t swallowed any red pills. You’ve entered the binary zone and have just encountered base numbering systems.

### Number Systems and Bases

Number systems are the methods we use to represent numbers. Since grade school, we’ve all been mostly operating within the comfy confines of a base-10 number system, but there are many others. Base-2, base-8, base-16, base-20, base…you get the point. There are an infinite variety of base-number systems out there, but only a few are especially important to electrical engineering.

The really popular number systems even have their own name. Base-10, for example, is commonly referred to as the **decimal** number system. Base-2, which we’re here to talk about today, also goes by the moniker of **binary**. Another popular numeral system, base-16, is called **hexadecimal**.

The base of a number is often represented by a subscripted integer trailing a value. So in the introduction above, the first image would actually be 100_{10} somethings while the second image would be 100_{2} somethings. This is a handy way to specify a number’s base when there’s ever any possibility of ambiguity.

### Why Binary?

Why binary you ask? Well, why decimal? We’ve been using decimal forever and have mostly taken for granted the reason we settled on the base-10 number system for our everyday number needs. Maybe it’s because we have 10 fingers, or maybe it’s just because the Romans forced it upon their ancient subjugates. Regardless of what lead to it, tricks we’ve learned along the way have solidified base-10’s place in our heart; everyone can count by 10’s. We even round large numbers to the nearest multiple of 10. We’re obsessed with 10!

Computers and electronics are rather limited in the finger-and-toe department. At the lowest level], they really only have two ways to represent the state of anything: ON or OFF, high or low, 1 or 0. And so, almost all electronics rely on a base-2 number system to store, manipulate, and *math* numbers.

The heavy reliance electronics place on binary numbers means it’s important to know how the base-2 number system works. You’ll commonly encounter binary, or its cousins, like hexadecimal, all over computer programs. Analysis of Digital logic circuits and other very low-level electronics also requires heavy use of binary.

In this tutorial, you’ll find that anything you can do to a decimal number can also be done to a binary number. Some operations may be even easier to do on a binary number (though others can be more painful). We’ll cover all of that and more in this tutorial.

### Suggested Reading

We’re reaching pretty deep into the concepts bin. A lot of this tutorial builds on mathematical concepts like addition, multiplication, division (including remainders), and exponents.

No previous knowledge of electronics is required (except for knowing how the base-10 system works, which most people do), but we do observe how binary is used in Arduino programming, and knowing something about data types could come in handy. In addition, knowledge of digital logic will help to supplement all of this binary business.