I wonder if it could be explained any better than the wikipedia article??
The basic problem that you are trying to solve with two's compliment representation is the problem of solving negative integers.
First consider an unsigned integer stored in 4 bits. You can have the following
0000 = 0
0001 = 1
0010 = 2
...
1111 = 15
These are unsigned because there is no indication of whether they are negative or positive.
To store negative numbers you can try a number of things. First, you can use sign magnitude notation which assigns the first bit as a sign bit to represent +/- and the remaining bits to represent the magnitude. So using 4 bits again and assuming that 1 means - and 0 means + then you have
0000 = +0
0001 = +1
0010 = +2
...
1000 = -0
1001 = -1
1111 = -7
So you see the problem there - you have positive and negative 0. The bigger problem is adding and subtracting binary numbers. The circuits to add and subtract using sign magnitude will be very complex.
What is
0010
1001 +
----
?
Another system is excess notation. You can store negative numbers, you get rid of the two zeros problem but addition and subtraction remains difficult.
So along comes twos compliment. Now you can store positive and negative integers and perform arithmetic with relative ease. there are a number of methods to convert a number into twos compliment. Hers one:
convert the number to binary (ignore the sign for now)
e.g 5 is 0101 and -5 is 0101
if the number is a positive number then you are done.
e.g. 5 is 0101 in binary using twos compliment notation.
If the number is negative then
3.1 find the compliment (invert 0's and 1's)
e.g. -5 is 0101 so finding the compliment is 1010
3.2 Add 1 to the compliment
1010 + 1 = 1011
Therefore -5 is 1011 in binary using twos compliment notation.
So what if you wanted to do 2 + (-3) in binary? 2 + (-3) is -1.
What would you have to do if you were using sign magnitude to add these numbers? 0010 + 1011 = ?
Using twos compliment consider how easy it would be.
2 = 0010
-3 = 1101 +
and the answer is 1111
Converting 1111 to decimal we
- The number starts with 1 so its negative so we find the compliment = 0000
- Add 1 = 0001
- Convert to decimal = 1
4 Apply the sign = -1
Tada!