Array
University of Oregon

De Morgan’s Laws

Review: Logic Operators (MDN).

In Boolean Algebra:

De Morgan’s laws are a pair of transformation rules:

neg (Pland Q)iff (neg P)lor (neg Q),

and

neg (Plor Q)iff (neg P)land (neg Q),

In Plain English:

The statements “I don’t like chocolate or vanilla” and “I do not like chocolate and I do not like vanilla” express the second rule, above.

Your turn: Express the first rule in English.

In Javascript:

!(x && y) == (!x || !y)

and

!(x || y) == (!x && !y)

Applications:

De Morgan’s Laws can be used to simplify logical expressions in computer programs:

True & False in JavaScript

To test the truth value of any expression e:  !!e

Skip to toolbar