Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Prove that 1 + NOT (1 + NOT x) = x

Дата публикации: 20-08-2026 06:22:37



Основное содержимое страницы с новостью.

Skip to main content
  • Level: Undergrad 
  • Thread starter Thread starter lemonfrostt
  • Start date Start date Aug 18, 2026
lemonfrostt
Messages
7
Reaction score
4
In binary, the two's complement representation of a negative number is found by NOT b + 1, with the leading bit being a sign bit. In general, prove that applying the operation NOT b + 1 twice to some n-bit binary number yields the original number b.

I found this conceptually straightforward but hard to satisfactorily prove. Try it yourself.

The set of n-bit binary numbers under (+) form a cyclic group (g = 1) of order 2n.

b + NOT b = 1-1 (Ones' complement).

Therefore 1 + NOT b = b-1. (b-1)-1 = b.

(b-1 denotes additive inverse.)

Discussion
Science Advisor
Homework Helper
Messages
4,074
Reaction score
2,124
Admin
Messages
69,791
Reaction score
25,647
lemonfrostt
Messages
7
Reaction score
4
Roberto Pavani
Messages
346
Reaction score
172
y=1+NOT(x) ≡ −x (mod ## 2^n##)

1+NOT(y) ≡ −y ≡ x (mod ##2^n##).

Or even better:

T(x)=1+NOT(x) ≡ −x (mod ## 2^n##)
T(T(x)) ≡ −(−x) ≡ x (mod ## 2^n##)

emillindberg
Messages
7
Reaction score
6
The easiest way to see this is to treat n bit numbers as arithmetic modulo 2^n.

For any n bit number b, NOT b changes every 0 to 1 and every 1 to 0. Numerically, that means NOT b = 2^n - 1 - b.

So 1 + NOT b = 2^n - b, which is equivalent to -b modulo 2^n. In other words, NOT b + 1 gives you the additive inverse of b.

Now apply the same operation again. Since the additive inverse of -b is b, we get 1 + NOT(1 + NOT b) = b modulo 2^n.

So taking the two's complement twice always gives you the original n bit number.

Science Advisor
Messages
1,399
Reaction score
1,164
Gavran
Messages
376
Reaction score
257
We can define the function ## f(x)=1+\text{NOT}x ## and prove that ## f^{-1}(x)=f(x) ##.

## \begin{align}
f(x)=1+\text{NOT}x&\implies f(x)-1=\text{NOT}x\nonumber\\
&\implies \text{NOT}(f(x)-1)=x\nonumber\\
&\implies f^{-1}(x)=\text{NOT}(x-1)\nonumber\\
\end{align} ##

For
$$ x=(\sum_{i=0}^{n}x_i10^i)_2 $$
where
## \begin{align}
\text{NOT}x&=(\sum_{i=0}^{n}(1-x_i)10^i)_2\nonumber\\
&=(\sum_{i=0}^{n}1\cdot10^i-\sum_{i=0}^{n}x_i10^i)_2\nonumber\\
\end{align}\\ ##

we have

## \begin{align}
f(x)&=1+\text{NOT}x\nonumber\\
&=(1+(\sum_{i=0}^{n}1\cdot10^i-\sum_{i=0}^{n}x_i10^i))_2\nonumber\\
&=(\sum_{i=0}^{n}1\cdot10^i-(\sum_{i=0}^{n}x_i10^i-1))_2\nonumber\\
&=\text{NOT}(x-1)\nonumber\\
&=f^{-1}(x)\nonumber\\
\end{align}\\ ##

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Is this proof "by contradiction" or "by contrapositive"?07.6612-05-2026
2Interesting math problem that I saw on-line024.2906-10-2026
3Why should we need to re-prove theorems that have been proved already?018.3329-05-2026
4What if 0 is special?01016-09-2026
5Understanding the Reasoning Behind Basic Algebra01024-09-2026
60001-01-1970
70001-01-1970
80001-01-1970
90030-09-2026
10test01002-10-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 19.53. Источник: www.physicsforums.com.