Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve for $b$, however, I am not sure if I am approaching this problem correctly:

$a \mathbin{\oplus} b = b-a $

I thought that it would be possible to try to remove the XOR, and rewrite it in terms of AND and OR, however, it does not appear to solve the problem.

Is it possible to solve this problem?


$\mathbin{\oplus}$ is XOR

$ - $ is minus(subtraction)

share|cite|improve this question
Precisely thise $b$ with $b=b|a$ solve this. – Hagen von Eitzen Aug 10 '13 at 16:49
What's the $-$? – xavierm02 Aug 10 '13 at 16:52
$-$ is subtraction – Artem Aug 10 '13 at 16:56
up vote 3 down vote accepted

$a \oplus b = b - a$

$a \oplus b = a + b - 2 \cdot (a \wedge b)$

$a + b - 2 \cdot (a \wedge b) = b - a$

$2 \cdot a = 2 \cdot (a \wedge b)$

$a = a\wedge b$

(works forwards or backwards)

So, $b$ can be anything as long as it has all of $a$'s bits set.

share|cite|improve this answer
Thank you, @Dan Brumleve! – Artem Aug 10 '13 at 17:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.