NP-Completeness

College Depth 72 in the knowledge graph I know this Set as goal
Unlocks 27 downstream topics
complexity NP-complete hardness intractability

Core Idea

A problem is NP-complete if it is in NP and every problem in NP reduces to it in polynomial time — it is simultaneously the hardest class of problems in NP. If any NP-complete problem has a polynomial-time algorithm, then P = NP and all NP problems become tractable. Hundreds of natural problems from combinatorics, graph theory, logic, and optimization are NP-complete. The NP-completeness framework, introduced by Cook and Karp in the early 1970s, provides rigorous grounds for arguing a problem is computationally intractable.

How It's Best Learned

Build a mental map of NP-complete problems and their reduction relationships: SAT → 3-SAT → 3-Coloring → Clique → Independent Set → Vertex Cover. Understanding these reductions both proves completeness and reveals deep structural connections between seemingly unrelated problems.

Common Misconceptions

Explainer

Before NP-completeness, theoretical computer scientists had a troubling collection of practically important problems — Boolean satisfiability, graph coloring, traveling salesman, protein folding — that seemed hard but could not be proven hard in any absolute sense. The theory of NP-completeness, introduced by Cook and Karp in the early 1970s, gave these problems a rigorous shared status.

Recall that NP is the class of decision problems whose solutions can be *verified* in polynomial time. You may not know how to find a solution quickly, but given a candidate solution, you can check it fast. A problem X is NP-complete if it satisfies two conditions: (1) X is in NP, and (2) every other problem in NP reduces to X in polynomial time. The second condition is the powerful one — it means X is at least as hard as every problem in NP simultaneously.

Polynomial-time reductions are the mechanism. A reduction from problem A to problem B is a polynomial-time transformation that converts any instance of A into an instance of B with the same yes/no answer. If every NP problem reduces to X, and you could solve X in polynomial time, you could solve all of NP in polynomial time — i.e., P = NP. The Cook-Levin theorem established SAT as the first NP-complete problem by showing that any NP computation can be encoded as a Boolean formula. From there, Karp (1972) showed 21 additional natural problems were NP-complete by chaining reductions: SAT → 3-SAT → 3-Coloring → Clique → Vertex Cover → and so on.

The standard proof strategy for a new problem Y follows a two-step template: show Y is in NP (exhibit a polynomial verifier), then reduce a known NP-complete problem to Y in polynomial time (showing Y is at least as hard). Notice the direction: you reduce the known-hard problem *to* Y, not Y to the known-hard problem. Getting this direction wrong is a common source of errors.

A critical clarification: NP-completeness does not mean a problem is unsolvable or that no algorithm exists. Exact algorithms that explore the full solution space run in exponential time, but they exist. The practical consequence is that for large inputs, exact solutions are infeasible — but approximation algorithms, parameterized algorithms, and special-case analyses often deliver good results in practice. NP-completeness closes off the search for a fast general-purpose solver; it does not close off useful computation.

Practice Questions 3 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication 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 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsInteger Order of OperationsVariable ExpressionsCombining Like TermsOne-Step EquationsTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesLiteral EquationsSlope-Intercept FormPoint-Slope FormWriting Linear EquationsParallel and Perpendicular Line SlopesGraphing Linear EquationsPiecewise FunctionsStep FunctionsComposition of FunctionsInverse FunctionsRadical Functions and GraphsRational ExponentsExponential Functions and GraphsLogarithms IntroductionBig-O Notation and Asymptotic AnalysisBreadth-First Search (BFS)Shortest Paths in Unweighted GraphsDijkstra's Shortest Path AlgorithmAlgorithm Analysis and Big-O NotationTuring MachinesThe Church-Turing ThesisThe Halting ProblemComputability ReductionsPolynomial-Time ReductionsLower Bounds Techniques in Computational ComplexityNP-Completeness

Longest path: 73 steps · 414 total prerequisite topics

Prerequisites (10)

Leads To (15)