Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

EDIT:

$\mathbin{\oplus}$ is XOR

$ - $ is minus(subtraction)

share|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

1 Answer 1

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|improve this answer
    
Thank you, @Dan Brumleve! –  Artem Aug 10 '13 at 17:17

Your Answer

 
discard

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.