# x is 0 if any two of the three variables are 1. x is 1 for all other conditions. Write the boolean expression for the condition.

### 1 Answer | Add Yours

To start off, we're going to need to name some variables. We already know x is the output, but let's assign our inputs to A, B, and C.

We know that X = 0 if two of A, B, or C are 1. This gives us the following equation:

`barX = AB + BC + AC`

Considering that each other case gives us X=1, we can simply "not" both sides of the equation:

`X = bar(AB+BC+AC)`

Now, we can simplify this by De Morgan's Theorem:

`X = (barA+barB)(barB + barC)(barA+barC)`

Let's distribute:

`X = (barAbarB + barAbarC+barBbarB + barBbarC)(barA+barC)`

We can actually significantly reduce that first parentheses. Note that `barBbarB = barB` and that `Y+YZ = Y` (because if the first condition is true, the whole condition will be true, regardless of the second condition!). Therefore, we can get rid of `barAbarB` and `barBbarC` in the first expression:

`X = (barAbarC + barB)(barA+barC)`

Now, we distribute again:

`X = barAbarAbarC + barAbarCbarC + barAbarB + barBbarC`

Now, we can reduce the above to:

`X = barAbarC + barAbarB + barBbarC`

So, that is how you algebraically get from `barX` to `X`. Granted, you could have said, "Well, if any two being 1 means X=0, then I need two to be false," immediately leading to the above expression. However, often it is more complicated! So, I showed you the general way, which almost always involves DeMorgan's Law.

Hope that helps!

**Sources:**