Follow your curiosity

What discovery has been shared with you?

Start with one fact. Explore it, go deeper, then follow whichever branch catches your imagination.

Choose subjects for a surprise

Exploring any topic

Begin your discovery

Your next discovery is one click away.

Choose one or more subjects above, or leave Any Topic selected and let curiosity decide.

Mathematics

The Turing Machine and the Halting Problem

Quick fact

The halting problem is undecidable: no Turing machine can correctly decide, for every possible program and input, whether that program will finish running or loop forever. This was proven by Alan Turing in 1936, the same year he introduced the Turing machine.

Why this is interesting

Imagine a machine that can compute anything—yet there’s a simple question it can never answer. What is that question?

Read the full explanation

Understanding The Turing Machine and the Halting Problem

A Turing machine is an idealized device that manipulates symbols on an infinite tape according to a set of rules. Despite its simplicity, it can perform any computation that a modern computer can, given enough time and memory. It has a tape head that reads and writes one symbol at a time, and a finite set of states that define its behavior. The halting problem asks: given a Turing machine and an input, will the machine eventually halt (stop) or run forever? It seems like a basic question, but Turing proved that no general algorithm can solve it. He did this using a clever self-referential argument—a kind of diagonalization, similar to Cantor's proof that there are more real numbers than integers. Think of a universal Turing machine that can simulate any other Turing machine. Imagine we ask: can we build a machine H that takes as input the description of any Turing machine M and an input w, and decides whether M halts on w? Turing showed that if such an H existed, we could create a paradox—a machine that halts exactly when it should not, leading to a contradiction. This impossibility is what we call the halting problem being undecidable.

A deeper explanation

The power of the Turing machine lies in its universality: a single machine can be programmed to perform any computation, given an appropriate description. This description itself can be encoded as input to another Turing machine, allowing machines to reason about other machines. To prove the halting problem is undecidable, assume there exists a Turing machine H that decides it. That is, H takes an encoded pair (M, w) and outputs 'yes' if M halts on w, and 'no' otherwise. Using H, we can construct a new machine D that does the following: on input M, D runs H on (M, M) and then does the opposite of H's output. If H says M halts, D loops forever; if H says M does not halt, D halts. Now consider what happens when D is given its own description as input. If D halts on D, then H says it halts, so D loops forever—contradiction. If D loops forever, then H says it does not halt, so D halts—again contradiction. Therefore, H cannot exist, and the halting problem is undecidable. This result is profound: it shows there are well-defined problems that cannot be solved by any algorithm, no matter how powerful. It also has deep connections to Gödel's incompleteness theorems, illustrating the limits of formal systems and the boundaries of human understanding.

Keep FACTREE close

Internet access is required. Updates arrive when you reopen or reload the app. You may need to sign in again in the installed app.