The Universal Turing Machine

Learn about the motivation behind a universal Turing machine and the process of encoding a Turing machine as a string.

The rationale for a universal Turing machine

The Turing machines we have seen so far are single-purpose automata—they only solve one problem or accept one language. Alan Turing went beyond that in his research to define a universal machine, a TM\text{TM} capable of simulating any other TM\text{TM}. The universal Turing machine (UTM)\text{(UTM)} takes two inputs: a symbolic encoding of another machine and an input string. It then simulates the execution of the input machine on the input string and yields the result of that execution. This should sound familiar—that’s exactly how general-purpose computers operate, and the UTM\text{UTM} is where the idea of a stored-program computing mechanism originated. In other words, programs are just strings (rendered in some encoding) fed into a computer, and the computer runs the program on whatever input we give it.

Note: Just as a Turing machine models a specific computational process, the universal Turing machine models a computer.

Converting a Turing machine for use in a UTM

Recall that the operation of a TM\text{TM} is defined by its transition function, δ\delta. Each element in δ\delta is a pairing of two inputs with three outputs, which we can represent as a 5-tuple. For example, the transition δ(q0,a)=(q1,b,)\delta(q_0,a)=(q_1,b,\to) can be represented in text by the string “q0,a,q1,b,Rq_0,a,q_1,b,R”.

Now let’s consider how to write a program to act as a UTM\text{UTM} using such input. Our program needs to know the start state, the halt state(s), and each transition in δ\delta.

Get hands-on with 1200+ tech skills courses.