Mathwords logoMathwords

NAND — Definition, Formula & Examples

NAND is a logic operation that returns false only when both inputs are true, and returns true in every other case. It is the negation of AND (conjunction), which is where the name 'Not AND' comes from.

For propositions pp and qq, the NAND operation is defined as pq¬(pq)p \barwedge q \equiv \neg(p \land q). It is a binary Boolean function that evaluates to false if and only if both operands are true, and evaluates to true otherwise.

Key Formula

pq¬(pq)p \barwedge q \equiv \neg(p \land q)
Where:
  • pp = First proposition or input
  • qq = Second proposition or input
  • \land = Conjunction (AND)
  • ¬\neg = Negation (NOT)
  • \barwedge = NAND operator

How It Works

To evaluate a NAND expression, first determine the result of the AND of the two inputs, then negate it. If both inputs are true, AND gives true, so NAND gives false. In every other combination — true/false, false/true, or false/false — AND gives false, so NAND gives true. NAND is called a *functionally complete* gate, meaning you can build every other Boolean operation (NOT, AND, OR, NOR, XOR) using only NAND gates.

Worked Example

Problem: Build the truth table for pqp \barwedge q and identify which input combinations produce true.
Step 1: List all input combinations and compute pqp \land q for each.
pqpqTTTTFFFTFFFF\begin{array}{cc|c} p & q & p \land q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & F \end{array}
Step 2: Negate each result to get ¬(pq)\neg(p \land q).
pqpqpqTTTFTFFTFTFTFFFT\begin{array}{cc|c|c} p & q & p \land q & p \barwedge q \\ \hline T & T & T & F \\ T & F & F & T \\ F & T & F & T \\ F & F & F & T \end{array}
Answer: NAND outputs true for three of the four rows — it is false only when both pp and qq are true.

Why It Matters

NAND gates are the most common building block in digital electronics because any logic circuit can be constructed from NAND gates alone. In discrete math and computer science courses, understanding NAND helps you prove functional completeness and simplify Boolean expressions.

Common Mistakes

Mistake: Confusing NAND with NOR. Students sometimes think NAND is the negation of OR.
Correction: NAND negates the AND: ¬(pq)\neg(p \land q). NOR negates the OR: ¬(pq)\neg(p \lor q). Their truth tables differ in three of four rows.