Skip to content

Logic Gates

Introduction to basics logic gates

Let’s introduce a useful convention LOW, 0 and false have the same logic meaning, as well as HIGH, 1 and true.

Axioms Single variable theorems
0 ⋅ 0 = 0 x ⋅ 0 = 0
1 + 1 = 1 x + 1 = 1
1 ⋅ 1 = 1 x ⋅ 1 = x
0 + 0 = 0 x + 0 = x
0 ⋅ 1 = 1 ⋅ 0 = 0 x ⋅ x = x
0 + 1 = 1 + 0 = 1 x + x = x
if x = 0, then !x = 1 x ⋅ !x = 0
if x = 1, then !x = 0 x + !x = 1
1 = !!1 and 0 = !!0 x = !!x

Please Note: Double negation is often used with a couple of overline signs.

Given a logic expression, the dual is obtained by swapping:

  1. summations with multiplications (and vice-versa)
  2. 0 with 1 (and vice-versa)

AND gate is a logic gate that implements logical conjunction (∧).

If one or both the inputs are false, the output is false. If both inputs are true, the output is true.

Truth table:

A B A ⋅ B
0 0 0
0 1 0
1 0 0
1 1 1

AND gate in ANSI

OR gate is a logic gate that implements logical disjunction (∨).

A true output results if one or both the inputs are true. If neither input is true, the output is false.

Truth table:

A B A + B
0 0 0
0 1 1
1 0 1
1 1 1

OR gate in ANSI

NOT gate is a logic gate that implements logical negation (¬).
It is more commonly referred with the exclamation mark ! before che operator: !A means logical negation of A.

Truth table:

A ¬ A
0 1
1 0

NOT gate in ANSI

NOR gate is the result of the negation of the OR operator. It can also be seen as the inverse of an AND gate.

A true output results if both the inputs are false. A false output results if one or both the inputs are true.

Truth table:

A B ¬ (A ∨ B)
0 0 1
0 1 0
1 0 0
1 1 0

NOR gate in ANSI

NAND gate is the result of the negation of the NAND operator. It can also be seen as the inverse of an OR gate.

A true output results if one or both the inputs are false. A false output results if both the inputs are true.

Truth table:

A B ¬ (A ∧ B)
0 0 1
0 1 1
1 0 1
1 1 0

NAND gate in ANSI

XOR gate is an Exclusive OR gate that performs exclusive disjunction (⊕).

The output of an XOR gate is true only when exactly one of its inputs is true. If inputs are both false or both true the output is false.

Truth table:

A B A ⊕ B
0 0 0
0 1 1
1 0 1
1 1 0

XOR gate in ANSI

XNOR gate is the logical complement of XOR gate (⨀).

The output of an XNOR gate is false only when exactly one of its inputs is true. If inputs are both false or both true the output is true.

Truth table:

A B A ⨀ B
0 0 1
0 1 0
1 0 0
1 1 1

XNOR gate in ANSI

Useful links: