#### http://bodelen.com/afu.php?zoneid=2215294

**1’s complement representation**

**defined as:**

It is the binary representation used for representing positive as well as negative numbers ,where negative number is represented by 1’s complement of their positive equivalent.

**what is 1’s complement ?**

The number obtained by complementing each bit of a binary number is its 1’s complement.

** 1’s complement representation **

The most significant bit (MSB) is the sign bit , where 0 represents positive number and 1 represents negative number. The remaining bits represents the magnitude of the number .

**for positive numbers**,sign bit is 0 and the value/magnitude of the number is equal to the magnitude of the remaining bits .**for negative numbers**,sign bit is 1 and the magnitude/value of the number is equal to the magnitude of the complement of the remaining bits ,that is why it is called 1’s complement representation.few examples shown below,

**EXAMPLE 1:**

**Assuming 1’s ****complement**** ****representation
**

**( 0101 )**

_{2}

**= ( ? )**

_{10 }Left most bit MSB represents the sign bit ,here it is 0. So the number is positive and the remaining bits shows its magnitude .So the value of the number is 5.

**answer :
**

**( 0101 )**

_{2}= ( +5 )_{10}**EXAMPLE 2:
**

**( 1101 )**left most bit MSB is 1 ,So the number is negative. Now, in this case i.e. for negative numbers,magnitude of the number is equal to the magnitude of complement of remaining bits. So complement of remaining bits is 010 , its decimal equivalent is 2. Therefore the magnitude is 2. So, The value of the number is -2.

_{2 }=( ? )_{10 }**answer:
**

**( 1101 )**

_{2 }=( -2 )_{10}**another example,we can see this in another way as** ,

How to represent positive and negative number in 1’s complement representation. i. e. for example ,+5 and -5 have same magnitude but different sign,(one is positive number and other is negative) ?

**So for ( +5 ) _{10 }**

**positive number**,

For positive number ,first bit is 0 and remaining bits shows its magnitude .

Therefore +5 in 1’s complement representation can be written as 0101.

Now,

**For ( -5 ) _{10 }**

**negative number**,

First bit will be 1 and remaining bits is equal to 1 ‘s complement of their positive equivalent of the number. Therefore if we want magnitude should be 5 so first find binary equivalent of 5, then inverse or complement the bits. So 5 = 101 and its complement is 010.

Now, -5 will be equal to 1010 in 1’s complement representation.

**Similarly,**

**(+12) _{10} and (-12 )_{10
}**In 1’s complement representation, ( +12)

_{10}is equal to ( 01100 )

**.**

_{2 }As 12 in binary form is equal to 1100 .

It will be equal to ( 01100 )_{2 }_{ }in 1’s complement representation.

Now, -12 in 1’s complement form equal to ( 10011 )** _{2
}**As 12 in binary form is equal to 1100 .It will be equal to 10011 in 1’s complement representation.

**2’s complement representation**

defined as:

It is the binary representation used for representing positive as well as negative numbers ,where negative number is represented by two ‘s complement of their positive equivalent.

**what is 2’s complement ?**

The number obtained by complementing each bit of a binary number and adding 1 to it is its 2’s complement.

** 2’s complement representation **

The most significant bit MSB is the sign bit , where 0 represents positive number and 1 represents negative number.The remaining bits represents the magnitude of the number .

**for positive numbers**,sign bit is 0 and the value/magnitude of the number is equal to the magnitude of the remaining bits .**for negative numbers**,sign bit is 1 and the magnitude/value of the number is equal to the magnitude of the 2’s complement of the remaining bits ,that is why it is called 2’s complement representation.few examples shown below,

**EXAMPLE 1:
**

**Assuming**2’s complement representation**( 0101 )**

_{2}= ( ? )_{10}left most bit MSB represents the sign bit. Since it is 0 ,so the number is positive and the remaining bits shows its magnitude Therefore, 101 in decimal is 5. So the magnitude of the number is 5.

**answer :
**

**( 0101 )**

_{2}= ( +5 )_{10}**EXAMPLE 2:
**

**( 1101 )**

_{2 }=( ? )_{10}left most bit MSB is 1 ,So the number is negative. Now, in this case i.e. for negative numbers,magnitude of the number is equal to the magnitude of its 2’s complement . So complement of remaining bits is 010 then add 1 to it to take its 2’s complement.

Now it will be 011 which is equal to 3 in decimal .Therefore magnitude is 3. So, The value of the number is -3.

**answer:
**

**( 1101 )**

_{2 }=( -3 )_{10}**we can see this in another way as ,**

How to represent same magnitude numbers with different sign in 2’s complement representation. i. e. for example ,+5 and -5 have same magnitude but different sign ?

**So for ( +5 ) _{10 },**

**positive number**,

First bit is sign bit, so it will be 0 and remaining bits shows its magnitude .

Therefore +5 in 2’s complement representation can be written as 0101.

**Now, ****for ( -5 ) _{10 },**

**negative number**,

first bit is 1 and magnitude of number is equal to the magnitude of 2’s complement of remaining bits .Therefore if we want magnitude should be 5 so first find its binary equivalent i.e. 5 in binary form, then find its 2’s complement .So 5 in binary is 101 .So its 2’s complement will be (010 +1)= 011.

Now, -5 will be equal to 1011 in 2’s complement representation.

Similarly,

**(+12) _{10} and (-12 )_{10}**

In 2’s complement representation, ( +12)_{10} is equal to ( 01100 )** _{2 }** .

As (12)

_{10}in binary form is equal to ( 1100 )

**.**

_{2 }So, In 2’s complement representation, it will be equal to ( 01100 )

_{2 }Now, -12 in 2’s complement form equal to ( 10100 )_{2 }