What is Binary? Why Do Computers Use 0 and 1?

Larry K.
2042
Published in
3 min readApr 2, 2019

You may hear about binary. Maybe even know it’s used in computers.

Photo by Hope House Press — Leather Diary Studio on Unsplash

Today, I’ll talk about what is binary number system and why computers use this system instead of decimal numbers. And also show you how to convert a decimal number to a binary number.

A binary number is a number expressed in the base-2 numeral system. This system only uses two symbols: zero(0) and one(1).

Think of 1 as “on” and 0 as “off”. A switch is either “on” or “off”. In some way, we could say there are a lot of “switches” inside computers.

Of course, it’s oversimplified. If you’d like to know more, this will help you dig more.

A punched Remington Rand card with an IBM card for comparison. — By Marcin Wichary

In the early days of computers, people entered data to computers by feeding punched cards. Data could be represented as 0s and 1s. Here, a hole means 1 and “no hole” represents 0. Very clever, isn’t it?

The Simple Math Behind the Binary-Decimal Conversion Algorithm

How do we understand binary numbers? Since what we use daily is decimal system, we could convert a binary number to a decimal number. It could help us understand what’s the meaning of 1111. In decimal world, 1111 means one thousand one hundred and elven. However, it means 15 if 1111 is a binary number!

Binary  |  Decimal
0 0
1 1
10 2
11 3
100 4
101 5
110 6
111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15
. .
. .
. .

As you could see here, 1111 in binary is 15 in decimal. Sometimes it’s impractical to check the table if the number is too large. For example, 111001. How do we convert this number without listing the table? We could break down 111001 like this:

111001 = 100000 + 10000 + 1000 + 1

Is there any good reason to break down the number like this? Yes. It’s easy to convert 100000 from binary to decimal. Depends on how many 0 after the 1. In this case, there are 5 zeros after 1. Then,

100000(binary) = 2^5 = 2 * 2 * 2 * 2 * 2 = 32 (decimal)

Same method applies to the rest of numbers:

10000(binary) = 2^4 = 16(decimal) 1000(binary) = 2^3 =  8(decimal)    1(binary) = 2^0 =  1(decimal)

After we finished those steps, added them all together.

32 + 16 + 8 + 1 = 57

Now we got 57 as the result.

Below is the simplified version of the conversion:

111001 = (1 × 2⁵) + (1 × 2⁴) + (1 × 2³) + (0 × 2²) + (0 × 2¹) + (1 × 2⁰) = 57

I hope this article helps you understand the general idea of why we use binary number in computers. And how to do the conversion from binary to decimal.

Any feedback is welcome.

--

--