Non-deterministic Turing machine (NTM)

A non-deterministic Turing machine is a variant of the simple Turing machine. For every input at a state, there can be multiple paths/actions performed by the TM, meaning the transitions are not deterministic.

The difference between a deterministic TM and a non-deterministic TM is the same as a DFA and an NFA. A multi-tape Turing machine is used to construct an NTM.

Note: To learn more about the simple Turing machine, click here

Formal theorem

The non-deterministic Turing machine is a 6 tuple machine:(Q,Σ,q0,Γ,δ,F)(Q, Σ, q_0, \Gamma, δ, F)

  • QQ- set of states

  • ΣΣ- set of input alphabets

  • q0q_0- initial state

  • Γ\Gamma- set of tape alphabets

  • δδ- transition function that is

  Q ΓiP(Q Γi (Left,right,stationary)i)Q \space * \Gamma^i \to P(Q \space * \Gamma^i \space * (Left, right, stationary)^i)

  •  FF- set of final states

In the transition function, the left side of the transition is enclosed in PP (power set), which means that a state can move to more than one state on getting a particular input.

Computation tree

All possible transition sequences of a non-deterministic Turing machine on a given input string can be represented by a tree called a computation tree.

For example, for the given Non-deterministic TM:

g ENTRY q0 q0 ENTRY->q0 q1 q1 q0->q1 a/x,R q2 q2 q0->q2 a/y,L n n q1->n ... q2->n ...
A sample non-deterministic TM

The computational tree for input aaaa will be of the sort:

%0 node_1 aa node_2 xa node_1->node_2 node_3 ya node_1->node_3 node_1657712769209 ... node_2->node_1657712769209 node_1657712775228 ... node_2->node_1657712775228 node_1657715670166 ... node_3->node_1657715670166
A sample computational tree containing different paths

The outcome of a non-deterministic TM

There can be two outcomes for a given non-deterministic TM:

  • If any branch accepts the input string, then the NTM also accepts.

  • If all the branches halt or reject the input string, the NTM also rejects.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved