# What is Binary?

There are four types of the number system in computer applications through which we represent the different numbers.

Before moving to binary numbers, let's discuss the rest of the number system and the type of number system we include in the computer application.

The first one is the hexadecimal number system, and this type of number system includes the base value equal to 16. Sixteen different symbols have been assigned in this number system.

The second one is the decimal number system. The base value of this number system is 10. We have been using the number system since our childhood to count something or solve mathematics in our classes. The third one is the octal number system. In this number system, you will find the base value is 8. In this number system, you will find eight different symbols. And those symbols are from 0 to 7.

And, the fourth one is the binary number system, which we are going to read in this article:

A binary number in a binary number system or base 2 number system called binary. In Binary System, we define the symbol as 1 and 0. The propositional position of the binary number system is 2.

Computers use this numerical system to store and retrieve data such as numbers, music, pictures, words, etc. The term **'bit**,' which refers to the smallest digital technology unit, is derived from the words 'BInary digiT.' Today, programmers utilize the hexadecimal or base-16 number system to concisely express binary data. Because it is easier for computers to convert from binary to hex and vice versa, whereas doing so with the generally used decimal number system is far more difficult.

## A brief history of the binary number

**Gottfried Leibniz** and a few more mathematicians previously described the contemporary binary numbers in Europe in the 16th and 17th centuries. The I Ching, also known as the Masterpiece of Changes or the Book of Modifications, is one of China's earliest books, dating from the 9th century BCE. The notion of Yin-Yang is used in the same work to depict the interconnection of forces in the world.

Ancient Egyptian scribes employed something called Horus-Eye fractions, which was one of two methods the Egyptians used to depict fractions, even before these advancements in China.

Fairly close to home, in the 2nd century BC, An Indian intellectual, Pingala, creator of Chhandahshastra, was also renowned as one of the early developers of the binary system.

The distinctions between the current binary system and Pingala's creation are that the latter's system begins with one rather than zero. The binary interpretations expand to the right rather than the left, as in the contemporary version.

## Representation in binary

We can categorize binary numbers in two forms, the first one is signed number, and the second is an unsigned number

**Unsigned Numbers**

Only the amount of the number is included in unsigned numbers. They don't have any identification. All unsigned binary values are, therefore, positive. Using a positive sign before a number, like in the decimal number, is optional for portraying positive number. Consequently, zero and all those who sign is not positive can be considered unsigned numbers.**Signed Numbers**

In a signed integer, you will find the expected value of a number. The symbol is placed in front of the phone number in most cases. That’s why, for positive integers, we must identify the positive sign, and for negative values, we must examine the negative sign. As a result, if an appropriate sign is put next to the integer, it can be regarded as a signed number.

### Representation of Un-Signed Binary Numbers

The size of a value is recorded in the bits of an unsigned binary value. If an unsigned binary number has 'N' bits, then all of the N bits indicate the number's value because it lacks a sign bit.

**Example:**

Think about the value 23 in decimal form. 10111 is the binary equal of this number. This is how an unsigned binary number is represented.

10111=23

It has seven bits. The value of the integer 23 is indicated by these 5 bits.

### Representation of Signed Binary Numbers

In signed binary numbers, Most Significant Bit MSB is used to denote the sign of the numbers.

### Representation of Signed Binary Numbers

Placing a '0' in the signed binary shows a positive sign. In the same way, putting a '1' in the signed binary represents a negative sign.

Signed binary integers can be represented in three ways:

- Sign-magnitude form
- 1's complement form, and
- 2's complement form.

A positive number has the same meaning in all three types. However, only the depiction of negative numbers in each format will vary.

## Sign-Magnitude form

The MSB is often used to describe the number's sign, while the remaining bits indicate the number's value. As a result, add the sign bit to the unsigned binary number's leftmost side. This notation is analogous to the format of signed decimal numbers.

Consider the number -23, which is a negative decimal number. This integer has a magnitude of 23. The unsigned binary value of the number 23 is 10111. It consists of 5 bits. All of these bits represent the value.

Assume the sign bit as one on the leftmost side of the magnitude because the provided integer is negative.

-2310 = 1101112

As a result, -23's sign-magnitude equivalent is 110111.

## 1's complement form

Accompanying all the bits of a signed binary number yields the 1's complement of a value. As a result, when a positive number is multiplied by 1, the result is a negative value. In the same way, adding 1 to a negative integer produces a positive number.

If you multiply a binary number by two times the 1's complement, you will receive the original signed binary value.

**Example**

Assume the negative decimal value -23. The value of this number is 23. The signed binary representation of 23 comes out to be equal to 10111.

It consists of 5 bits. This number's MSB is zero, indicating an excellent value. One is the complement of zero and vice versa. To get the negative number, replace zeros with ones and ones with zeros.

-2310 = 010002

Therefore, the 1's complement of 2310 is 010002.

## 2's complement form

A binary number's 2's complement is obtained by adding one to the 1's complement of a signed binary number. As a result, when a positive value is multiplied by two, the result is a negative number. Similarly, when a negative value is multiplied by two, the result is an excellent value.

If you multiply a binary number by two times its 2's complement, you will receive the duly signed binary number.

**Example:**

Assume the negative decimal value is -23.

Then the value of 23's 1's complement of (23)10 is (01000)2

2's compliment of 2310 = 1's compliment of 2310 + 1.

= 01000 + 1

= 01001

Therefore, the 2's complement of 2310 is 010012.