In this particular topic we are going to discuss about binary number representation, which means how data internally store with negative and positive numbers.

Number systems such as integers are represented in two ways i.e., signed numbers and unsigned numbers.

As the name suggests signed numbers are categorized as having positive (+) values and negative (-) values whereas in unsigned numbers they hold positive (+) values only.

In the number representation system all the categories i.e., Binary, Octal, Decimal and Hexadecimal can be represented both in signed as well as unsigned methods.

Here we will discuss the binary number system using both the methods to represent them. A Binary number is one which has two values i.e., the 0 and 1 which is mostly commonly used in machines.

Let us dive deeper into the topic.

**Representation of Binary numbers:**

The binary numbers can be represented in both the ways that are the signed and unsigned way. In a signed binary system the numbers carry a sign bit whereas in an unsigned binary system they do not carry a sign bit.

Let us discuss them one by one.

**Unsigned Binary Numbers:**

As discussed above unsigned binary numbers do not hold any negative (-) values they only hold positive (+) values within themselves which means they do not have any sign bit.

**Representation:**

This unsigned representation is referred to as the unambiguous representation technique which has only one zero, positive in every case. The N bit binary number represents its magnitude. The range of binary unsigned numbers ranges from 0 to 2^{n}-1.

**For example:**

Represent decimal number 80 in unsigned binary number.

This can be simply done by converting the decimal number into binary number.

(80)_{10}

We convert a number into binary by dividing the number by 2 in every case and taking the remainder as shown below.

Now in the end we take quotient and remainder of the last case i.e., 2/2=1 and the remainder of all the cases from bottom as:

**(1010000) _{2}**

**Signed Binary Numbers:**

Signed numbers hold sign bits, this representation differs between positive and negative numbers. This method contains both sign bit and magnitude of a number. In representation of negative decimal numbers, we need to provide a negative (-) symbol in front of the decimal number.

**Representation:**

The signed binary numbers can be represented in three ways:

**Sign magnitude form****1’s complement form****2’s complement form**

Let us discuss them one by one briefly.

**Sign magnitude form:**

For a n bit binary number, the 1 bit is reserved for the sign symbol.

If the value of the sign bit or the 1st bit is 0 then the given number will be positive (+) in the other hand if the value of the sign bit or the 1st bit is 1 then the given number will be negative (-). The remaining n-1 bits represent the magnitude of the number.

Since the magnitude of number zero is always 0, there can be two representations of number zero 0, positive (+)0 and negative (-)0. Hence these representations are ambiguous.

The sign bit is the most significant bit (MSB) of representation. The range of Sign-Magnitude ranges from (2(n-1)-1) to (2(n-1)-1).

**For Example:**

Let us take a negative decimal number (-21)_{10} and find its binary representing sign magnitude.

The binary is represented as (10101)_{2} and as it has a sign therefore the actual representation (1 10101)_{2,} the one at the beginning represents the sign bit.

**1’s Complement Form:**

The 1’s complement of a number is obtained by inverting each bit of a given number that is the 0’s to 1’s and vice-versa.

We represent positive numbers in binary form and negative numbers in 1’s complement form. There is an extra bit for sign representation.

If the value of the sign bit is 0, then it is positive and you can directly represent it in simple binary form, but if the value of the sign bit 1, then it is negative and you have to find the 1’s complement of the binary number.

We can get a negative number by 1’s complement of a positive number and a positive number by using 1’s complement of a negative number.

Therefore, the representation zero 0 can have two representations that specify that 1’s complement form is an ambiguous form. The range of 1’s complement form is from (2(n-1)-1) to (2(n-1)-1).

**Example Of 1’s Complement:**

Let us find 1’s complement of** (-21) _{10 }**

The binary value of **-21 is (1 10101) _{2} **

Its 1’s complement will be:

**(1 01010) _{2}**

This is achieved by simply converting the 0’s to 1’s and vice-versa. **Note: the sign bit does not undergo any 1’s complement operation, it remains the same.**

The range can be denoted as: minimum value** -21 (i.e., 1 01010) **to maximum value **+21 (i.e., 0 10101)**.

**2’s Complement Form:**

The 2’s complement of a number is obtained by inverting each bit of given number **(or performing 1’s complement)** plus 1 to least significant bit LSB.

We represent positive numbers in binary form and negative numbers in 2’s complement form. There is an extra bit for sign representation.

If the value of the sign bit is 0, then the number is positive and we can directly represent it in binary form and if the value of the sign bit is 1, then the number is negative and we have to take 2’s complement of the given binary number.

We can get a negative number by 2’s complement of a positive number.

If the value of the most significant bit MSB is 1, then take 2’s complement from else not. In this representation zero (0) has only one unique representation which is always positive. The range of 2’s complement form is from (2(n-1)) to (2(n-1)-1).

**Example Of 2’s Complement:**

Let us find 2’s complement of **(-21) _{10 }**

The binary value of** -21 is (1 10101) _{2} **

Its 1’s complement will be:

**(1 01010) _{2 }**

Therefore its 2’s complement:

**(1 01010) _{2 }**

** +1**

**(1 01011) _{2}**

This is achieved by simply converting the 0’s to 1’s and vice-versa and adding 1 to the LSB. **Note: the sign bit does not undergo any 1’s complement operation, it remains the same.**

The range can be denoted as: minimum value -21 (i.e., 1 01010) to maximum value +21 (i.e., 0 10101).

Please comment and share this article if you find helpful and **WhatsApp** us for more suggestion.