Skip to content
BetterDL

De Morgan's laws

Also called: De Morgan, DeMorgan, De Morgan's law, De Morgan's theorem, DeMorgan's laws, DeMorgan's theorem, break the bar

The rules (AB)' = A' + B' and (A + B)' = A'B': to complement an AND or an OR, complement each part and swap AND with OR.

De Morgan's laws tell you how to remove a bar that covers a whole AND or OR:

  • =
  • =

The memory aid is break the bar, change the sign. Cut the long bar into short bars, one over each piece, and swap AND with OR. Always both moves.

Why the sign has to change. AND asks "are all of them 1?" The opposite of "all are 1" is "at least one is 0", which is an OR question. Likewise, the opposite of "at least one is 1" is "all are 0", an AND question. In everyday words: "not (rain or snow)" means "no rain and no snow".

The laws extend to any number of pieces, = , and to whole blocks. For something like , treat each product as one piece and break only the outermost bar first: = .

Where they show up: finding the complement of a function, turning SOP circuits into NAND-only circuits, bubble pushing, and tidying if conditions in code, where !(a && b) equals !a || !b.

001111
011100
101100
110000

Worked examples

Example

Three letters with a bar already inside

Remove the long bar from .

  1. 1.

    Break the bar and change every AND to OR: .

  2. 2.

    Two bars on B cancel (involution): = B.

  3. 3.

    Result: .

  4. 4.

    Check row 101, the only row where = 1: = 0 + 0 + 0 = 0, the opposite, as it should be.

Example

Brackets first, then break

Complement .

  1. 1.

    Bracket each product under the bar and break only the outer bar: .

  2. 2.

    Break each inner bar: = and = .

  3. 3.

    Result: . The brackets are essential.

  4. 4.

    Check A = B = 1: the original is 1, and = 0.

Common mistakes

  • Breaking the bar without changing the sign: = is wrong. is 1 only in row 00, while is 1 in three rows.

  • Changing the sign without breaking the bar, or breaking only part of it.

  • Losing the grouping: complementing as instead of .

  • Forgetting that a letter already barred ends up with two bars, which cancel.

Practice De Morgan's laws

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

De Morgan's laws is taught in Boolean Algebra and Logic Gates.