# The Binary Number System

Whether it be from mathematics class or computer science class, eventually we will need to learn about number systems, and the arithmetic that is involved.

Binary numbers, as with decimal, octal, and hexadecimal numbers, can be represented in columns. To learn binary arithmetic, we first need to understand how number systems operate.

Let's take a look at the decimal system first, since it is simple and easier to think about. We can consider the number "1234" as,

 Thousands Hundreds Tens Ones 1 2 3 4

Which means,
1234 = 1x1000 + 2x100 + 3x10 + 4x1

Given that,

 1000 = 10^3 = 10x10x10 100 = 10^2 = 10x10 10 = 10^1 = 10 1 = 10^0 (any number to the exponent zero is one, except for zero)

The table above can be represented as,

 Thousands Hundreds Tens Ones 10^3 10^2 10^1 10^0 1 2 3 4

such that,
1234 = 1x1000 + 2x100     + 3x10      + 4x1
= 1x10^3 + 2x10^2   + 3x10^1 + 4x10^0

The decimal system, as with decimal math, operates in "base 10" (dec being the Latin prefix for ten) using the digits 0-9 to represent numbers, whereas the binary system, as well as its math, operates in "base 2" (bi being the Latin prefix for two) using the digits 0-1 to represent numbers. The base is also known as the radix. In other words, the table above can be represented as,

 Thousands Hundreds Tens Ones Decimal 10^3 10^2 10^1 10^0 Binary 2^3 2^2 2^1 2^0

In base 10, we put the digits 0-9 in columns 10^0, 10^1, 10^2, and so on. To put a number that is greater than 9 into 10^n, we must add to 10^(n+1). For example, adding 10 to column 10^0 requires us to add 1 to the column 10^1.

In base 2, we put the digits 0-1 in columns 2^0, 2^1, 2^3, and so on. To put a number that is greater than 1 into 2^n, we must add to 2^(n+1). For example, adding 3 to column 2^0 requires us to add 1 to the column 2^1.

Here are some decimal numbers represented in binary.

 Decimal Binary 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010 