Boolean Logic

How Binary Becomes Computation

The Mathematics of Thought

Every calculation your computer performs, every decision in every program, every pixel on your screen—all of it emerges from just three simple operations: AND, OR, and NOT. This is Boolean logic, the mathematical bridge between human reasoning and machine computation.

When you type a search query, your computer evaluates billions of AND, OR, and NOT operations. When your phone recognizes your face, neural networks built from Boolean logic analyze millions of pixels. When a self-driving car decides to brake, chains of logical operations process sensor data in milliseconds.

What makes this remarkable is that these operations were conceived in 1847—a century before the first electronic computer—by a self-taught English mathematician who believed he had found the laws of human thought itself.

Standard symbols for logic gates
Standard symbols for the fundamental logic gates. These simple components, combined by the billions, create all digital computation. Source: Wikimedia Commons

George Boole: The Forgotten Genius

George Boole was born in 1815 in Lincoln, England, to a working-class family. His father, a shoemaker, couldn't afford formal education for young George, so the boy taught himself Latin, Greek, French, German, and Italian by age 12. He then turned to mathematics, mastering calculus from borrowed textbooks.

Portrait of George Boole
George Boole (1815-1864), whose algebra of logic became the foundation of digital computing. Source: Wikimedia Commons

At 16, Boole became a schoolteacher to support his family. At 19, he opened his own school. At 24, he published his first mathematical paper. By 34, despite having no university degree, he was appointed Professor of Mathematics at Queen's College Cork in Ireland—such was his growing reputation.

In 1847, Boole published "The Mathematical Analysis of Logic," and in 1854, his masterwork: "An Investigation of the Laws of Thought." These works introduced what we now call Boolean algebra—a system for representing logical statements as mathematical equations.

"No general method for the solution of questions in the theory of probabilities can be established which does not explicitly recognise... those Universal Laws of Thought which are the basis of all reasoning."

George Boole, 1854

Boole's insight was revolutionary: logical statements like "it is raining AND I have an umbrella" could be represented with symbols and manipulated using algebraic rules. True becomes 1, false becomes 0, and logical relationships become mathematical operations.

Tragically, Boole died in 1864 at age 49, never knowing that his abstract mathematics would become the foundation of the digital age. It would take another 73 years before Claude Shannon recognized that Boolean algebra was the perfect tool for designing electrical circuits.

The Three Fundamental Operations

Every Boolean expression, no matter how complex, is built from just three fundamental operations:

AND

Output is 1 only when all inputs are 1

ABA AND B
000
010
100
111

Analogy: Two switches in series—both must be ON for current to flow.

OR

Output is 1 when any input is 1

ABA OR B
000
011
101
111

Analogy: Two switches in parallel—either one ON allows current to flow.

NOT

¬

Output is the opposite of the input

ANOT A
01
10

Analogy: An inverter—if the input is ON, output is OFF, and vice versa.

These three operations might seem too simple to be useful. Yet from these humble beginnings, we can construct any computational function imaginable. This is one of the most profound discoveries in the history of mathematics.

Boolean Algebra Laws

Just like regular algebra has rules (like a + b = b + a), Boolean algebra has its own laws:

  • Identity: A AND 1 = A, A OR 0 = A
  • Null: A AND 0 = 0, A OR 1 = 1
  • Complement: A AND (NOT A) = 0, A OR (NOT A) = 1
  • De Morgan's: NOT(A AND B) = (NOT A) OR (NOT B)

From Math to Circuits: Logic Gates

Boolean operations remained purely mathematical until 1937, when Claude Shannon's master's thesis showed that electrical switches could implement Boolean logic. This insight launched the digital revolution.

A logic gate is a physical device—built from transistors—that implements a Boolean operation. When voltages representing 1s and 0s enter the gate, the output voltage represents the logical result.

Inside an AND Gate

AND Gate: Transistor Implementation

An AND gate can be built using two transistors in series:

  1. Both transistors must be ON (conducting) for current to flow to output
  2. If either transistor is OFF, the circuit is broken
  3. Only when A=1 AND B=1 does output=1
A → B →
AND
→ A⋅B

Inside an OR Gate

OR Gate: Transistor Implementation

An OR gate uses two transistors in parallel:

  1. Current can flow through either path to the output
  2. If either transistor is ON, output receives current
  3. Only when A=0 AND B=0 does output=0
A → B →
OR
→ A+B

Inside a NOT Gate (Inverter)

NOT Gate: The Simplest Inverter

A NOT gate uses just one transistor as a switch:

  1. When input is HIGH, transistor conducts, pulling output LOW
  2. When input is LOW, transistor blocks, output is pulled HIGH
  3. Output is always the opposite of input
A →
NOT
→ Ā

NAND: The Universal Gate

In 1913, Henry Sheffer proved something astonishing: any Boolean function can be expressed using just one operation. This operation, now called NAND (NOT-AND), is perhaps the most important gate in all of computing.

NAND Gate Truth Table

ABA NAND B
001
011
101
110

NAND outputs 0 only when both inputs are 1. It's the inverse of AND.

Why is NAND so important? Because you can build everything else from it:

NOT from NAND

NOT A = A NAND A

Connect both inputs of a NAND gate together.

AND from NAND

A AND B = (A NAND B) NAND (A NAND B)

Pass NAND output through another NAND used as NOT.

OR from NAND

A OR B = (A NAND A) NAND (B NAND B)

NOT each input, then NAND the results.

Why Manufacturers Love NAND

In CMOS technology, NAND gates are cheaper and faster to build than AND gates. This is because a direct AND gate would need extra transistors for inversion. Modern processors are essentially billions of NAND gates (and their cousin NOR gates) cleverly arranged.

Building Complex Logic

Individual gates combine to form more complex circuits. Here are some essential building blocks:

The Multiplexer: A Digital Switch

A multiplexer (MUX) selects one of multiple inputs based on a selector signal. Think of it as a railway switch directing trains:

2-to-1 Multiplexer

Input 0 (A)
Input 1 (B)
Select (S)
MUX
Output

When S=0, output equals A. When S=1, output equals B.
Formula: Output = (NOT S AND A) OR (S AND B)

The Decoder: Address Translator

A decoder converts a binary address into a one-hot signal—exactly one output line goes HIGH based on the binary input:

2-to-4 Decoder

InputOutput
A1A0Y0Y1Y2Y3
001000
010100
100010
110001

Decoders are essential for memory addressing—a 10-bit decoder can select any one of 1,024 memory locations.

Logic Performs Arithmetic

Here's where Boolean logic becomes truly magical: we can make logic gates do math. All arithmetic—addition, subtraction, multiplication, division—reduces to combinations of AND, OR, and NOT.

The Half Adder: 1-Bit Addition

Adding two 1-bit numbers produces a 1-bit sum and a 1-bit carry:

ABSumCarry
0000
0110
1010
1101

Sum = A XOR B (1 if inputs differ)

Carry = A AND B (1 if both inputs are 1)

The XOR Operation

XOR (exclusive OR) outputs 1 when inputs are different. It's built from AND, OR, and NOT:

A XOR B = (A OR B) AND NOT(A AND B)

XOR is essential for addition, comparisons, cryptography, and error checking.

The Full Adder: Adding with Carry

To add multi-bit numbers, we need to handle carry-in from the previous bit position. A full adder takes three inputs (A, B, and carry-in) and produces sum and carry-out:

Full Adder Logic

A B Cin
Full Adder
Sum = A XOR B XOR Cin Cout = (A AND B) OR (Cin AND (A XOR B))

Ripple Carry Adder: Multi-Bit Addition

Chain full adders together, connecting each carry-out to the next carry-in, and you can add numbers of any size:

4-Bit Ripple Carry Adder

FA
A0B0
S0
FA
A1B1
S1
FA
A2B2
S2
FA
A3B3
S3

The carry "ripples" through each stage. While simple, this design is slow for large numbers—modern CPUs use "carry-lookahead" adders that compute all carries in parallel.

The ALU: Logic's Masterpiece

At the heart of every processor lies the Arithmetic Logic Unit (ALU)—a circuit that combines all arithmetic and logic operations into a single, flexible component. The ALU is where Boolean logic becomes true computation.

ALU symbol showing inputs A, B, operation select, and outputs
Standard ALU symbol. Inputs A and B undergo the operation selected by the control signals, producing result Y and status flags. Source: Wikimedia Commons

A typical ALU performs operations including:

Arithmetic Operations

  • Add (A + B)
  • Subtract (A - B)
  • Increment (A + 1)
  • Decrement (A - 1)
  • Negate (-A)

Logic Operations

  • AND (A ∧ B)
  • OR (A ∨ B)
  • XOR (A ⊕ B)
  • NOT (¬A)
  • Shift left/right

Comparison Operations

  • Equal (A = B)
  • Less than (A < B)
  • Greater than (A > B)
  • Zero test (A = 0)
74181
First commercial ALU chip (1970)
4-bit
Original ALU width
16
Functions in 74181
64-bit
Modern CPU ALU width

Boolean Logic in Modern Processors

Today's processors contain billions of transistors implementing astronomical numbers of logic gates. Yet at their core, they still perform the same AND, OR, and NOT operations George Boole described in 1854.

Pipelining: Parallel Logic Stages

Modern CPUs break operations into stages that execute simultaneously:

Fetch
Get instruction
Decode
Interpret instruction
Execute
ALU operation
Memory
Read/Write data
Writeback
Store result

Branch Prediction: Logic Guessing the Future

When code contains "if-then-else" decisions, the CPU uses Boolean logic circuits to predict which branch will be taken before the condition is even evaluated. Modern predictors achieve accuracy over 95%.

Speculative Execution: Parallel Universes

CPUs execute both branches of a decision simultaneously, then discard the wrong path. This massive parallelism requires extensive Boolean logic to track dependencies and manage resources.

The Future of Logic

Reversible Computing

Standard logic gates destroy information—you can't determine AND's inputs from just its output. Reversible gates preserve all information, which is essential for quantum computing and could dramatically reduce heat generation:

The Fredkin Gate

The Fredkin gate is a reversible 3-input gate. Given inputs A, B, C, outputs are:

  • P = A (passes through unchanged)
  • Q = If A=0 then B, else C
  • R = If A=0 then C, else B

Every reversible gate can be reversed—run the outputs backward to recover the inputs. This eliminates the energy cost of erasing information.

Neuromorphic Computing

Inspired by the brain, neuromorphic chips implement logic differently. Instead of Boolean true/false, they use analog "spike" signals. IBM's TrueNorth chip and Intel's Loihi represent this new paradigm, where logic emerges from timing and threshold behaviors rather than strict Boolean operations.

Quantum Logic Gates

Quantum computers use gates like Hadamard, CNOT, and Toffoli that operate on qubits in superposition. These gates manipulate probability amplitudes rather than definite 0s and 1s, yet they're still rooted in Boolean concepts.

Quantum circuit diagram showing quantum logic gates
A quantum circuit diagram. Quantum gates transform qubits, extending Boolean logic into the quantum realm. Source: Wikimedia Commons

Summary

From George Boole's 1847 treatise to today's 100-billion-transistor chips, Boolean logic has remained the unchanging foundation of digital computation. Three simple operations—AND, OR, NOT—combine to form everything from basic addition to artificial intelligence.

Key Takeaways

  • Universality: AND, OR, and NOT can express any computable function.
  • Physical implementation: Logic gates built from transistors make Boolean math real.
  • NAND is universal: Every circuit can be built from NAND gates alone.
  • Math from logic: Addition, subtraction, and all arithmetic reduce to Boolean operations.
  • The ALU: This circuit combines all operations into the computational heart of every processor.
  • Continuing evolution: Reversible and quantum gates extend Boolean concepts into new frontiers.

George Boole believed he was discovering the laws of human thought. He was partially right—he discovered the laws of computation, the framework that lets machines think in their own way. Every time you use a computer, every algorithm that runs, every AI that learns, is a testament to the power of Boolean logic.