# Binary Number System

A binary number, also known as a base 2 number, is a number composed only of 0s and 1s. The modern binary number system was studied in Europe in the 16th and 17th centuries by Thomas Harriot, Juan Caramuel, and Gottfried Leibniz. However, systems related to binary numbers have appeared earlier in multiple cultures including ancient Egypt, China, and India. Leibniz was specifically inspired by the Chinese 1 Ching.

The base of a numbering system refers to the number of distinct symbols allowed in the system. In our daily life, we generally work with decimal numbers. The decimal system is the base 10 system as there are 10 distinct symbols allowed – 0 through 9. Why do computers not use the decimal system as well? Wouldn’t that be easier for the programmers as well? The answers to these questions lie in the architecture of the computers.

Any computer consists of a large number of digital transistors. The way these transistors are created, it is easiest to have them in the on or off state, rather than having 10 different states. The state of a single transistor is the smallest piece of information a computer can store. This is also called as a bit (similar to a digit for the decimal system). Larger units of information can be created by combining multiple bits together. From a mathematical point of view, any data that can be represented using decimal numbers can also be represented using binary numbers, just that the binary numbers are going to have more bits than the number of digits in the corresponding decimal number.

Concepts such as order and carry apply in the binary system same as how they apply in the decimal system. In the decimal system, a number consists of the ones digit, tens digit, hundreds digit, and so on. For example, in base 10 decimal:

Note that every digit represents a power of ten based on its position. Similarly, in the binary system, a number consists of ones bit, twos bit, fours bit, eights bit, and so on. That is, every bit represents a power of two based on its position. For example—a binary to a decimal (base 2 to base 10):

**Decimal numbers and their binary representations:**

Decimal | Binary |

0 | 0 |

1 | 1 |

2 | 10 |

3 | 11 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

8 | 1000 |

**Convert decimal numbers to binary:**

128= | 64= | 32= | 16= | 8= | 4= | 2= | 1 | |

56 | 1 | 1 | 1 | 0 | 0 | 0 | ||

131 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |

Explanation:

56 = 32+ 16+8=

131 = 128+ 2+1

=

add numbers where ones are there.

Computer memory units are typically represented in bytes. A byte consists of 8 bits. The typical metric system of measurements applies to bytes also, although in a slightly different manner. Similar to how a kilogram consists of 1000 grams of mass, a kilobyte (kB) is 2^10=1024 bytes. You can have a 200-word paper represented in a kB. A megabyte (MB) consists of 1024 kB or 2^20 bytes (slightly more than a million) and can store a small book. The next units are gigabyte (GB) (2^30 or slightly more than a billion bytes) which can store a typical movie, terabyte (TB) (2^40 or slightly more than a trillion bytes), petabyte (PB) (2^50 bytes).

We learn how computers can store numbers but what about letters within a piece of text? How does a computer store a word like “school”? Whatever you read on any website, phone, tablet, and kindle is converted into binary numbers and stored. When storing text, each letter and symbol like a punctuation mark, a space, or even a new line, is assigned a specific number using ASCII coding standard. In ASCII, the letter A is represented by number 65, letter B by 66 and so on. The lowercase letters have different representations to avoid confusion. a=97, b=98, …z=122.

Example: If you see “Hello” on your computer screen then computer finds its ASCII value and converts into binary numbers.

H | e | l | l | o | |

ASCII | 72 | 101 | 108 | 108 | 111 |

Binary | 1001000 | 1100101 | 1101100 | 1101100 | 1101111 |

There are more complex data types that need to be represented in computers.

Examples are numbers with a decimal point (12.34), photos, videos, etc. Every different type of data has a standard encoding system that makes is easy for humans to work with computers. But ultimately, everything gets converted into zeros and ones. The tiny bits are very powerful indeed.