Intuition The ONE core idea
A Turing Machine is normally a machine built to do one fixed job. The whole topic asks:
can we build one machine that reads a written description of any other machine and then
acts it out ? Yes — and that machine, the Universal Turing Machine , is why a single piece
of hardware can run any program: code is just data fed to an interpreter.
Before you can understand that sentence, you must be able to read every squiggle in it. This page
builds each symbol from absolute zero, in an order where nothing appears before it is earned. We
link the parent Universal Turing Machine and each
prerequisite as it enters.
We are not talking about metal and gears. In this subject a machine is a rule for changing a
row of symbols . Picture a long paper strip divided into boxes, and a tiny reading head sitting
over one box. That is the entire physical universe of the theory.
Look at Figure s01. The row of boxes is the tape; the yellow letters 1 0 1 1 are the input
sitting in the leftmost cells; the greyed boxes marked "blank" are empty cells we have not written
on yet (we will give this "blank" a proper symbol in §1); the red arrow is the head, pointing at
the one cell it is currently reading. Keep this picture in mind — every definition below is just a
label on some part of it.
The tape is an infinitely long strip of cells. Each cell holds one symbol (like 0, 1, or
an as-yet-unwritten "blank"). The picture (Figure s01): graph paper stretched forever.
Why we need it: it is the machine's memory and its worksheet at the same time — the only
place anything is stored.
Common mistake "The tape only stretches to the right."
Why it feels right: in Figure s01 we only drew blanks running rightward, because the input
starts at the left edge.
The fix: the standard textbook Turing machine has a tape that is two-way infinite — it
runs forever in both directions, so the head can never "fall off a left end". Some books use
a one-way (left-bounded) tape instead, where cell 0 is the leftmost cell and moving L from
it just stays put. Both variants compute exactly the same things, so choose one convention and
stick to it; in this note assume the two-way-infinite tape unless told otherwise. The equivalence
of such variants is the theme of Multi-tape vs Single-tape TM .
The head is the little pointer that sits over exactly one cell. It can read what's there,
write a new symbol there, and step one cell left or right. In Figure s01 it is the red arrow.
Why we need it: a machine can only look at one thing at a time — that limit is what makes the
model simple enough to reason about.
The head reads symbols , so we need names for the allowed symbols. This is also where we finally
put a proper name on the "blank" cells you saw in Figure s01.
Look at Figure s02. The small blue bag holds the input letters 0 1; the big green bag holds
those plus two extra symbols: the blank ⊔ and a scratch marker X . The small bag sitting
entirely inside the big one is the whole point: every input letter is also a tape letter, but not
vice-versa.
Σ and Γ
Σ (Greek capital "sigma") = the input alphabet : the symbols your input string is
allowed to be made of, e.g. { 0 , 1 } — the blue bag in Figure s02.
Γ (Greek capital "gamma") = the tape alphabet : every symbol that can ever appear
on the tape — the green bag. It always contains one distinguished blank symbol ⊔
(this is the proper name for the "blank" boxes drawn in Figure s01) that fills every
not-yet-used cell, and ⊔ is never allowed in Σ . So Σ ⊆ Γ
and ⊔ ∈ Γ ∖ Σ .
Why we need both: the machine often needs scratch symbols — extra symbols that were never
in the original input but are handy for bookkeeping — so those live in Γ but not Σ .
Definition Scratch symbol
X
A scratch symbol is any tape symbol in Γ ∖ Σ that is not the blank —
a marker the machine writes to remember a spot on the tape . We call our example one X . In
Figure s02 it sits in the green bag but outside the blue bag.
Why we need it: suppose a machine must remember "I already dealt with this cell". It cannot
use 0 or 1 (those are real data), so it overwrites the cell with X as a bookmark — for
instance, crossing off matched letters when checking whether an input is a palindrome. X never
appears in the input w ; it exists only as the machine's own note-to-self.
Σ and Γ are the same thing."
Why it feels right: in tiny examples the only symbols are 0 and 1, so the bags look
equal.
The fix: Γ almost always has extra symbols — at minimum the blank ⊔ , plus any
scratch markers like X — which can never be part of the input. The rule is Σ ⊆ Γ (read "Σ is contained in Γ ").
w
A string is a finite row of symbols written left to right, e.g. 1011. The parent note
writes w for the input string — the actual data you hand the machine to work on. In Figure
s01 it is the yellow 1 0 1 1 sitting in the leftmost cells, with blanks stretching away after
it. Why we need it: every "run" of a machine starts by placing w on the tape and pointing
the head at its first cell.
The machine also has an internal "mood" that decides how it reacts — this is a state .
Look at Figure s03. The four circles labelled q 0 , q 1 , q a cc , and q r e j are states
— think of a dial that can be set to one of them at a time. The red arrow between them, tagged
"read 1: write 0, move R", is a single rule that moves the dial from one state to another. That
arrow is exactly a row of δ , which we define in the next section.
Q
A state is the machine's current internal mode, like a mood or a step-number in a recipe.
Q (capital "Q") is the finite set of all states . We name individual states q 0 , q 1 , q 2 , … — the little number is just a label, an ID tag. In Figure s03 each circle is one
element of Q .
Why we need it: with only a head reading one symbol, the machine would have no memory of
what it's in the middle of doing — the state IS that short-term memory.
Three states get special jobs (all four appear as circles in Figure s03):
q 0 = the start state : where the dial begins.
q a cc = the accept state : reaching it means "YES, halt and accept" (the green double
ring in Figure s03).
q r e j = the reject state : reaching it means "NO, halt and reject" (the red double ring in
Figure s03).
0 i + 1 " appears in the parent
The parent writes each state q i as 0 i + 1 — that means "the symbol 0 repeated i + 1
times". So q 0 → 0, q 1 → 00, q 2 → 000. This is just unary counting :
tally marks. Why: to write a state down as a string we need a symbol-recipe, and tally
marks are the simplest one a machine can parse.
Now the engine: the rulebook that ties state + read-symbol to an action. In Figure s03 it is drawn
as the labelled red arrow between two state-circles; here we write that same arrow in symbols.
δ (the transition function)
δ (Greek lowercase "delta") is the transition function : the complete table of
"if–then" rules. Each row looks like
δ ( q i , a ) = ( q j , b , D ) , D ∈ { L , R } .
Read it out loud: "If the dial is in state q i and the head reads symbol a ,
then write symbol b in that cell, move the head direction D , and switch the dial
to state q j ." Here D is either L (step left) or R (step right).
Picture a lookup table: input column ( q i , a ) , output column ( q j , b , D ) .
δ says nothing about q a cc and q r e j
By convention δ is defined only for the non-halting states, i.e. for q in
Q ∖ { q a cc , q r e j } . The moment the dial lands on q a cc or q r e j the
machine stops immediately — there is no "next rule" to look up, because those are the
halting states . So the domain of δ is
( Q ∖ { q a cc , q r e j }) × Γ ,
and q a cc , q r e j never appear on the left of a rule, only ever on the right (as a
destination). That is precisely why, in Figure s03, arrows end at q a cc and q r e j but
none leave them.
Why δ is the whole personality of the machine. Everything a machine does — add,
palindrome-check, loop forever — is encoded entirely in this finite table. Two machines differ
only in their δ . That is exactly why we can hope to write δ down as a string and
hand it to another machine: it is finite.
M = ( Q , Σ , Γ , δ , q 0 , q a cc , q r e j )
Bundling everything: a Turing machine M is just this 7-part package — its states, its two
alphabets Σ and Γ (recall Γ reserves a blank ⊔ ∈ Γ ∖ Σ ), its rulebook δ , and its three special states q 0 , q a cc , q r e j .
The angle-bracket-free letter M is a name for one specific such machine. See
Turing Machine for the full build.
M ( w ) means
The notation ==M ( w ) == is read "run machine M on input string w ". It denotes the ==function
computed by M == — the outcome of starting M with w on the tape, head on its first cell,
dial at q 0 , and letting the rules of δ fire until (if ever) a halting state is reached.
The value M ( w ) is one of exactly three things: accept , reject , or loops forever
(never halts) . So M ( ⋅ ) is the machine viewed as a black-box function from strings to
outcomes.
Here is the leap that makes the whole topic possible.
⟨ M ⟩
⟨ M ⟩ (angle brackets around M ) means "==the description of M written out as a
finite string==". It is M 's rulebook, states, and alphabet all spelled out in a fixed code
over a fixed alphabet. Picture printing the entire lookup table of Figure s03 onto the tape
itself , as data.
Why we need it: a machine can only be fed strings. To let one machine read another, the
second machine must first be turned into a string . ⟨ ⋅ ⟩ is that
turning-into-a-string operation.
⟨ M , w ⟩
The parent also writes ⟨ M , w ⟩ — "==the encoding of the pair ( M , w ) ==", i.e. the
program and its data glued into one string . Concretely: take ⟨ M ⟩ , append a
separator that cannot occur inside either piece (for the unary scheme in the parent, the
block 111 already marks the end of the machine), then append the string w :
⟨ M , w ⟩ = ⟨ M ⟩ separator 111 w .
Because the separator is chosen so the reader can always tell where ⟨ M ⟩ stops and
w begins, the single string ⟨ M , w ⟩ can be unambiguously split back into M 's
description and its input. The comma in ⟨ M , w ⟩ is therefore just shorthand for
"these two things, encoded one after another with a marker between them".
⟨ M ⟩ is a different, special kind of object."
The fix: ⟨ M ⟩ (and ⟨ M , w ⟩ ) is literally just a string , like
111010011.... The angle brackets are a reminder of what it means , not a new type of thing.
Because it is an ordinary string, it can be fed to a machine as data — that is the entire trick.
U
U names the Universal Turing Machine — one fixed machine that reads ⟨ M ⟩ and
w and acts out M on w . The parent writes
U (⟨ M ⟩ , w ) = M ( w ) ,
read: "running U on the description of M together with w gives the same answer as running
M directly on w ." Picture a robot that reads an instruction manual (⟨ M ⟩ ) and
then follows it on your data (w ). Here M ( w ) is exactly the black-box outcome we defined in
§4 — accept, reject, or loop.
⟺ (if and only if)
⟺ (a double-headed arrow, read "if and only if ", sometimes shortened to "iff") is a
two-way promise between two statements . "P ⟺ Q " means both "if P then Q " and
"if Q then P " — so P and Q are always true together and false together, like two lights
wired to the same switch. Why we need it: we want to say U and M behave the same in
both directions, not just one.
↓
↓ (down-arrow) means "halts " — the machine stops (either accepts or rejects) rather
than running forever. The parent's statement
U on ⟨ M , w ⟩ ↓ ⟺ M on w ↓
reads, using the two symbols we just defined: "U stops if and only if M stops" — the
⟺ makes it a two-way promise (stop-together and loop-together). Why we need this
symbol: not every machine halts; we need shorthand to talk precisely about whether it does.
Machines that may never halt are the world of Recursively Enumerable Languages .
These foundations feed three big destinations you'll meet after this note:
The idea "fixed machine + variable program on tape" is exactly the Stored-Program Computer
and von Neumann Architecture .
Feeding U a description of itself (⟨ U ⟩ ) seeds Diagonalization and the
Halting Problem .
The claim that U is not more powerful — just more flexible — is the Church-Turing Thesis .
The multi-tape design of U relies on Multi-tape vs Single-tape TM equivalence.
How to read the map below. Read it top-to-bottom: each box is a foundation from this page, and
an arrow "X → Y " means "you need X before Y makes sense". Start at Tape and Head (§0);
it lets us talk about Alphabets (§1), which lets us talk about strings and w (§2). Separately,
the States box (§3) and the alphabets feed the Transition function δ (§4). Bundle those
and you get the Machine tuple M ; encode that tuple as a string and you get Encoding of M
(§5); feed that plus states into the Universal machine U (§6). The final box shows the two
topics this page unlocks.
Alphabets Sigma and Gamma
States set Q and q0 qacc qrej
Transition function delta
Encoding of M as a string
Universal Turing Machine U
Stored-Program and Halting Problem
Cover the right side and test yourself — you're ready for the parent note when every line is easy.
What is the tape? An infinite strip of cells, each holding one symbol — the machine's memory and worksheet.
Is the standard tape one-way or two-way infinite? Standard textbook TMs use a two-way-infinite tape; one-way (left-bounded) variants exist and compute the same things.
What does the head do? Sits over one cell; it can read, write, and step one cell left or right.
Difference between Σ and Γ ? Σ = input alphabet; Γ = tape alphabet including the reserved blank; Σ ⊆ Γ .
Where does the blank symbol ⊔ live? In Γ but never in Σ ; i.e. ⊔ ∈ Γ ∖ Σ , and it fills every unused cell.
What is a scratch symbol like X ? A tape symbol in Γ ∖ Σ (not the blank) the machine writes as a bookmark; it never appears in the input.
What is w ? The input string — the data placed on the tape at the start of a run.
What is a state, and what is Q ? A state is the machine's current internal mode; Q is the finite set of all states.
What do q 0 , q a cc , q r e j mean? Start state, accept (halt-yes) state, reject (halt-no) state.
On which states is δ undefined? On the halting states q a cc and q r e j ; its domain is ( Q ∖ { q a cc , q r e j }) × Γ .
Read δ ( q i , a ) = ( q j , b , D ) aloud. In state q i reading a : write b , move direction D , switch to state q j .
What is D ∈ { L , R } ? The move direction — left or right by one cell.
What does M ( w ) denote? The function computed by M — the outcome (accept, reject, or loop) of running M on input w .
What does ⟨ M ⟩ mean? The finite-string description (the "program") of machine M , over a fixed alphabet.
What does ⟨ M , w ⟩ mean? The pair ( M , w ) encoded as one string: ⟨ M ⟩ , a separator, then w — splittable back into the two.
Why can any machine be encoded as a string? Because Q , Γ , and δ are all finite, so the whole rulebook is a finite table.
What does ⟺ mean? If and only if — a two-way promise: both statements are true together and false together.
What does U (⟨ M ⟩ , w ) = M ( w ) say? Running U on M 's description plus w gives the same answer as M run directly on w .
What does ↓ mean? The machine halts (stops), as opposed to looping forever.