-3

I'm just learning boolean algebra at the moment. I read that for XOR we can rearrange the expression

  1. (A + B) . ¬(A + B)

  2. = A.¬A + A.¬B + B.¬A + B.¬B

  3. = A.¬B + B.¬A

I can understand this but I'm unsure how I would proceed multiplying out an expression like

  • (A + B) . (¬A + ¬B).

If I just try and naively multiply out all the terms that will bring me to the same result as XOR but the truth table is different. What are the rules on multiplying out negated terms?

Carl Smotricz
  • 66,391
  • 18
  • 125
  • 167
Martin Smith
  • 438,706
  • 87
  • 741
  • 845

5 Answers5

3

Your first expression isn't an xor, try making this substitution:

 Z = A+B 
klochner
  • 8,077
  • 1
  • 33
  • 45
  • I don't know what good the substitution would do, but I believe you're right about the first expression not being an XOR. – Carl Smotricz Dec 16 '09 at 19:24
  • what do you get when you make the substitution in the first expression? – klochner Dec 16 '09 at 19:26
  • (It just makes the truth value more obvious) – klochner Dec 16 '09 at 19:32
  • 1
    Ah, I see... you're demonstrating that (1) is always false. Yep, that could be part of the problem. – Carl Smotricz Dec 16 '09 at 19:33
  • 1
    Well spotted. That is actually a typo in the book I'm using I think. He originally states it as (A + B) . ¬(A.B) but then proceeds to start with (A + B) . ¬(A + B) in the multiplying out example. – Martin Smith Dec 16 '09 at 19:33
  • OK. Using De Morgan (A+B). ¬(A.B) = (A+B).(¬A+¬B) and I can follow the multiplication out from there. Maybe the author quietly used De Morgan without specifying it and just took it as read the equivalence would be apparent. The book doesn't actually use the ¬ symbol but rather a continuous bar over the whole second A+B expression that I couldn't figure out how to reproduce here. Maybe I misinterpreted that as equivalent to ¬(A+B) in my attempted ASCII translation. – Martin Smith Dec 16 '09 at 20:01
  • 1
    sounds like a typo to me. \bar{(A+B)} == ¬(A+B) – klochner Dec 16 '09 at 20:06
  • Thanks. It all makes more sense now! – Martin Smith Dec 16 '09 at 20:23
2

You can throw this kinda thing at Wolfram Alpha. Here's what I did:

http://www.wolframalpha.com/input/?i=truth+table+(a+or+b)+and+(not+a+or+not+b)

Please click on the link to view the results! Does that truth table look like what you thought it should, or not?

Carl Smotricz
  • 66,391
  • 18
  • 125
  • 167
1

You think the truth table is different?

Try evaluating it yourself.

Anon.
  • 58,739
  • 8
  • 81
  • 86
  • Doh! I'm not sure how I convinced myself that they were different. So basically it should never make any difference then if the negation applies to the whole bracketed expression or individual component(s)? – Martin Smith Dec 16 '09 at 19:25
  • 1
    Oh no, big diff. That's what DeMorgan is all about. If you move the 'not' into the parentheses, you have to invert the conjunction inside the parentheses. – Carl Smotricz Dec 16 '09 at 19:27
  • Yes I had thought that I had got myself into trouble with doing something like that earlier. I'll try and revisit that example with the help of Wolfram Alpha! – Martin Smith Dec 16 '09 at 19:38
1

You need DeMorgan's Law

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226
0

Answers here are not clear to me. I believe there's a typo in how you typed #1. It is a contradiction:

  1. (A + B) * -(A + B)
  2. (A + B) * -A * -B
  3. -A * -B * A + -A * -B * B
  4. 0

If #1 were (A + B) * (-A + -B) instead:

  1. (A + B) * (-A + -B)
  2. -A * (A + B) + -B * (A + B)
  3. -A * A + -A * B + -B * A + -B * B
  4. -A * B + -B * A

That's how you distribute AND over OR.

Chris Drake
  • 353
  • 1
  • 7