What is a Turing machine?
by Stephen M. Walker II, CoFounder / CEO
What is a Turing machine?
A Turing machine is a mathematical model of computation that was first proposed by the mathematician Alan Turing in 1936. It's an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite its simplicity, a Turing machine is capable of simulating any computer algorithm, no matter how complex.
A Turing machine operates on an infinite memory tape divided into discrete cells. Each cell holds a single symbol from a finite set, known as the alphabet. The machine's "head" reads the symbol on the cell it's positioned over, edits the symbol by writing a new one, or moves left or right to the next cell.
The machine's behavior is determined by its current state and the symbol it's reading. It starts in a specific state and performs actions specified by a transition function, which defines the actions based on the current state and symbol. The computation is considered successful if it reaches an accept state, and unsuccessful if it reaches a reject state.
Turing machines are used to study algorithm properties, determine computable problems, and analyze computational complexity, which is the time and memory required to solve a problem. Essentially, a Turing machine can compute anything a real computer can.
How does a Turing machine work?
A Turing machine, first proposed by Alan Turing in 1936, is a theoretical model of computation that provides a simple yet powerful framework for understanding the nature of algorithms and computation. It's a mathematical abstraction used to study and define algorithms and computational processes. Despite its simplicity, a Turing machine can simulate any computer algorithm, no matter how complex.
A Turing machine consists of the following components:

A tape — This is an infinite memory tape divided into discrete cells. Each cell can hold a single symbol from a finite set of symbols, known as the alphabet. The tape is infinite in both directions, providing unlimited memory for the machine.

A tape head — This is a movable device that can read and write symbols on the tape, one cell at a time. It can move left or right along the tape.

A state register — This is a finite control mechanism that can be in any one of a finite set of states. It keeps track of the current state of the machine.

A transition function — This is a set of rules that determines the next state of the machine based on the current state and the symbol being read on the tape. It also determines what symbol to write on the tape and which direction to move the tape head.
The operation of a Turing machine is fully determined by these elementary instructions. For example, a rule might be "in state 42, if the symbol seen is 0, write a 1; if the symbol seen is 1, change into state 17; in state 17, if the symbol seen is 0, write a 1 and change to state 6;" and so on.
The Turing machine starts with an input string of symbols from its alphabet written on the tape. The machine then moves from state to state, reading and writing symbols on the tape according to its transition function, until it reaches a special halt state, at which point the computation ends. The final state of the tape represents the output of the computation.
What is the difference between a Turing machine and a modern computer?
A Turing machine and a modern computer share the fundamental principle of being able to perform computations, but they differ in several key aspects:

Theoretical vs Practical — A Turing machine is a theoretical model of computation, proposed by Alan Turing in 1936, to study the principles of computation and to understand the limits of what can be computed. On the other hand, a modern computer is a practical implementation of these principles, designed to perform realworld tasks.

Memory — A Turing machine operates on an infinite memory tape, which allows it to theoretically perform computations of any size. In contrast, a modern computer has a finite amount of memory, which limits the size of the computations it can perform.

Universality — Some Turing machines are "universal", meaning they can perform any computation given the appropriate input. However, not all Turing machines have this property; many can only perform specific computations. Modern computers, on the other hand, are designed to be generalpurpose and can run a wide variety of programs.

Speed and Efficiency — Turing machines are not designed with speed or efficiency in mind, as they are theoretical models. Modern computers, however, are designed to be as fast and efficient as possible, with hardware and software optimizations that are not present in the Turing machine model.

Interactivity — Modern computers are interactive, meaning they can receive input and produce output in realtime, while a Turing machine operates in a more linear and deterministic manner.
Despite these differences, the concept of Turing completeness is often used to describe modern computers and programming languages. A system is said to be Turing complete if it can simulate a Turing machine, meaning it can perform any computation that a Turing machine can, given enough time and memory. This is a fundamental concept in computer science and underpins the design of modern computers and programming languages.
What is the difference between a Turing machine and a finite state machine?
A Turing machine and a finite state machine (FSM) are both models of computation, but they differ in several key aspects:

Memory — A Turing machine has an infinite tape that it uses as memory, allowing it to store and manipulate data during computation. In contrast, an FSM does not have any memory beyond its current state. This means that an FSM's computation is solely determined by its current state and the input it receives, with no ability to store or recall past inputs.

Computational Power — Turing machines have greater computational power than FSMs. This is because a Turing machine can simulate an FSM, but an FSM cannot simulate a Turing machine due to its lack of memory. Turing machines can recognize not only regular languages (which FSMs can recognize) but also contextfree languages, contextsensitive languages, and recursively enumerable languages.

Language Classes — FSMs describe a small class of languages known as regular languages. These are languages that can be expressed with a regular expression or a regular grammar. On the other hand, Turing machines describe a much larger class of languages, including the class of recursively enumerable languages. This is a result of their greater computational power and memory capabilities.

Practical Applications — FSMs are often used in systems where the behavior can be fully determined by the current state and the input, such as traffic lights, vending machines, and digital circuits. Turing machines, being theoretical models, are primarily used in the study of computation, algorithms, and the limits of what can be computed.