Multiplying with Negative Numbers in 2’s Complement

 

Preliminary insights.

 

Fixed number of bits

2’s complement is used to represent negative numbers in systems where the number of bits is fixed.  The number of bits in a number remains the same regardless of the value attributed to the number eg in  4-bit binary arithmetic 2dec  is 0010, the leading 0s are required to keep to the 4-bit format.

 

Negative numbers

Negative numbers can be represented by their complement. 

Since 2 + 14 = 16,      -2 = 14 - 16

14 is the complement of 2 and the binary equivalent of 14 can represent -2.

The decision was made to let binary numbers beginning with a 1 represent negative numbers using the complement format. 

Numbers beginning with 0 represent positive numbers.   0000 is regarded as positive.

 

 

Negative

Number

 

Complement

4-bit
2’s complement

-1

15

1111

-2

14

1110

-3

13

1101

-4

12

1100

-5

11

1011

-6

10

1010

-7

9

1001

-8

8

1000

 

Subtracting 16

What does it mean to subtract 16 from the complement?

Text Box: For improved viewing, click on the equations.  Click again to return viewing to normal. Let’s take 12  16 

 

 

The first thing we notice is 16 in binary is outside the 4-bit format.   We need a higher 4-bit word.

 

 

 

Points to notice.

1.      The lower 4-bit word is unchanged.   Subtracting 1 from 0000 requires “borrowing” a 1 from a even higher 4-bit word.  IMHO a more accurate description would be “begging” since there is no obligation to repay the borrowed 1.

  

2.      Subtracting 1 from a string of 0s produces a string of 1s.  
This happens because    The  represents the overflow.

 

 

 

Performing multiplication when one multiplicand is negative

 

 

 

The correction rule is, “For each negative number in the multiplicand, subtract the other number from the word where the overflow occurs.”

 

 

 

It might look like 235 but subtract 16= 256 and -21 is revealed.

 

Hope you are as delighted as I am to have been shown how to use 2 complement for perform multiplication.

 

 

Why does it work?

 

 

Best wishes,

 

This page should download easily to Windows, Mac and Linux based browsers.                       

If it doesn’t please email the Webmaster

 

More mathematical meandering 

More posts and stories

Return to our home page