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

The P vs. NP Problem

Graduate Depth 94 in the knowledge graph ☐ I know this ☆ Set as goal
102topics build on this
495prerequisites beneath it
See this on the map →
Nondeterministic Time Complexity and NP→→Complexity Class P: Polynomial Time
P-vs-NP open-problem complexity foundations

Core Idea

The P vs. NP problem asks whether every problem whose solution can be verified in polynomial time can also be solved in polynomial time: does P = NP? It is one of the seven Millennium Prize Problems and widely considered the most important open question in computer science. Most researchers believe P ≠ NP — that some problems are intrinsically harder to solve than to verify — but no proof exists. A P = NP proof would imply efficient algorithms for optimization, cryptography, and AI problems; P ≠ NP underpins the security of virtually all modern cryptographic systems.

How It's Best Learned

Study why the question is hard to resolve: both directions require proving a lower bound (that no polynomial algorithm exists) or an algorithm, both of which have resisted all attempts. Examine the philosophical and practical consequences of each outcome.

Common Misconceptions

Explainer

From your study of nondeterministic complexity, you know that the class NP consists of decision problems where a "yes" answer can be *verified* in polynomial time given a suitable certificate. The class P consists of problems that can be *solved* in polynomial time. Every problem in P is also in NP — if you can solve it quickly, you can certainly verify a solution quickly. The P vs. NP question asks whether the reverse is also true: can every efficiently verifiable problem also be efficiently solved?

Consider the Boolean satisfiability problem (SAT): given a logical formula, is there an assignment of true/false to its variables that makes the formula true? If someone hands you a candidate assignment, you can plug in the values and check in polynomial time — so SAT is in NP. But finding a satisfying assignment from scratch seems to require searching through exponentially many possibilities. No one has found a polynomial-time algorithm for SAT, nor has anyone proved that no such algorithm exists. This is the essence of the P vs. NP problem.

The reason the question is so hard to resolve is that it demands something unusual from mathematics. Proving P = NP would require discovering a single clever algorithm — but proving P ≠ NP requires showing that *no possible algorithm*, no matter how ingenious, can solve certain problems in polynomial time. This is a lower bound proof, and lower bounds are notoriously difficult in complexity theory. Decades of attempts have produced barrier results (relativization, natural proofs, algebrization) showing that most known proof techniques are fundamentally incapable of resolving the question.

The practical stakes are enormous. If P = NP, then problems in scheduling, protein folding, circuit design, and artificial intelligence would all have efficient solutions — and modern cryptography, which relies on the assumed hardness of problems like integer factorization and discrete logarithms, would collapse. If P ≠ NP (the consensus belief), it would confirm that verification is fundamentally easier than discovery — a principle that resonates far beyond computer science. It would mean that creativity in finding solutions is genuinely harder than the mechanical task of checking them, providing a formal foundation for the security guarantees that underpin digital commerce, communication, and trust.

Practice Questions 5 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

Longest path: 95 steps · 495 total prerequisite topics

Prerequisites (1)

Leads To (1)