Math Fundamentals18 sections · 814 units
Open in Course

De Morgan's Laws

Negating complex expressions

De Morgan's Laws show how to negate AND and OR expressions. Named after Augustus De Morgan, who formulated them in the 1840s.

First law: ¬(AB)=¬A¬B\neg(A \land B) = \neg A \lor \neg B. In code: !(a && b) equals !a || !b. Negate an AND by negating each part and changing AND to OR.

Second law: ¬(AB)=¬A¬B\neg(A \lor B) = \neg A \land \neg B. In code: !(a || b) equals !a && !b. Negate an OR by negating each part and changing OR to AND.