1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Boolean algebra - XOR

  1. Sep 23, 2016 #1


    User Avatar
    Gold Member

    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?
  2. jcsd
  3. Sep 23, 2016 #2
    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
  4. Sep 23, 2016 #3


    Staff: Mentor

    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: Sep 23, 2016
  5. Sep 23, 2016 #4


    User Avatar
    Gold Member

    Well, I guess I am doing something wrong then. :/ Thanks for the help.
  6. Sep 23, 2016 #5
    Think you mean
    (x OR y) AND [NOT ( x AND y)]

    or alternatively

    (x OR y) AND ( NOT x or NOT y)
  7. Sep 23, 2016 #6


    Staff: Mentor

    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.
  8. Sep 23, 2016 #7


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    a ⊕ b ⊕ c does have a rather interesting truth table.
  9. Sep 25, 2016 #8


    User Avatar

    Staff: Mentor

    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)}##
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted