# Representing two's compliment

• Nov 14th 2010, 07:48 AM
Jodles
Representing two's compliment
Can I write that the two's compliment of an 8-bit binary number, $n$ is:
$-n=\bar{n}+1$ ?

Or is that simply wrong notation? Is there a correct way of showing this?
• Nov 14th 2010, 09:41 AM
chisigma
Let $n$ a numer represented by $N$ bits and suppose to indicate with $\bar{n}$ the numer obtained by $n$ complementing each of its bit. Is...

$n+\bar{n}= 2^{N}-1 \implies \bar{n} +1 = (2^{N} - n)\ mod(2^{N})= -n$ (1)

... so that Your notation is correct...

Kind regards

$\chi$ $\sigma$