user6506263
user6506263

Reputation:

Boolean Algebra - How to Simplify

Working in JS and just started learning about boolean algebra. Wondering if there is a way to simplify this expression:

(!variableOne || !variableTwo)

I recall hearing something about how two 'nots' means you can change the sign, but I'm not seeing much about this when I google 'boolean algebra'.

Thanks!

Upvotes: 0

Views: 835

Answers (3)

user6490462
user6490462

Reputation:

Late answer but to put further explanation:

  • The negation of an and statement is logically equivalent to the or statement in which each component is negated.

Symbolically: !(A && B) = !A || !B

  • The negation of an or statement is logically equivalent to the and statement in which each component is negated.

Symbolically: !(A || B) = !A && !B

In your case you had used !variableOne || !variableTwo so it's equivalent to the first Law !(variableOne && variableTwo) == !variableOne || !variableTwo.

Upvotes: 0

FrontTheMachine
FrontTheMachine

Reputation: 526

As the De'Morgans Law says, you can transform !a || !b in !(a && b)

so you can have !(variableOne && variableTwo)

Upvotes: 1

Nina Scholz
Nina Scholz

Reputation: 386634

You could take De Morgan's laws:

!(a && b) = !a || !b 
!(a || b) = !a && !b

In your case it is

!(variableOne && variableTwo)

Upvotes: 2

Related Questions