HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Can OR be "undone"?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
undonecanstackoverflow

Problem

Suppose that $Z = X \vee Y$, where $X$, $Y$ and $Z$ are 96-bit binary numbers. If I'm given the values of $Z$ and $Y$, is it possible to work out what $X$ is?

I know this is possible with XOR but can it be done with OR?

Solution

It is easy to find out that there can be more than one value, used as $X$, to satisfy $Z = X \vee Y$. When a specific bit of $Y$ is $1$, there are two possibilities for such bit in $X$, i.e., $0$ or $1$.

Let's make a simple example with a 2-bit number:

$Y$ = $10$ and $Z$ = $11$

The possible values of $X$ are:

  • $11$



  • $01$



because:

  • $11 \vee 10 = 11$



  • $01 \vee 10 = 11$



In short, you don't have the certainty that the end result of the reverse operation of $\vee$ will be a unique result.

Context

StackExchange Computer Science Q#48422, answer score: 7

Revisions (0)

No revisions yet.