Design Turing machine for multiplication

Data Structure AlgorithmsComputer ScienceComputers

A Turing machine is a seven tuples

(Q, Σ, Γ, δ, q0, qacc, qrej)


  • Q is a finite set of states;

  • Σ is the input alphabet does not contain the blank symbol t;

  • Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ;

  • δ: (Q × Γ) → (Q × Γ × {L, R}) is the transition function;

  • q0 ∈ Q is the start state;

  • qacc ∈ Q is the accept state;

  • qrej ∈ Q is the reject state, where qrej ≠ qacc.


Construct Turing machine (TM) for multiplication of two unary integers.


Multiplication of two unary integers
In Turing Machine 3 represents − 111
                  2 represents − 11

Let ‘M’ be a symbol used to separate two integers


Here B= blank

M= Symbol used two separate two integers

⇑= Head

After performing multiplication, the output is as follows −


The TM for multiplication is given below −


  • q0 − Looking at the first unused symbol in input.

  • q0 − Looking at the first unused symbol in input.

  • q1 − Found a 1 in the first factor; skipping to the x symbol

  • q2 − Found x

  • q4 − Found a 1 in the second factor; changed it to Y; skipping to the =

  • q3 − Used all the 1s in the second factor; convert the Ys back to 1s

  • q5 − Skipping to end of tape

  • q6 − Skipping back to =

  • q7 − Skipping back over second factor

  • q8 − Found Y marking previously used 1 from second factor

  • q9 − Skip back over 1ʼs in first factor

  • q12 − Consumed the entire first factor; convert xs back to 1s

  • q11 − Found ⊔

Published on 14-Jun-2021 11:43:28