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

Time and Space Hierarchy Theorems

Graduate Depth 101 in the knowledge graph ☐ I know this ☆ Set as goal
3topics build on this
738prerequisites beneath it
See this on the map →
Space Complexity: PSPACE, L, and NLTime Complexity and the Class P+3 more→→Space Hierarchy Theorem
hierarchy lower-bounds separations

Core Idea

The time hierarchy theorem states that if f(n) log f(n) < g(n), then DTIME(f(n)) ⊊ DTIME(g(n)): more time provably allows computation of strictly harder problems. Space hierarchy is analogous. These theorems rigorously separate complexity classes and show that the complexity landscape has unbounded 'height'—no single complexity class contains all computable languages.

Explainer

You already know complexity classes like P and EXPTIME, and that DTIME(f(n)) is the class of problems solvable in O(f(n)) time. A natural question is whether these classes are genuinely distinct — does having more time *actually* let you solve harder problems? The time hierarchy theorem answers yes, rigorously. If g(n) grows faster than f(n) log f(n), then DTIME(g(n)) strictly contains DTIME(f(n)): problems exist that require roughly g(n) steps but cannot be solved in f(n) steps. As a corollary, P ⊊ EXPTIME — exponential time is provably more powerful than polynomial time.

The proof uses diagonalization, the same technique behind the undecidability of the halting problem. Construct a machine D that, on input ⟨M, 1n⟩, simulates M for g(n) steps and does the opposite of whatever M would do. If any machine M in DTIME(f(n)) could solve the same problem as D, we get a contradiction when we feed D its own description. The log factor in the condition f(n) log f(n) < g(n) is a technical overhead needed for the universal TM simulation. For the space hierarchy theorem, the condition is simpler — f(n) = o(g(n)) suffices — because space can be reused and the simulation overhead is smaller.

These theorems are foundational because without them, the complexity hierarchy could collapse. Perhaps P = EXPTIME, or every problem solvable in space n is also solvable in space log n. The hierarchy theorems rule this out: the complexity landscape is genuinely infinite, with strict containments at every level of increased resources. This gives complexity theory its structure — there is no "maximum" class of tractable problems, and no single resource bound captures all of computation.

An important subtlety is what the hierarchy theorems do *not* prove. They separate DTIME classes by time, but they cannot separate P from NP, or NP from PSPACE. Those separations require *lower bounds* — proofs that specific problems require a certain amount of resources — and such lower bounds remain largely elusive. The hierarchy theorems are unconditional separations achieved by the clever diagonalization construction, whereas most separations in complexity theory (like P ≠ NP) require reasoning about the structure of actual computational problems, a far harder task.

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 → Complexity Class P: Polynomial Time → Complexity Class NP: Nondeterministic Polynomial Time → NP-Completeness and Cook-Levin Theorem → The Cook-Levin Theorem → Boolean Satisfiability, Cook-Levin, and Reductions → Exponential Time Hypothesis → Time and Space Hierarchy Theorems

Longest path: 102 steps · 738 total prerequisite topics

Prerequisites (5)

Leads To (1)