1
$\begingroup$

I have an equation like this: $(i_1 \cdot x) \oplus (i_2 \cdot x) = r$ where $i_1, i_2,$ and $r$ are known values and $\oplus$ is xor.

What I need is that same equation but expressed as $i_3 \cdot x = r$ where $i_3$ should incorporate both $i_1$ and $i_2$ in some way

By doing some tests with random values for $x$, I ended up finding that doing $(i_1\cdot x) \oplus (i_2 \cdot x)$ is the same as doing $x \cdot (i_1 \oplus i_2) + \text{remainder}$.

I got this from the distributive property which says that $a\cdot x + b\cdot x = x(a+b)$ but this doesn't seem to work with the $\oplus$ operator.

The workaround with the remainder doesn’t work for me because it adds a second unknown to the equation which I can't even predict.

Is there another way to do this or something I missed?

$\endgroup$
2
  • $\begingroup$ i1, i2 and r are "known values"... of what type of thing? $\endgroup$
    – 311411
    Commented Apr 29, 2021 at 19:28
  • $\begingroup$ It doesn't matter, could be integers. At least that's what I used for my tests. $\endgroup$
    – notsagg
    Commented Apr 30, 2021 at 7:07

1 Answer 1

0
$\begingroup$

The distributive law $(a \oplus b)x = ax \oplus bx$ holds. Indeed \begin{align} ax \oplus bx &= ax(bx)' + (ax)'bx \\ &= ax(b' + x') + (a' + x')bx \\ &= axb' + axx' + a'bx + bxx'\\ &= ab'x + a'bx\\ &= (ab' + a'b)x\\ &= (a \oplus b)x \end{align}

The counterpart for sets is that intersection distributes over symmetric difference.

$\endgroup$
2
  • $\begingroup$ Exactly what I needed, thanks. Do you know what happens now if we add a third item (lets say cx) to ax ⊕ bx, meaning ax ⊕ bx ⊕ cx. I guess this can't be equal to (a ⊕ b ⊕ c)x, or can it? But does this mean that (ax ⊕ bx) ⊕ cx = ax ⊕ (bx ⊕ cx)? $\endgroup$
    – notsagg
    Commented May 11, 2021 at 17:02
  • $\begingroup$ You're welcome. The answer to your two further questions is yes. Actually, $\{0, 1\}, \oplus, \cap)$ is a ring. $\endgroup$
    – J.-E. Pin
    Commented May 11, 2021 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .