Question on proving !A & B || A & !B = A XOR B

1k Views Asked by At

I do apologise if this question has been asked before, but I am having trouble trying to get from !A & B || A & !B to A XOR B.

I've tried doing it in reverse by starting with A XOR B ((A || B) & !(A & B)), and I reached (A || B) & (!A || !B) and !((!A & !B) || (A & B)) using 2 different paths, and I know that the results of the 2 paths are the same because of the de morgan's law, yet I just can't figure out how to get to !A & B || A & !B.

EDIT: Just thought I'd explain my use of symbols. I'm not familiar with MathJax, and while I could use the proper symbols of ¬, ∧, ∨, it's just easier for me to type !, &, ||.

2

There are 2 best solutions below

0
On BEST ANSWER

I will use notations you used for your comfort..These are used in programming, not on logics and mathematics (as far as I know).

We will start from A XOR B = (A || B) && (!A || !B) which you have already found. The trick is to add terms such as (A || !A) where it does not change value of logic.

(A || B) && (!A || !B) = ((A || B) && (!B || B)) && ((!A || !B) && (!A || A))

For the first term, ((A || B) && (!B || B)) = (A && !B) || B.

For the second term, ((!A || !B) && (!A || A)) = !A || (!B && A).

Combining these two gives ((A && !B) || B) && ((A && !B) || !A). By simple boolean algebra you may see this is equal to (A && !B) || (B && !A), which you wanted.

0
On

It took me a while but I also realised I could just use the distributive law by expanding:

(A || B) && (!A || !B)

((A || B) && !A) || ((A || B) && !B)

!A & A || !A & B || !B & A || !B & B

then complement law and identity law:

FALSE || !A & B || !B & A || FALSE

!A & B || !B & A

However, I marked Gratus's solution as the accepted answer as it actually encouraged me to think about how to add terms without changing the value.