So let's take for an example the case of 4 bits.

So we know there are 16 possible value there and what we done so

far we manage, we, we presented the integers between 0 and 15.

All 16 numbers of them using the 4 bits.

In general, so far if we had N bits.

We try, we use them to represent the positive integers between 0 and

2 to the N minus 1.

If we want to represent negative numbers, we will need to give up part

of these 16 possibilities in order to represent negative numbers.

So maybe eight of them will be positive and eight of them will be negative or

something like that.

So how can we do that?

Well the simplest thing you may consider and it was used at sometimes

was to basically take the first bit and use it as a sign bit.

And then you remain, you have three more bits or

n minus 1 more bits in general to represent the actual number.

So this way, if it starts with 0, it's going to be just positive numbers.

If the first bit is 1, then the next three bits, and

it's going to be a negative number, that is represented by the next three bits.

In this case, we can represent 0, 1, 2, all the way up to 7.

And then, negative 0, negative 1, all the way up to negative 7.

So, this would be one possibility of representing negative numbers.

A possibility that is not very popular.

Why?

There are a bunch of problems with it.

One thing that you may immediately notice, this is very inelegant.

We have negative 0.

What is this negative 0 and why is it different than 0.

What we learned in math was that 0 equals negative 0.

So of course,

we may in principle decide to have two representations of 0 in our computer, but

that is inelegant and probably means that there's going to be prob, trouble.

Usually, if you have something that's not elegant, it's going to bite you.

And in fact here, if you actually try to manipulate these kind of negative numbers.

Using some kind of hardware, you'll get into trouble.

You'll need to explicitly deal with pluses and minuses, and

the whole thing will be a mess.

So hardly anyone uses thispossi, this anyti, anymore.

Here is what people use instead.

They use a system called 2's complement, and it has a very simple idea.

If you want to represent a negative number, negative x, you just instead

repre, use, repre, represent a positive number, 2 to the n minus x.

In our case of 4 bits, 16 minus x.

Which is going to be a num, a positive number and

you are going to present it like we've seen so far.

So, for example, in our case here are the numbers.

You have 0, 1, 2, all the way up to 7 as usual.

Now, if you want to represent, let's say negative 3.

Well you represent negative 3 by the integer 16 minus 3,

which is 13, so if you look at the place 1101,

which is really the binary number 13, the value of that is negative 3.

So this is basically the table that we have so far, and

this system is called 2's Complement representation.

So let's look what we get in this representation.

First of all, the positive numbers that we have are half of what we previously had.

Basically, we're missing a bit, so we can represent on that the numbers up to 2 to

the n minus 1, but rather up to 2 to the n minus 1, all that minus 1.

The negative numbers, in this system, we get one more of them.

So we get all of the negative numbers between negative 1 and

negative 2 to the n minus 1.

And in our case, we get the negative numbers between negative 1 and negative 8.

But we get only the positive numbers between 0, 1 and 7.

And of course we have the 0 as usual.

So the main thing that's nice about this trick is that we

will basically get our addition and subtraction and

almost all the operation that we need to do with numbers almost for free.