Introduction

Boolean algebra is the algebra of two-valued logic used to describe and simplify digital circuits. Variables take values in {0,1}\{0,1\}; the operations AND, OR and NOT correspond to series switches, parallel switches and inversion. Every gate network implements a Boolean function, and algebraic identities let you rewrite a network without changing its truth table.

This note states the axioms, the standard theorems (including De Morgan and absorption), duality, and the counting facts GATE tests: how many functions, how many minterms, what self-dual means. Canonical forms and universal gates continue in the next note.

Prerequisites

Core concepts

Values, operations, notation

OperationAlgebraGateSwitching
AND (product)x⋅yx\cdot y or xyxyANDseries
OR (sum)x+yx + yORparallel
NOT (complement)x′x' or xˉ\bar{x}inverternormally-closed

Convention used in all Gate CS Mastery DL notes. Juxtaposition means AND; ++ means OR; ⋅′{\cdot}' means NOT. Precedence: NOT binds tightest, then AND, then OR. So x+yz′x + yz' means x+(y⋅(z′))x + (y\cdot(z')).

Huntington axioms (one common presentation)

A Boolean algebra on set B={0,1}B=\{0,1\} with ++, ⋅\cdot, ⋅′{\cdot}' satisfies, among other equivalent axiom sets:

  1. Commutative: x+y=y+xx+y = y+x, xy=yxxy = yx.
  2. Distributive: x+(yz)=(x+y)(x+z)x+(yz)=(x+y)(x+z), x(y+z)=xy+xzx(y+z)=xy+xz.
  3. Identities: x+0=xx+0=x, x⋅1=xx\cdot 1 = x.
  4. Complements: x+x′=1x+x'=1, x⋅x′=0x\cdot x'=0.

From these one derives the remaining standard theorems. Hardware interprets 0 and 1 as logic levels; the algebra itself does not care which voltage is HIGH.

Duality

The dual of an expression swaps ++ with ⋅\cdot and 00 with 11, leaving variables and complements unchanged. If an identity holds, its dual holds. Example: the dual of x+0=xx+0=x is x⋅1=xx\cdot 1 = x.

Duality versus complement. The two operations look alike and exams confuse them on purpose.

OperationRuleExample f=x+y′zf = x + y'z
Dual fdf^dSwap ++ and ⋅\cdot, swap 0 and 1; keep literalsfd=x(y′+z)f^d = x(y' + z)
Complement f′f'Swap ++ and ⋅\cdot, swap 0 and 1, and complement every literalf′=x′(y+z′)f' = x'(y + z')

They are linked by fd(x1,…,xn)=f′(x1′,…,xn′)f^d(x_1, \ldots, x_n) = f'(x_1', \ldots, x_n'): the dual is the complement evaluated at complemented inputs. Duality is a statement about identities (the dual of a true identity is true); it does not say that fd=ff^d = f for a function, which holds only for self-dual ff. Keep the parentheses that the original precedence implied: the dual of x+yzx + yz is x(y+z)x(y + z), not xy+zxy + z.

Self-dual function. A function ff is self-dual when f(x1,…,xn)=f′(x1′,…,xn′)f(x_1,\ldots,x_n) = f'(x_1',\ldots,x_n') for every input (equivalently, f=fdf = f^d where fdf^d is the dual function). Self-dual functions are determined by their values on half of the input space (inputs whose first bit is 0, for example), so there are 22n−12^{2^{n-1}} self-dual Boolean functions of nn variables.

Standard theorems (use freely)

NameIdentityDual
Idempotentx+x=xx+x=xxx=xxx=x
Dominationx+1=1x+1=1x⋅0=0x\cdot 0 = 0
Involution(x′)′=x(x')'=xsame
Absorptionx+xy=xx+xy=xx(x+y)=xx(x+y)=x
De Morgan(xy)′=x′+y′(xy)'=x'+y'(x+y)′=x′y′(x+y)'=x'y'
Consensusxy+x′z+yz=xy+x′zxy + x'z + yz = xy + x'z(x+y)(x′+z)(y+z)=(x+y)(x′+z)(x+y)(x'+z)(y+z)=(x+y)(x'+z)

Consensus removes the redundant yzyz term when xyxy and x′zx'z are present. It is the algebraic twin of eliminating a non-essential implicant.

Proof of consensus. yz=yz(x+x′)=xyz+x′yzyz = yz(x + x') = xyz + x'yz. The term xyzxyz is absorbed by xyxy and x′yzx'yz by x′zx'z, so adding yzyz changes nothing. The consensus of xyxy and x′zx'z is formed by deleting the opposed variable xx and ANDing what is left: y⋅zy \cdot z. Two terms have a consensus only when exactly one variable appears complemented in one and uncomplemented in the other.

Properties of the derived operators

OperatorCommutativeAssociativeNote
AND, ORyesyesBoth distribute over each other
XOR, XNORyesyesAND distributes over XOR: x(y⊕z)=xy⊕xzx(y \oplus z) = xy \oplus xz
NAND, NORyesno(x↑y)↑z≠x↑(y↑z)(x \uparrow y)\uparrow z \ne x \uparrow (y \uparrow z)

For NAND, (x↑y)↑z=xy+z′(x \uparrow y) \uparrow z = xy + z' while x↑(y↑z)=x′+yzx \uparrow (y \uparrow z) = x' + yz; they differ at x=1,y=0,z=0x = 1, y = 0, z = 0. A multi-input NAND gate computes (x1x2⋯xk)′(x_1 x_2 \cdots x_k)'; it is not a cascade of two-input NANDs.

No cancellation law. x+y=x+zx + y = x + z does not imply y=zy = z (take x=1x = 1), and xy=xzxy = xz does not imply y=zy = z (take x=0x = 0). If both equations hold, then y=zy = z. Do not "cancel" a common term from both sides of a Boolean equation.

Logic gate symbols and one-line truth tables for AND, OR, NOT, NAND, NOR, XOR, XNOR
Figure 1. Standard gate symbols with their truth tables for two inputs (one input for NOT). NAND and NOR are circled-inversion forms of AND and OR.

How it works

Evaluating a function

Substitute 0/1 for each variable and apply the operations with the precedence above, or build a truth table with 2n2^n rows for nn variables.

Simplifying by algebra

Apply identities to reduce literal count or gate count. Typical moves: factor (distributive), absorb, cancel x+x′=1x+x'=1, apply De Morgan to push complements inward, drop consensus terms.

Example. f=xy+xy′+x′zf = xy + xy' + x'z. First xy+xy′=x(y+y′)=xxy + xy' = x(y + y') = x, so f=x+x′zf = x + x'z. By the distributive law of OR over AND, x+x′z=(x+x′)(x+z)=x+zx + x'z = (x + x')(x + z) = x + z. So f=x+zf = x + z.

Example (product of sums). (a+b)(a′+c)=aa′+ac+a′b+bc=ac+a′b+bc=ac+a′b(a + b)(a' + c) = aa' + ac + a'b + bc = ac + a'b + bc = ac + a'b, where the last step drops bcbc, the consensus of acac and a′ba'b.

Example (factor and absorb). x′y′z+x′yz+xy′=x′z(y′+y)+xy′=x′z+xy′x'y'z + x'yz + xy' = x'z(y' + y) + xy' = x'z + xy'. No further reduction is possible: the two terms have no consensus in a variable that makes either redundant.

Counting

  • Number of Boolean functions of nn variables: 22n2^{2^n} (each of 2n2^n rows may be 0 or 1).
  • Number of minterms (or maxterms) of nn variables: 2n2^n.
  • Number of self-dual functions: 22n−12^{2^{n-1}}.
  • Number of functions that depend on all nn variables is smaller, see Mathematical explanation.

Function classes and their counts

ClassDefinitionCount for nn variablesn=2n = 2n=3n = 3
All functionsany truth table22n2^{2^n}16256
Self-dualf(x′)=f(x)′f(x') = f(x)' for every input xx22n−12^{2^{n-1}}416
Neutralas many 1s as 0s in the truth table(2n2n−1)\binom{2^n}{2^{n-1}}670
Symmetricvalue depends only on the number of 1 inputs2n+12^{n+1}816
Affine (linear)c0⊕c1x1⊕⋯⊕cnxnc_0 \oplus c_1x_1 \oplus \cdots \oplus c_nx_n2n+12^{n+1}816
Monotonex≤yx \le y bitwise implies f(x)≤f(y)f(x) \le f(y)no closed form620
Depends on all variablesno variable is irrelevant∑k=0n(−1)k(nk)22n−k\sum_{k=0}^{n}(-1)^k\binom{n}{k}2^{2^{n-k}}10218

Why each count holds.

  • Self-dual: the 2n2^n inputs split into 2n−12^{n-1} complementary pairs {x,x′}\{x, x'\}. Choosing f(x)f(x) fixes f(x′)=f(x)′f(x') = f(x)', so there are 22n−12^{2^{n-1}} free choices. Each pair contributes one 0 and one 1, so every self-dual function is neutral (16 of the 70 neutral functions of 3 variables).
  • Neutral: choose which 2n−12^{n-1} of the 2n2^n rows are 1.
  • Symmetric: the input weight takes n+1n + 1 values 0,…,n0, \ldots, n, and ff assigns 0 or 1 to each. Examples: x⊕y⊕zx \oplus y \oplus z, majority xy+yz+zxxy + yz + zx.
  • Affine: n+1n + 1 coefficient bits.
  • Depends on all variables: inclusion and exclusion over the set of variables that are ignored. For n=2n = 2: 16−2⋅4+2=1016 - 2\cdot 4 + 2 = 10 (all except the constants 0, 1 and the four functions x,x′,y,y′x, x', y, y').

Algorithms and pseudocode

Truth-table evaluation of an expression tree is the reference semantics for every later minimization note.

Text
EVAL(expr, assign)                    // normalized variable/constant/NOT/AND/OR tree
0  if expr is constant 0 or 1 then return that constant
1  if expr is a variable x_i then return assign[i]
2  if expr is NOT(t) then return 1 - EVAL(t, assign)
3  if expr is AND(t, u) then return EVAL(t, assign) AND EVAL(u, assign)
4  if expr is OR(t, u) then return EVAL(t, assign) OR EVAL(u, assign)

TRUTH-TABLE(expr, n)
1  rows <- empty list
2  for each assign in {0,1}^n in lexicographic order
3      append EVAL(expr, assign) to rows
4  return rows

Two expressions are equivalent exactly when their truth tables match. A truth table with 2n2^n rows is a complete proof of any identity in nn variables.

Mathematical explanation

Shannon expansion (Boole's expansion). For any ff,

f(x1,…,xn)=x1⋅f(1,x2,…,xn)+x1′⋅f(0,x2,…,xn).f(x_1,\ldots,x_n) = x_1\cdot f(1,x_2,\ldots,x_n) + x_1'\cdot f(0,x_2,\ldots,x_n).

Iterating yields the sum-of-minterms canonical form (next note). The dual expansion with AND of OR-clauses yields the product of maxterms.

XOR and XNOR. x⊕y=xy′+x′yx\oplus y = xy' + x'y, and x⊙y=xy+x′y′x\odot y = xy + x'y'. XOR is associative and commutative; x⊕x=0x\oplus x = 0, x⊕0=xx\oplus 0 = x, x⊕1=x′x\oplus 1 = x'. Any Boolean function has an algebraic normal form as a XOR of ANDs (Reed-Muller), which is useful but not required for GATE beyond small identities.

Further XOR facts used below:

  • x1⊕x2⊕⋯⊕xn=1x_1 \oplus x_2 \oplus \cdots \oplus x_n = 1 exactly when an odd number of inputs are 1 (odd parity).
  • x+y=x⊕y⊕xyx + y = x \oplus y \oplus xy, and x+y=x⊕yx + y = x \oplus y whenever xy=0xy = 0 (disjoint terms can be ORed or XORed).
  • (x⊕y)′=x′⊕y=x⊕y′=x⊙y(x \oplus y)' = x' \oplus y = x \oplus y' = x \odot y.
  • For three inputs, x⊙y⊙z=x⊕y⊕zx \odot y \odot z = x \oplus y \oplus z: with an odd number of operands, XNOR chains and XOR chains agree; with an even number they are complements.

Shannon expansion as a multiplexer. Expanding f=xy+x′zf = xy + x'z about xx gives f(1,y,z)=yf(1, y, z) = y and f(0,y,z)=zf(0, y, z) = z, so f=x⋅y+x′⋅zf = x\cdot y + x'\cdot z: a 2:1 multiplexer with select xx. This is the basis of MUX-based function implementation in the Multiplexers, Decoders and Encoders note.

Worked examples

Example 1: prove absorption by cases

For x+xyx+xy: if x=1x=1, both sides 1; if x=0x=0, both sides 0. So x+xy=xx+xy=x. Dual: x(x+y)=xx(x+y)=x.

Example 2: De Morgan on three variables

(xyz)′=x′+y′+z′(xyz)' = x'+y'+z' by applying the two-variable rule twice. Dual: (x+y+z)′=x′y′z′(x+y+z)'=x'y'z'.

Example 3: counts for n=3n=3

  • Functions: 28=2562^{8} = 256.
  • Minterms: 8.
  • Self-dual functions: 24=162^{4} = 16.

Example 4: is f=xf=x self-dual?

f′(x′)=(x′)′=x=f(x)f'(x') = (x')' = x = f(x), yes. Is f=xyf=xy self-dual? Dual is x+yx+y, and xy≠x+yxy \ne x+y, so no.

Example 5: consensus

f=xy+x′z+yzf = xy + x'z + yz. Truth-table check shows ff equals xy+x′zxy + x'z on all 8 inputs of three variables; the yzyz term never turns a 0 into a 1 that the first two terms miss.

Example 6: dual and complement of one expression

For f=(x+y′)z+0f = (x + y')z + 0: the dual is fd=(xy′+z)⋅1=xy′+zf^d = (xy' + z)\cdot 1 = xy' + z, and the complement is f′=(x′y+z′)⋅1=x′y+z′f' = (x'y + z')\cdot 1 = x'y + z'. Check the link at x=1,y=1,z=0x = 1, y = 1, z = 0: f′(x′,y′,z′)=f′(0,0,1)=0+0=0f'(x', y', z') = f'(0, 0, 1) = 0 + 0 = 0, and fd(1,1,0)=0+0=0f^d(1, 1, 0) = 0 + 0 = 0.

Example 7: which of these are self-dual?

  • Majority M(x,y,z)=xy+yz+zxM(x, y, z) = xy + yz + zx: its dual is (x+y)(y+z)(z+x)(x + y)(y + z)(z + x), which multiplies out to xy+yz+zxxy + yz + zx. Self-dual.
  • x⊕y⊕zx \oplus y \oplus z: complementing all three inputs flips the parity of three bits, so the output flips. Self-dual.
  • x⊕yx \oplus y: complementing both inputs leaves the output unchanged, so f(x′)=f(x)≠f(x)′f(x') = f(x) \ne f(x)'. Not self-dual (no function of an even number of XORed inputs is).
  • xyxy: the dual x+yx + y differs at x=1,y=0x = 1, y = 0. Not self-dual.

Example 8: counting with a constraint

How many functions f(x,y,z)f(x, y, z) satisfy f(0,0,0)=0f(0,0,0) = 0 and f(1,1,1)=1f(1,1,1) = 1? Two of the 8 rows are fixed, so 26=642^6 = 64. How many of the 70 neutral functions are also self-dual? All 16 self-dual functions are neutral, so 16.

Important properties and observations

  • AND distributes over OR and OR distributes over AND. Ordinary arithmetic has only one distributive law; Boolean algebra has both.
  • x+x′y=x+yx + x'y = x + y and x(x′+y)=xyx(x'+y)=xy are worth memorising; they are absorption after expanding.
  • Literal: a variable or its complement. Term: a product of literals. Clause: a sum of literals.
  • A function that ignores some variables still counts among the 22n2^{2^n} functions of those nn names; "depends on all variables" is a stricter class.

Common misconceptions.

  • "x+xy′=x+y′x + xy' = x + y'." False: by absorption x+xy′=xx + xy' = x, and the two sides differ at x=0,y=0x = 0, y = 0. The rule with a complemented first factor is the one that simplifies: x+x′y=x+yx + x'y = x + y.
  • "Self-dual means f=f′f = f'." No function equals its own complement; self-dual means f(x)=f′(x′)f(x) = f'(x'), that is f=fdf = f^d.
  • "The dual of ff is its complement." The complement also complements every literal; the dual does not.
  • "NAND is associative, so a 3-input NAND is two cascaded 2-input NANDs." NAND and NOR are not associative.
  • "Number of Boolean functions of nn inputs is 2n2^n." That is the number of rows, not functions.

GATE examination perspective

  • SIMPLIFY BY IDENTITIES. Reduce an expression; the answer is unique only up to algebraic form, so a specific shape is normally stated (minimum literals, or a given template).
  • NUMBER OF FUNCTIONS. 22n2^{2^n}; for n=2n=2 it is 16; for n=3n=3 it is 256.
  • SELF-DUAL COUNT. 22n−12^{2^{n-1}}.
  • DUAL OF AN EXPRESSION. Swap ++/⋅\cdot and 00/11.
  • WHICH IDENTITY. Spot absorption vs consensus vs De Morgan in a short proof.
  • DUAL OR COMPLEMENT. A question giving ff and asking for fdf^d will list f′f' as a distractor (and vice versa).
  • CLASS COUNTS. Neutral (2n2n−1)\binom{2^n}{2^{n-1}}, symmetric 2n+12^{n+1}, self-dual 22n−12^{2^{n-1}}; fixing kk rows leaves 22n−k2^{2^n - k} functions.
  • NON-ASSOCIATIVE OPERATORS. Evaluate (x↑y)↑z(x \uparrow y) \uparrow z as written; do not regroup NAND or NOR.
  • FUNCTIONAL COMPLETENESS. Whether a gate set can build every function is decided by Post's criteria, see Canonical Forms and Functional Completeness.

Summary

Sources

  1. M. Morris Mano, M. D. Ciletti, Digital Design, 5th ed., Pearson, 2013: Chapter 2, Sections 2.2 to 2.5 and 2.8 (definitions, axioms, theorems, Boolean functions, logic gates).

Next steps