Solve simple xor equation

$\begingroup$

I have to solve few simple equation like this: $$ 117 = 86 \oplus x $$ I don't know how to move x to one side and calculate its value. How to do it?

$\endgroup$ 2

3 Answers

$\begingroup$

$$ 117 = 86 \oplus x $$

$$ 86 \oplus 117 = 86 \oplus (86 \oplus x) $$

because $\oplus$ operator is associative , we can write that

$$ 86 \oplus 117 = (86 \oplus 86) \oplus x $$

We know that $a \oplus a=0$ Thus

$$ 86 \oplus 117 = 0 \oplus x $$

We know that $a \oplus 0=0 \oplus a=a$ Thus

$$ 86 \oplus 117 = x $$

As bit process, xor defined as $$ 0 \oplus 0=0 $$

$$ 0 \oplus 1=1 $$

$$ 1 \oplus 0=1 $$

$$ 1 \oplus 1=0 $$

Thus

Now you need to write all numbers in binary expression to do xor logic operation . $$ x= 86 \oplus 117 = (1010110)_2 \oplus (1110101)_2 = (0100011)_2=35 $$ Note that this binary process is equivalent to addition without carry in binary.

Your question remind me the application of XOR operator to recover the data if a hard-disk failure in Raid system.

Please check the example: reference link is here If a drive in the array fails, remaining data on the other drives can be combined with the parity data (using the Boolean XOR function) to reconstruct the missing data. For example, suppose two drives in a three-drive RAID 5 array contained the following data:

Drive 1: 01101101 Drive 2: 11010100 To calculate parity data for the two drives, an XOR is performed on their data:

01101101 XOR 11010100


 10111001

The resulting parity data, 10111001, is then stored on Drive 3. Should any of the three drives fail, the contents of the failed drive can be reconstructed on a replacement drive by subjecting the data from the remaining drives to the same XOR operation. If Drive 2 were to fail, its data could be rebuilt using the XOR results of the contents of the two remaining drives, Drive 1 and Drive 3: Drive 1: 01101101 Drive 3: 10111001 as follows: 10111001 XOR 01101101


 11010100

The result of that XOR calculation yields Drive 2's contents. 11010100 is then stored on Drive 2, fully repairing the array. This same XOR concept applies similarly to larger arrays, using any number of disks. In the case of a RAID 3 array of 12 drives, 11 drives participate in the XOR calculation shown above and yield a value that is then stored on the dedicated parity drive.

$\endgroup$ 2 $\begingroup$

You need to look up the algebraic properties of $\oplus$ and solve this like you would any equation. Note that:

  1. $\oplus$ is associative.
  2. $a \oplus 0=a$
$\endgroup$ 0 $\begingroup$

xor with a number is its own inverse:

$$ (x \oplus y) \oplus y =x \oplus (y \oplus y) = x \oplus 0 = x $$

So you can simply undo the operation on the right.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like