Skip to content
BetterDL

Complement

Also called: complementation, logical negation, Boolean negation, inverse, NOT operation, logical NOT, Boolean NOT, A bar, A prime, complement notation

The NOT of a value or expression: 1 becomes 0 and 0 becomes 1. Written with a bar, typed with a prime, as in A'.

The complement of A, written ("A bar" or "A prime"), is its opposite: 1 when A = 0, and 0 when A = 1. It is the NOT operation, and in a circuit it is a not gate (an inverter).

You can complement a whole expression too. is 1 on exactly the rows where is 0. The complement of a function F is written F′; see complement of a function.

Notation varies between books: A̅, A′, ¬A, ~A and !A all mean the same thing. This course draws a bar and types a prime.

Finding the complement of an expression takes de morgans laws: swap AND with OR and complement every literal, keeping the grouping. For the complement is .

Key facts:

0010
0101
1001
1110

Worked examples

Example

Complementing an SOP

Find the complement of .

  1. 1.

    Bracket the product and break the outer bar: .

  2. 2.

    Break the inner bar: = = .

  3. 3.

    Result: .

  4. 4.

    Check A = 0, B = 0, C = 0: the original is 0 + 1 = 1, and = 1 · 0 = 0. Opposite, as required.

Example

Complement of XNOR

The table above shows (1 when A and B are equal) and its complement.

  1. 1.

    The complement is 1 exactly when A and B differ.

  2. 2.

    That is XOR: .

  3. 3.

    So complementing XNOR gives XOR, and the other way round.

Common mistakes

  • Complementing each letter without swapping AND and OR. That is only half of De Morgan.

  • Confusing the complement with the dual. The dual keeps the literals unchanged.

  • Treating as the complement of . The complement of is .

Practice Complement

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

Learn it step by step

Complement is taught in Boolean Algebra and Logic Gates.