-1

Is it possible to simplify this boolean algebra? I want to remove the redundancy of using twice the X variable, but can't seem to see a way how.

(X AND Y) OR NOT(X AND Z)

Thanks in advance!

jlast
  • 391
  • 1
  • 15
  • 1
    I'm voting to close this question as off-topic because it is about boolean logic / [math.se] instead of directly about programming or software development. – Pang Jun 20 '16 at 06:26

3 Answers3

2

It's equivalent to

(X AND Y) OR (NOT X OR NOT Z)

which is equivalent to

(X AND Y) OR NOT X OR NOT Z

which is equivalent to

(X OR NOT X OR NOT Z) AND (Y OR NOT X OR NOT Z)

which is equivalent to

(TRUE) AND (Y OR NOT X OR NOT Z)

(since X or NOT x == true and TRUE OR Z == true)

which is equivalent to

Y OR NOT X OR NOT Z

You can also use a K-map to find an equivalent logical expression, but those are harder to type :)

D Stanley
  • 149,601
  • 11
  • 178
  • 240
1

This is equal to !(X and !Y and Z).

You could also have the formula (!X or Y or !Z)

You could confirm the answers in http://www.wolframalpha.com/input/?i=%28X+AND+Y%29+OR+NOT%28X+AND+Z%29

Elye
  • 53,639
  • 54
  • 212
  • 474
1

In the Karnaugh map, you can see that your expression is indeed equivalent to a sum of three single-literal terms:

not x or y or not z    

             yz
       00  01  11  10
      +---+---+---+---+
   0  | 1 | 1 | 1 | 1 |
x     +---+---+---+---+
   1  | 1 | 0 | 1 | 1 |
      +---+---+---+---+

As pointed out by Elye, the single 0 can be expressed as an inverted term with three inputs:

not (x and not y and z)
Axel Kemper
  • 10,544
  • 2
  • 31
  • 54