-4

I have been given a number Y which is ($a$ xor $b$ xor $c$ xor $d$ xor $e$ ) of some numbers ($a$,$b$,$c$,$d$,$e$) and another no X. Now i have to determine if X is a xor combination of ($a$,$b$,$c$,$d$,$e$)

e.g - ($a$ xor $d$) , ($b$ xor $c$ xor $e$) , ( $a$ xor $e$ )

What i know clearly is that lets say X= ($b$ xor $d$) , Now if I xor X and Y i get ($a$ xor $c$ xor $e$), (as $b$ xor $b$=0 ) and if it was some number not a xor combination (say $p$ ) then i would have got ($a$ xor $b$ xor $c$ xor $d$ xor $e$ xor $p$)

Is there a method to determine perfectly?

  • You are given $a,b,c,d,$ and $e$ too, right? So how is $Y$ relevant here? – TonyK Jul 06 '19 at 13:23
  • @TonyK because 0's and 1's tally parity within the set, a,b,c,d,e we only need to check sets Y could have came from given X and compare. –  Jul 06 '19 at 21:17
  • @RoddyMacPhee: I can't make sense of that. Is it your opinion that $a,b,c,d,e$ are not given? – TonyK Jul 06 '19 at 21:59
  • Y is enough to reconstruct all possibilities if the full xor was done. the other values are only useful to compare with what X suggest to see if it's possibly correct. –  Jul 06 '19 at 22:24
  • @RoddyMacPhee: Your interpretation of the question is diametrically opposed to mine. But this is Gohma's fault, not yours. Gohma, help us out here. – TonyK Jul 07 '19 at 01:11
  • I get the confusion, X and Y(a xor b xor c xor d xor e) are given as decimal numbers. There are two cases..If X was made using a XOR combination of (a,b,c,d,e)....or X is some totally different number. I can solve this by making all possible XORed combination of (a,b,c,d,e) and checking if any matches with given X. If it matches then it means that X is a XORed combination of (a,b,c,d,e) otherwise it's some different number. Problem is how to do it faster, I was wondering if could use some boolean property to deduce that –  Jul 07 '19 at 03:22
  • Oh heavens. Gohma, do you know $a,b,c,d,e$ or don't you? – TonyK Jul 07 '19 at 10:06

1 Answers1

1

Yes, there is a systematic method, but it requires some knowledge of vector spaces over a field other than the real numbers.

Suppose your numbers are $n$ bits long. If we express such a number in binary and list the bits in a vector, we have a vector of length $n$ with coordinates which are all either zero or one. The xor operation applied to two of these vectors corresponds to vector addition in $F_2^n$, the vector space of vectors of length $n$ over the finite field $F_2$ with two elements, zero and one.

If we arrange the $a,b,c,d$ and $e$ vectors as columns in a matrix, we have an $n$ by 5 matrix $A$. $X$ is an xor combination of $(a,b,c,d,e)$ if $A y= X$ has a solution, i.e. $X$ is in the column space of $A$. The usual way to determine if $X$ is in the column space is to adjoin $X$ to $A$ to form an $n$ by 6 matrix $(A | X)$ and then perform row operations on that matrix to reduce it to echelon form. You can find an example of how this works when the vector space is over the real numbers instead of $F_2$ in the answers to this question: How to determine if vector b is in the span of matrix A The method is the same when the field is $F_2$, you just have to remember to perform all the arithmetic in $F_2$ instead of in the real numbers.

awkward
  • 15,626