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

Turing Machines

Graduate Depth 91 in the knowledge graph ☐ I know this ☆ Set as goal
224topics build on this
427prerequisites beneath it
See this on the map →
Pushdown Automata (PDA)Equivalence of CFGs and Pushdown Automata+4 more→→Alternating Turing MachinesDecidable Languages+13 more
Turing-machine computation model tape decidability

Core Idea

A Turing machine (TM) is a finite-state control with an infinite read-write tape. At each step it reads the current tape symbol, writes a new symbol, moves left or right, and transitions to a new state. TMs can accept by entering an accept state, reject by entering a reject state, or loop forever. TMs are the formal model of computation underlying modern computer science — a language is computable if and only if some TM decides it (halting on all inputs). Compared to PDAs, the key power boost is the ability to read and rewrite the tape arbitrarily, not just use a stack.

How It's Best Learned

Design TMs for simple tasks: copy a string, test if a string is of the form aⁿbⁿ, or increment a binary number. Trace execution on concrete inputs to build intuition for how the tape replaces both the stack and the program's working memory.

Common Misconceptions

Explainer

You have already studied pushdown automata (PDAs), which extended finite automata with a stack. That stack was powerful — it let PDAs handle nested structures like balanced parentheses and context-free grammars — but the stack has a fundamental limitation: it is last-in, first-out and can only be accessed from the top. A Turing machine replaces the stack with an infinite tape that the machine can read and write anywhere, moving left or right at each step. This seemingly small change is enormous in computational power.

Formally, a Turing machine consists of a finite set of states, a tape alphabet, an initial state, accept and reject states, and a transition function. At each step, the machine reads the symbol under its tape head, writes a new symbol (possibly the same one), moves the head left or right, and transitions to a new state. Execution can end in three ways: the machine enters the accept state (it accepts the input), enters the reject state (it rejects), or runs forever (it loops). This third possibility — looping — has no analog in finite automata or PDAs, and it is what makes computability theory so rich and subtle.

The accept/decide distinction is the central conceptual divide in computability theory. A TM *recognizes* a language if it accepts every string in the language (though it may loop on strings not in it). A TM *decides* a language if it halts on every input — accepting members and rejecting non-members. Every decidable language is recognizable, but not every recognizable language is decidable. The halting problem is the canonical example of a language that is recognizable but not decidable: a TM can tell you when a program halts (by simulating it until it does), but no TM can always tell you when a program will loop forever.

Turing machines are the formal model underlying the Church-Turing thesis: the claim that any function a human can compute by following a mechanical procedure can also be computed by some Turing machine. This is not a theorem (it cannot be proved, since "mechanical procedure" is informal), but it has withstood every challenge. Quantum computers, parallel computers, and probabilistic machines all turn out to decide exactly the same class of languages as deterministic TMs — they differ in speed, not in what they can compute.

When designing a TM for practice, start simple: write a TM that copies a string, or one that recognizes {aⁿbⁿcⁿ}. Trace execution on a short input, writing out the tape contents and current state at each step. This builds the intuition you need before encountering decidability proofs, where you will argue about what TMs *cannot* do — one of the most surprising and important results in all of theoretical computer science.

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

Longest path: 92 steps · 427 total prerequisite topics

Prerequisites (6)

Leads To (15)