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 Time3-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 ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesFinite State Machines (FSMs)Deterministic Finite Automata (DFA)Nondeterministic Finite Automata (NFA)Two-Way Finite AutomataNFA to DFA Conversion (Subset Construction)DFA Properties and Minimization AlgorithmsRegular Languages: Definition and CharacterizationContext-Free Grammars (CFGs)Pushdown Automata (PDA)Equivalence of CFGs and Pushdown AutomataClosure Properties of Context-Free LanguagesLimitations of Context-Free LanguagesPumping Lemma for Context-Free LanguagesTuring MachinesVariants of Turing Machines and EquivalenceNondeterministic Time Complexity and NPThe P vs. NP ProblemComplexity Class P: Polynomial TimeComplexity Class NP: Nondeterministic Polynomial TimeNP-Completeness and Cook-Levin Theorem

Longest path: 98 steps · 499 total prerequisite topics

Prerequisites (1)

Leads To (20)