Turing machines and their variants, recursive and recursively enumerable languages and their closure, the halting problem, reductions and Rice's theorem, and the table of decidable and undecidable problems that GATE tests.
Counting TMs against languages shows that some languages are not even recursively enumerable.
Concept notes
1. Turing machines and their variants
A Turing machine (TM) has a finite control and an infinite tape with a read/write head. Formally where is the tape alphabet and is the blank. A move writes over , moves the head one cell left or right () and enters state .
On an input a TM can accept (enter an accepting state and halt), reject (halt without accepting), or loop (never halt). This third outcome is what makes undecidability possible.
Equivalent models. These all accept exactly the same languages as the basic TM:
multi-tape TM (simulated on one tape with at most quadratic slowdown),
nondeterministic TM (simulated by breadth-first search over its choices; possibly exponential slowdown),
TM with a two-way infinite tape, multiple heads, or a stay-in-place move,
a PDA with two stacks (or a FIFO queue automaton).
A linear bounded automaton (LBA) is a nondeterministic TM that may use only the cells holding the input. LBAs accept exactly the context-sensitive languages, and membership for them is decidable.
Church–Turing thesis. Anything computable by an algorithm is computable by a TM. This is a thesis, not a theorem.
Reading a TM. To find what a TM computes, trace it on two or three short inputs and write each configuration as (tape, head position, state). Count moves carefully: each application of is one move.
A Turing machine: finite control, read/write head and an unbounded tape (⊔ is the blank)
2. Recursive and recursively enumerable languages
is recursively enumerable (RE, Turing-recognisable) if some TM accepts every string in . On strings not in it may reject or loop.
is recursive (decidable) if some TM accepts every string in and halts and rejects every string not in . Such a TM is a decider.
The complement theorem. is recursive if and only if both and are RE. (Run both recognisers in parallel; one of them must accept.) Consequences:
If is RE but not recursive, then is not RE.
The complement of a recursive language is recursive.
Operation
Recursive
RE
Union, intersection
Yes
Yes
Concatenation, Kleene star
Yes
Yes
Complement
Yes
No
Difference
Yes
No
Homomorphism
No
Yes
Inverse homomorphism
Yes
Yes
Non-RE languages exist. TMs can be listed as (each is a finite string), so there are countably many. The set of all languages over is uncountable. So most languages have no TM at all. The diagonal language is a concrete non-RE language.
An enumerator view: is RE iff some TM can list its strings (possibly with repeats); is recursive iff some TM can list them in increasing (shortlex) order.
3. The halting problem and reductions
and are both RE but not recursive.
RE: a universal TM simulates on and accepts if accepts (or halts).
Not recursive: if a decider existed, build that on input runs on and does the opposite. Running on gives a contradiction.
Hence and are not RE.
Mapping reduction. means a computable function maps every instance to with . It says " is at least as hard as ".
If and …
then …
is recursive
is recursive
is RE
is RE
is undecidable
is undecidable
is not RE
is not RE
The direction is the usual trap: to prove a new problem undecidable, reduce a known undecidable problem to , never the other way. Also, implies .
Other standard undecidable problems: Post's correspondence problem (PCP), whether a CFG is ambiguous, whether two CFGs generate the same language, whether a CFG generates , and whether two CFLs have an empty intersection. Most of these are proved by reductions from or PCP.
4. Rice's theorem
Rice's theorem. Let be any non-trivial property of the language of a TM: some TM's language has it and some TM's language does not. Then is undecidable.
Two conditions must hold before you apply it:
Language property. If , then and must both have or both lack it. Properties of the machine itself (states, moves, running time) are not covered.
Non-trivial. Not true for all RE languages and not false for all.
Question about TM
Decidable?
Reason
Is empty?
No
Rice
Is regular / context-free / finite?
No
Rice
Does contain ?
No
Rice (but this set is RE)
Is recursively enumerable?
Yes
trivial: always true
Does have more than 10 states?
Yes
read the description
Does make at least 20 moves on input ?
Yes
simulate 20 moves
Does halt on every input?
No
not by Rice directly, but by reduction from
RE or not? Rice says undecidable; it does not say whether the set is RE. A rough guide: " contains some particular string" is RE (search and wait for acceptance). "" and " is finite" are not RE, since no finite amount of watching can confirm them.
5. Decidability table across language classes
For each class, assume the language is given by its standard machine or grammar (DFA, CFG, decider TM, TM).
Problem
Regular
CFL
Recursive
RE
Membership
D
D
D
U
Emptiness
D
D
U
U
Finiteness
D
D
U
U
Universality
D
U
U
U
Equivalence
D
U
U
U
Disjointness
D
U
U
U
Subset
D
U
U
U
(D = decidable, U = undecidable.)
How the decidable ones work:
Regular: everything reduces to reachability in a DFA. Equivalence: build a DFA for the symmetric difference and test emptiness, or minimise both and compare.
CFL membership: CYK in . Emptiness: check whether the start symbol is generating. Finiteness: after removing useless symbols, check the grammar graph for a cycle.
Also undecidable for CFGs: ambiguity. But for a CFL and a regular language , is a CFL, so whether is decidable.
PCP is undecidable in general, but decidable when the alphabet has a single letter. When a question says "decidable", ask: is there an algorithm that always halts with the right yes/no answer? A procedure that halts only on yes-instances shows RE, not decidability.
Formulas to remember
Recursive iff RE and co-RE
Hierarchy
Reduction transfers hardness forward
Reduction transfers easiness backward
Complements under reduction
Common mistakes
Reversing the reduction: to prove B undecidable, reduce a known undecidable problem to B, not B to it.
Applying Rice's theorem to properties of the machine (number of states, steps taken) rather than of the language it accepts.
Treating 'undecidable' as 'not RE'; the halting problem is undecidable yet RE, while its complement is not RE.
Assuming RE languages are closed under complement; only recursive languages are.
Taking 'decidable' to mean an algorithm that answers yes when the answer is yes; it must also halt with no on every no-instance.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Tracing a TM: binary increment
numerical
A TM starts in on the leftmost symbol of a binary number. Rules: : on 0 or 1 move right (no change); on move left and go to . : on 1 write 0 and move left; on 0 or write 1 and halt. Find the output and the number of moves on input 1011.
Step 1: Run $q_0$ to the end of the input.
Try it on paper first.
Example 2: Using the complement theorem
conceptual
is recursively enumerable and is not recursive. What can you say about and ?
Step 1: Relate $L$ and $\overline{L}$.
Try it on paper first.
Example 3: Applying Rice's theorem correctly
conceptual
Which of these are decidable for a TM ? (i) has at least 3 strings. (ii) has an even number of states. (iii) visits state within its first 100 moves on input . (iv) for a fixed TM with .
Step 1: Sort into language and machine properties.
Try it on paper first.
Example 4: Getting the reduction direction right
conceptual
A student shows and claims is undecidable. Another shows . Which argument proves undecidability?
Step 1: Read $A \le_m B$ as 'B is at least as hard as A'.
Try it on paper first.
Previous year questions
16 official GATE CSE questions on this topic, newest first.
10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE CSE syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.