Press 3 − 5 on a phone calculator and the screen says −2. Inside the chip there is no minus key and no minus wire. There is a row of switches, each one on or off, and that is all the machine has. Somebody had to decide how eight switches can mean "minus five", and the decision had to let one adder circuit (the part that adds two numbers) handle plus and minus alike. This lesson is that decision, and the exam questions that test it.
By the end you will write a number in 8-bit sign-magnitude, 1's complement and 2's complement, see in one picture why "invert and add 1" works, read a pattern back, subtract by adding, tell overflow from carry, and tell a signed byte from an unsigned one, then watch a C compiler do exactly that. When we need a width it is eight bits; every other width follows the same rules.
We go in four parts: two ways of writing a minus sign that turn out to be clumsy (sign-magnitude and 1's complement); 2's complement, the way every computer does it; subtraction and overflow; and one pattern read as signed or unsigned, in C.
Why it matters: Papers ask about negative numbers in three ways. A conversion: give the 2's complement of a binary or hex number. A reading: what 1111 1111 or 1000 0000 means, or what one byte could be. And a judgement: which method computers use, which sum overflows, whether signed numbers need more memory. Written papers ask you to describe how a computer represents negative numbers, and whether signed and unsigned numbers affect memory. One of them also asks about BCD, EBCDIC and ASCII; that half is taught in Data Representation: BCD, ASCII and Unicode.
Question (Bangladesh Bank — Assistant Director (ICT) — Exam: 07.02.2025 (DU)): What is the 2's complement of (65)16 number?
a) 10011011
b) 10011010
c) 00011011
d) 10011100