Convert from signed magnitude to twos complement
It would have been helpful if you'd tried to explain to us what you imagine is meant by "x=1111001 in signed magnitude," for example. It would have gone a very long way in our understanding of your understanding of the problem. And this would have helped a lot in being able to help you better.

If you do continue to find questions you'd like some help with, please try and add your own thinking about it. Not just, "I can't find an answer on the internet." But more like, "I can't find an answer on the internet, but this is what I think I know right now and here is where that took me with this problem ..."

Write more about how you think about the problem.



A signed-magnitude number is much like what you are used to with decimal numbers in early schooling. The values of +10 and -10 are in signed magnitude form, for example. You state the magnitude and then you add a sign to it. So "signed magnitude." Nothing magical.

When a number is expressed in binary, rather than decimal, the first problem is to learn how to express the binary value itself. So the value of 10 decimal, in binary, is 1010. That's the binary magnitude. Now, you could just write +1010 or -1010 and you'd have signed magnitude, but in binary.

However.... binary doesn't have + or - as available symbols. So, you have to invent a way. Usually the binary symbol '0' is selected for + and the binary symbol '1' is selected for '-'. (You could reverse that. But then you'd be changing the usual tradition.) So the signed magnitude for +10 and -10 (decimal) could be 01010 and 11010, using the leading bit for the "sign." Do you see how easy that is?

So, now let's take "x=1111001 in signed magnitude" and work that out. In this case, assuming the leading bit is the sign (an assumption I have to make but one that you might have been able to clarify in your question), then this is \$x=-111001\$. Since \$111001_2=57_{10}\$, then this is -57 in signed decimal notation. You could have added this to your question, if you knew it already, or else explained to us that you couldn't figure that out.



Now the question remains, what is -57 in twos-complement notation. Of course, you have to understand what twos-complement is. Clearly, it's not signed magnitude notation!!

What twos-complement does is to totally invert the meaning of all the bits if the number's sign is negative. This is radically different from signed magnitude, which leaves the rest of the bits alone regardless.

A Wiki page to read is Method of Complements. It's not exactly what you may be looking for right now. But it will help you to read through it, closely.

There is ones-complement which is just an inversion of all the bits when the number is negative. But it has a few problems. One is that the number +0 and -0 use separate symbols in the ones-complement symbol space. Since people usually do NOT need to have both +0 and -0, there is a desire for a system which makes it impossible to add a sign to 0. Also, for electronic equipment it turns out that twos-complement not only solves this "zero problem" but is also very easy to implement and use in hardware, too. Much easier than using signed magnitude notation.

Many of the earlier computers did use signed magnitude notation. But it disappeared over time as the ease, speed, smaller size, lower cost, and lower dissipation of hardware implementations made the point clear to everyone.

Twos-complement is made by first inverting all the bits and then adding 1 to the result. You do have to start with an extra bit, though. So the decimal number +10 would be 01010 (which is the same as it would be with signed magnitude.) But the decimal number -10 would be 10110, in twos-complement. Note here that I inverted 1010 to 0101, first, then added one to that to get 0110. Then the sign bit of '1' (to indicate negative) is prefixed to make 10110.

Suppose you add +10 to -10, now?

    01010
  + 10110
  ========
  1 00000


The result is 00000, as expected, but with a carry out to the left there. But the main thing to notice is that adding the two values gets the right answer.

It turns out that this works over a very wide range of input values. There still is the possibility of overflow. But otherwise, the results are always right.

So to convert -57 to twos-complement, you first take the magnitude of 57 in binary (which you were already given as 111001.) (You remove the sign bit, for now.) Then invert all the bits, to get 000110. Then you add one, getting 000111. Now prefix the '1' to this to make it negative, so the result is 1000111.

(You could also simply start with the sign bit being '0', by over-riding the '1' you already had with signed-magnitude, and follow the same process except without prefixing the '1' since it would magically work out correctly, anyway. So 0111001 gets inverted to 1000110 and then you add 1 to get 1000111. Same answer, different method.)

Now, test it. Add 57 to -57:

    0111001      (+57)
  + 1000111      (-57 in twos-complement)
  =========
  1 0000000


Yup. Works out to zero. Good thing.



Since \$x\$ was already negative, asking about \$-x\$ is nothing more than asking for the binary value of positive 57. You already know what that is. Except, of course, you need to make sure to include the '0' for the sign of + as an extra bit to the left. (As shown in the worked sum, just above.)