The Boolean Algebra XOR Problem: Are These Expressions Equivalent?

Click For Summary
SUMMARY

The discussion centers on the equivalence of two Boolean expressions: a ⊕ ab ⊕ ac and a ⊕ b ⊕ c. The user attempts to simplify the first expression but struggles to reach the book's answer. Key insights reveal that building a truth table shows the two expressions yield different results, particularly when ABC = 0,1,0. The correct operator precedence for languages like C, Java, and JavaScript is established as NOT > AND > XOR > OR, which is crucial for accurate simplification.

PREREQUISITES
  • Understanding of Boolean algebra and its laws
  • Familiarity with XOR, AND, and OR operations
  • Knowledge of operator precedence in programming languages
  • Ability to construct and interpret truth tables
NEXT STEPS
  • Learn how to construct truth tables for complex Boolean expressions
  • Study Boolean algebra laws, particularly the Distributive Law and De Morgan's Theorems
  • Explore operator precedence in programming languages like C, Java, and JavaScript
  • Practice simplifying Boolean expressions using algebraic techniques
USEFUL FOR

Students of computer science, software developers, and anyone interested in mastering Boolean algebra and its applications in programming and logic design.

Rectifier
Gold Member
Messages
313
Reaction score
4
The problem
This is not a complete homework problem. I am at the last step of the solution to a long problem and only interested to know whether these following expressions are equivalent.

My answer:
## a \oplus ab \oplus ac ##

Answer in my book:
## a \oplus b \oplus c ##

The attempt
I have tried rewriting that expression and get
## a \oplus ab \oplus ac = a \oplus a(b \oplus c) ##

I am not advancing any longer from there. I am surely missing some algebraic law for boolean expressions. Could you please help me?
 
Physics news on Phys.org
Did you try building a truth table?
If you do you'll see that your answer is different from the book's answer.
For example ABC = 0,1,0
The book answer gives 1
Your answer results in 0
 
  • Like
Likes Rectifier
Part of your problem may be your understanding of operator precedence.

It seems to vary slightly across programming languages. For C, Java and Javascript it is:

NOT > AND > XOR > OR

a XOR ( a AND b) XOR ( a AND c)

with XOR equivalent to:

x XOR y = (x OR y) AND (NOT ( x AND y) // mentor note: fixed the expression (thx cpscdave)

reworking the second and third terms should get you to the goal.
 
Last edited:
  • Like
Likes Rectifier
Well, I guess I am doing something wrong then. :/ Thanks for the help.
 
jedishrfu said:
x XOR y = (x OR y) AND (NOT ( x OR y)

Think you mean
(x OR y) AND [NOT ( x AND y)]

or alternatively

(x OR y) AND ( NOT x or NOT y)
 
Yes you are right my apologies.

I got my up and down arrows confused in my conversion to ands and ors.

I fixed my post.
 
  • Like
Likes cpscdave
a ⊕ b ⊕ c does have a rather interesting truth table.
 
Rectifier said:
My answer:
## a \oplus ab \oplus ac ##

Answer in my book:
## a \oplus b \oplus c ##

The attempt
I have tried rewriting that expression and get
## a \oplus ab \oplus ac = a \oplus a(b \oplus c) ##

I am not advancing any longer from there. I am surely missing some algebraic law for boolean expressions. Could you please help me?
I would proceed by converting one XOR at a time to its equivalent in AND and OR, starting with this:

## \mathrm {a \oplus ab \oplus ac = a (\overline {ab \oplus ac }) + \overline a (ab \oplus ac)}##
 

Similar threads

Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
Replies
4
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K