A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

NP-Completeness and Cook-Levin Theorem

Graduate Depth 97 in the knowledge graph ☐ I know this ☆ Set as goal
57topics build on this
499prerequisites beneath it
See this on the map →
Complexity Class NP: Nondeterministic Polynomial Time→→3-SAT and k-SAT VariantsApproximation Algorithms (LP Relaxation and Primal-Dual)+18 more
np-completeness cook-levin hardness

Core Idea

A language is NP-complete if it is in NP and every language in NP reduces to it in polynomial time. The Cook-Levin theorem proves that boolean satisfiability (SAT) is NP-complete. NP-complete problems are presumed intractable; a polynomial-time algorithm for any NP-complete problem would imply P = NP.

Explainer

From your study of nondeterministic polynomial time (NP), you know that NP is the class of decision problems whose solutions can be *verified* in polynomial time — even if finding a solution might seem hard. NP-completeness identifies a special core within NP: the problems that are, in a formal sense, maximally difficult for the entire class.

A problem is NP-complete if it satisfies two conditions. First, it must be in NP — a witness (a proposed solution) can be checked efficiently. Second, every problem in NP must be polynomial-time reducible to it. This second condition is what makes NP-complete problems remarkable: they are universal difficulty benchmarks. If you could solve one NP-complete problem in polynomial time, the reduction structure would give you polynomial-time algorithms for *every* problem in NP — and we would have P = NP.

The Cook-Levin theorem established the first NP-complete problem: boolean satisfiability (SAT). The proof works by showing that any nondeterministic polynomial-time computation can be encoded as a SAT instance — the variables represent the bits of the machine's computation and the clauses enforce the machine's transition rules. This was a profound result: it showed that SAT captures all of NP inside it. Once SAT was known to be NP-complete, proving other problems NP-complete became easier — you just need to show they are in NP and that SAT (or some already-known NP-complete problem) reduces to them in polynomial time.

It is important to resist two common misreadings. First, NP-complete does not mean "impossible" or "unsolvable" — it means no polynomial-time algorithm is currently known. For small instances, many NP-complete problems are solved routinely by exact or approximation algorithms. Second, and more subtly, the conjecture that P ≠ NP is still *unproven*. We believe it strongly — intuitively, verifying a solution feels easier than finding one — but a mathematical proof has eluded computer scientists for over fifty years. The P vs. NP question remains open.

For practical purposes, proving that your problem is NP-complete is actually useful: it tells you to stop searching for an efficient exact algorithm and instead look to approximation algorithms, heuristics, or special-case structure. It shifts the question from "why can't I solve this efficiently?" to "what is the best we can do given this hardness?"

Practice Questions 3 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Finite State Machines (FSMs) → Deterministic Finite Automata (DFA) → Nondeterministic Finite Automata (NFA) → Two-Way Finite Automata → NFA to DFA Conversion (Subset Construction) → DFA Properties and Minimization Algorithms → Regular Languages: Definition and Characterization → Context-Free Grammars (CFGs) → Pushdown Automata (PDA) → Equivalence of CFGs and Pushdown Automata → Closure Properties of Context-Free Languages → Limitations of Context-Free Languages → Pumping Lemma for Context-Free Languages → Turing Machines → Variants of Turing Machines and Equivalence → Nondeterministic Time Complexity and NP → The P vs. NP Problem → Complexity Class P: Polynomial Time → Complexity Class NP: Nondeterministic Polynomial Time → NP-Completeness and Cook-Levin Theorem

Longest path: 98 steps · 499 total prerequisite topics

Prerequisites (1)

Leads To (20)