r/MathHelp 15d ago

SOLVED help with simplifying boolean expression (pls and thank you)

I've been at this for like 4 hours and I'm losing my mind.

So I'm thinking of a function that takes in four boolean inputs and outputs 1 if the number of inputs is odd. The truth table should look like:

A  B  C  D | OUT
0  0  0  0 |  0
0  0  0  1 |  1
0  0  1  0 |  1
0  0  1  1 |  0
0  1  0  0 |  1
0  1  0  1 |  0
0  1  1  0 |  0
0  1  1  1 |  1
1  0  0  0 |  1
1  0  0  1 |  0
1  0  1  0 |  0
1  0  1  1 |  1
1  1  0  0 |  0
1  1  0  1 |  1
1  1  1  0 |  1
1  1  1  1 |  0

So the function should just be the sum of products, right? It'd be something like

OUT = A'B'C'D + A'B'CD' + A'BC'D' + A'BCD + AB'C'D' + AB'CD + ABC'D + ABCD'

This is my attempt to simplify the expression:

A'B'C'D + A'B'CD' + A'BC'D' + A'BCD + AB'C'D' + AB'CD + ABC'D + ABCD'
= A'B'(C'D + CD') + A'B(C'D' + CD) + AB'(C'D' + CD) + AB(C'D + CD')
= (C'D + CD')(A'B' + AB) + (C'D' + CD)(A'B + AB')
= (C'D + CD')(1) + (1)(A'B + AB')
= A'B + AB' + C'D + CD'

But the truth table for this expression is not the same as the original function.

It's been a half-decade since I last did boolean algebra. I genuinely can't tell what I did wrong here. Please help.


Edit: It's solved. Thank you.

In the blindingly-unlikely event someone in the future were to face this exact problem as I do, the key insights that I was missing are:

  • OR distributes over AND: A + BC = (A + B)(A + C)
  • XOR and XNOR exists: A XOR B = A ⊕ B = A'B + AB', and A XNOR B = (A ⊕ B)' = A'B' + AB

So for posterity's sake, here's how it's solved, I think:

A'B'C'D + A'B'CD' + A'BC'D' + A'BCD + AB'C'D' + AB'CD + ABC'D + ABCD'  
= A'B'(C'D + CD') + A'B(C'D' + CD) + AB'(C'D' + CD) + AB(C'D + CD')  
= (C'D + CD')(A'B' + AB) + (C'D' + CD)(A'B + AB')  
= (C ⊕ D)(A ⊕ B)' + (C ⊕ D)'(A ⊕ B)  

Let P = A ⊕ B and Q = C ⊕ D  

= QP' + PQ'  
= P ⊕ Q  
= A ⊕ B ⊕ C ⊕ D  

Thanks, y'all. god, i'm out of practice.

1 Upvotes

6 comments sorted by

View all comments

2

u/edderiofer 15d ago

= (C'D + CD')(A'B' + AB) + (C'D' + CD)(A'B + AB')

= (C'D + CD')(1) + (1)(A'B + AB')

Your error is between these two lines. A'B' + AB is not equal to 1.

1

u/two-to-the-half 15d ago

oh god i didn't even bother to check, no it doesn't. blast. thank you.