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

Space Complexity: PSPACE, L, and NL

Graduate Depth 94 in the knowledge graph I know this Set as goal
10topics build on this
495prerequisites beneath it
See this on the map →
Time Complexity Classes: P and EXPTIMEAsymptotic Notation: Big-O, Big-Omega, Big-Theta+2 moreEXPTIME and EXPSPACE Complexity ClassesPSPACE Complexity Class+2 more
PSPACE L NL space-complexity Savitch

Core Idea

Space complexity classes measure memory usage rather than time. PSPACE contains problems solvable in polynomial space (e.g., quantified Boolean formula satisfiability, TQBF), and is known to contain NP and P. The class L consists of problems solvable in logarithmic space on a deterministic TM; NL uses nondeterministic log space. Savitch's theorem shows NPSPACE = PSPACE, meaning nondeterminism buys much less in space than it might in time. Space and time complexity interact deeply: PSPACE ⊆ EXPTIME, and P ⊆ NP ⊆ PSPACE, but most containments are strict.

How It's Best Learned

Work through the TQBF PSPACE-completeness proof as the space analogue of Cook-Levin. Understand NL-completeness of graph reachability (ST-Connectivity) and how the Immerman-Szelepcsényi theorem shows NL = co-NL.

Common Misconceptions

Explainer

From your study of time complexity, you know that P and NP classify problems by how much *time* a Turing machine needs. Space complexity asks a different question: how many tape cells does the machine use? This shift in resource leads to a different — and in some ways richer — hierarchy of complexity classes, because space can be reused (you can overwrite a tape cell) while time cannot be recovered.

PSPACE contains all problems solvable using a polynomial amount of memory, regardless of how long the computation takes. Its complete problem is TQBF (True Quantified Boolean Formulas): given a Boolean formula with alternating universal and existential quantifiers, determine whether it is true. Think of TQBF as a two-player game — one player tries to make the formula true, the other tries to make it false, and they alternate choosing variable assignments. This game-theoretic flavor is characteristic of PSPACE problems: evaluating game positions, planning under adversarial conditions, and verifying properties of systems with alternating control all tend to land in PSPACE. We know P ⊆ NP ⊆ PSPACE ⊆ EXPTIME, but whether any of these containments are strict remains open.

At the other end of the space spectrum, L (logarithmic space) contains problems solvable using only O(log n) bits of working memory beyond the read-only input. This is barely enough to store a constant number of pointers into the input. NL (nondeterministic log space) allows nondeterministic guessing on that same tiny workspace. The canonical NL-complete problem is ST-Connectivity: given a directed graph, is there a path from s to t? A nondeterministic machine can guess the path one node at a time, needing only enough memory to store the current node. A remarkable result — the Immerman-Szelepcsényi theorem — shows that NL = co-NL, meaning if you can nondeterministically verify reachability, you can also nondeterministically verify *non*-reachability in log space.

The most surprising structural result is Savitch's theorem: NSPACE(f(n)) ⊆ DSPACE(f(n)²). This means nondeterminism gives at most a quadratic advantage in space, unlike the potentially exponential advantage it might give in time (the P vs NP question). The proof is elegant — it uses a recursive divide-and-conquer strategy to check whether a configuration is reachable in 2k steps by checking whether some midpoint configuration is reachable in 2k-1 steps from both ends. As an immediate corollary, NPSPACE = PSPACE, collapsing the nondeterministic and deterministic polynomial-space classes together. This contrasts sharply with time complexity, where NP and P are widely believed to differ.

Practice Questions 5 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 NPSpace Complexity: PSPACE, L, and NL

Longest path: 95 steps · 495 total prerequisite topics

Prerequisites (4)

Leads To (4)