# Introduction to the Binary System

Get introduced to the base symbols and representation rules of the binary system.

## We'll cover the following

## What is the binary system?

The decimal system leverages the fact that humans have ten fingers to count with. The binary system does something similar in the case of computers.

An essential component of computers is the **transistor**, which has two states, on and off. These are sometimes also referred to as high and low states, and correspond to the presence or absence of voltage. Each state can be represented using one of two symbols—$0$ and $1$—resulting in a numbering system with base 2.

The binary system is a two-base system.

### Base digits

The base digits for the binary system are simple: 0 to represent a low state and 1 to represent a high state.

### Place value

Like in the decimal system, the rules for representing a number in binary come from the place values of the digits. We know that the rule was that place values correspond to ascending powers of $10$ from right to left.

Note: For the binary system, the rule is that—you guessed it—place values correspond to ascending powers of $2$ from right to left.

Note:Recall that binary digits are referred to as bits.

### MSB and LSB

**MSB** is the **most significant bit**. It is the leftmost bit of a binary number and the one with the largest place values. Similarly, the **LSB**, or **least significant bit**, is the rightmost bit and the one with a place value of $1$.
The same symbol 1 in different places can have different values. For example, in $001$, the MSB is $0$, and in $100$, the MSB is $1$ and vice versa for LSB.
These terms make referring to binary numbers easier and can also be used to talk about groups of bits. For example, we can say “four least significant bits” to refer to the four right most bits in our number.

### Range

This is all well and good, but you might be thinking that it was lucky for us that we had five places to start with for the example above. So, how would we know how many places an arbitrary number would take up to be represented in binary?

For that, we need to think about the range of a set of bits.

Let’s think about how many different numbers we can represent with two bits.

We can represent four numbers from $0—3$. Let’s now see how many numbers we can represent with three bits.

Note:We already know that we can have four different numbers with two bits, which could each either be $0$ or $1$. If we add a third bit, it could also either be $0$ or $1$. So, we may extend each of the four two-bit binary numbers with a $0$ on the left and then with a $1$ on the left, giving $4\times2 = 8$ different numbers. So, each bit contributes to doubling the number. In the following illustration, we are showing only the ones where the leftmost bit is $1$.

Let’s try to come up with an expression for the range of bits. This means we want an expression to calculate how many (and what) numbers we can represent using $n$ bits.

Can we use the patterns we observed in our two examples to do this? Let’s see.

A single digit $(n = 1)$ binary number can have two different values ($0$ or $1$). When we take the number of bits to $n = 2$, the number of possible values increases to $2 \times 2 = 2^2$. When we take the number of bits to three digits, the number of possible values increases to $2 \times 2 \times 2 = 2^3$. Notice that for $n$ binary digits, we have all the $k$ numbers available that we did for $(n-1)$ digits. This happens when we turn the $n$th MSB digit off. Additionally, we have the option of turning the $n$th digit on, which gives $k$ more possible numbers. This brings our total to $2k$. Thus, with every increase in $n$, we are multiplying the possible combinations by $2$. We then have:

Note:Remember that one of these values is always $0$, so the range of numbers that we can represent is $0$ to $2^n-1$.

## Test yourself

How many numbers can you represent in binary using $6$ digits?

$64$

$63$

$65$