Armen Ghazaryan

Posted on

# Binary numbers

## Introduction

A binary number is a number expressed in the base-2 numeral system by using only two symbols: 0 and 1. It is just like counting in decimal except we reach 10 much sooner. We start with 0 then 1 and after which we start with 0 again but already with 1 on the left side (10). This is the language which is used to speak with all computer-based devices. Besides the binary there are also 8-based 16 based representations. This is also the base of Boolean algebra: 0 is False, 1 is True.

## How to convert decimal to binary

Let's consider a decimal number 46 and try to convert it to binary.
46/2 will be 23 and 0 reminder
23/2=11, 1 reminder
11/2=5, 1 reminder
5/2=2, 1 reminder
2/2=1, 0 reminder
2/2= 1
So the representation of 46 in binary will be 101110 from below to above.

## How to convert Binary to decimal

Now let's try to convert 11011001 binary number into decimal.

Order start from right to left and we start count from 0.
11011001
76543210

Then we are summing up all numbers multiplied by the 2 power of their order number.

## Memory

Each 1 or 0 in binary number is one bit, so 11011001 is 8 bits which is equal to 1 byte. Bit is the smallest measure. Let's consider English Alphabet (there are 26 letters) we can represent it with 5 digits because 4 will be not enough.
00001
00010

01111
11111
With 5 digits we can represent 2^5=32 letters or something.

Binary addition works like a decimal addition, but the number can have only zeros and ones as digits, so if the sum exceeds 1, you have to carry 1 to the next bit.

When we add 1 to 1 we will get 10 so we will have 0 and 1 carry. Moreover, we can check that by converting these numbers and our answer into decimal.
10001 = 17
11101 = 29
17 + 29 = 46
101110 = 46

## Multiplication

Binary multiplication is similar to the multiplication of decimal numbers.

Here we can also check the results by converting binary numbers into decimal.