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 Gate | Operator | Circuit Symbol | Venn Diagram | Description | Boolean Algebra | Truth Table |
---|---|---|---|---|---|---|
AND | AND ∧ & && . ∩ | Output is 1 only if all inputs are 1. AND gates can have more than 1 inputs. | Logical conjunction - Wikipedia | ![]() | ||
OR | OR ∨ | || + ∪ | Output 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 | ![]() | ||
BUFFER | ||||||
NOT | ¬ ~ ! NOT - A' A̅ | Also known as INVERTER gate. This negates the output variable of the logic used. | Negation / Complement - Wikipedia | ![]() | ||
NAND | ↑ ¬(A ∧ B) | ”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 | ![]() | ||
NOR | A ↓ B ¬(A ∨ B) | ”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) Δ | ”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) | ”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.≡
-