Logic Gates

What is a Logic Gate?

Logic Gates make up every digital system in one way or another, they are the building blocks that allow computers to make decisions based on given criteria.

Resources

Table Summary

Logic GateOperatorCircuit SymbolVenn DiagramDescriptionBoolean AlgebraTruth Table
ANDAND & && . upload.wikimedia.org/wikipedia/commons/b/b9/AND_ANSI_Labelled.svgOutput is 1 only if all inputs are 1. AND gates can have more than 1 inputs.Logical conjunction - Wikipedia
OROR | || + upload.wikimedia.org/wikipedia/commons/1/16/OR_ANSI_Labelled.svgOutput is 1 if either of the inputs are 1. Output is only 0 if
both of the inputs are 0. OR gates can have more than two
inputs.
Logical disjunction - Wikipedia
BUFFERupload.wikimedia.org/wikipedia/commons/1/1a/Buffer_ANSI_Labelled.svg
NOT¬ ~ ! NOT - A' upload.wikimedia.org/wikipedia/commons/6/60/NOT_ANSI_Labelled.svgAlso known as INVERTER gate. This negates the output variable of the
logic used.
Negation / Complement - Wikipedia
NAND ¬(A ∧ B)upload.wikimedia.org/wikipedia/commons/e/e6/NAND_ANSI_Labelled.svg”NOT-AND” gate --- opposite of AND gate — output is 1 only if
all the inputs are NOT 1. Output is only 0 when all the
inputs are 1. NAND gates can have more than two inputs.
Sheffer stroke - Wikipedia
NORA ↓ B ¬(A ∨ B)upload.wikimedia.org/wikipedia/commons/c/c6/NOR_ANSI_Labelled.svg”NOT-OR Of OR gate” — output is only 1 if
both of the inputs are 0. If either of the inputs, or both the
inputs. are 1, then the output is 0. NOR gates can have
more than two inputs.
Logical NOR - Wikipedia
XOR ^ (A ∧ ¬B) ∨ (¬A ∧ B) Δupload.wikimedia.org/wikipedia/commons/1/17/XOR_ANSI_Labelled.svg”Exclusive-OR gate” — output is only 1 if either of the inputs
are 1 , but 0 when both the inputs are 0 or when both the
inputs are 1.
Exclusive Disjunction- Wikipedia
XNOR ¬(A ⊕ B) (A ∧ B) ∨ (¬A ∧ ¬B)upload.wikimedia.org/wikipedia/commons/b/b8/XNOR_ANSI_Labelled.svg”Exclusive-NOR gate” — opposite of EX-OR gate — output is
only 1 when both the inputs are 0 or both the inputs are 1.
Output is 0 when either Of the inputs is 1.
Logical equality - Wikipedia

Operators

AND Gate

An AND gate is used to check two variables to see if they match, if those two variables do match they then output a value based on whether those initial variables were true or false.

In the diagram we have two input variables (A and B) with one output variable (Q). When both variables A and B are true then the output variable Q is true. This also works inverse, if both inputs are false, then Q is false.

Symbolic Representation

  • AND - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Conjunction symbol used in formal logic.
  • & - Singular ampersand is used in programming languages such as batch-scripting.
  • && - Double ampersand is used in programming languages such as C, C++. Java, Javascript.
  • . - Singular dot symbol used in Boolean algebra and electrical engineering.
  • - Intersection used in set theory to denote two sets overlapping.

OR Gate

An OR gate is used to check two variables and determine whether one of them or both of them are true. If those one of those variables is true the output is true. If both of the inputs are true then the output is also true. If both inputs are false then the output is false.

In the diagram we have two input variables (A and B) with one output variable (Q). When either variable (A or B) is true, the output (Q) is true. When both variables A and B are true the output is true. Inversely, if both A and B are false the output is false.

Symbolic Representation

  • OR - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Disjunction symbol used in formal logic.
  • | - Singular vertical bar is used in programming languages such as batch-scripting.
  • || - Double vertical bars is used in programming languages such as C, C++. Java, Javascript.
  • + - Plus symbol used in Boolean algebra to denote the OR operator.
  • - Union used in set theory to denote two sets being part of a result.

NOT Gate

A NOT gate is used to check two variables and determine whether one of them or both of them are true. If those one of those variables is true the output is true. If both of the inputs are true then the output is also true. If both inputs are false then the output is false.

In the diagram we have two input variables (A and B) with one output variable (Q). When either variable (A or B) is true, the output (Q) is true. When both variables A and B are true the output is true. Inversely, if both A and B are false the output is false.

Symbolic Representation

  • OR - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Disjunction symbol used in formal logic.
  • | - Singular vertical bar is used in programming languages such as batch-scripting.
  • || - Double vertical bars is used in programming languages such as C, C++. Java, Javascript.
  • + - Plus symbol used in Boolean algebra to denote the OR operator.
  • - Union used in set theory to denote two sets being part of a result.

NOR Gate

A NOR gate is used to negate an OR expression. It is used to check two variables for whether or not they output true. If any of the inputs are true the output must be false.

In the diagram we have two input variables (A and B) with one output variable (Q). When either variable (A or B) is true, the output (Q) is true. When both variables A and B are true the output is true. Inversely, if both A and B are false the output is false.

Symbolic Representation

  • OR - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Disjunction symbol used in formal logic.
  • -

XOR Gate

A XOR gate is used to negate

In the diagram we have two inputs (A and B) with one output (Q). When either of the inputs is true the other input must be false. Only one of the input variables can be true, not both, nor none.

Symbolic Representation

  • OR - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Disjunction symbol used in formal logic.
  • -
  • -

XNOR Gate

A XNOR gate is used to negate

In the diagram we have two input variables (A and B) with one output variable (Q). The output can only be true if either both inputs are true or false. If either of the inputs is false, then the output is always false.

Symbolic Representation

  • OR - Commonly written in all-caps in query based languages and logical expressions in English.
  • - Logical Disjunction symbol used in formal logic.
  • -