# Turing machine for Regular languages in theory of automata

## Turing machine for Regular languages

Regular languages can be represented through finite automata and similarly can be represented through Turing Machine.

This machine must accept all strings starting from a and ending with b. e.g, ab,aab, abab etc.

Let’s discuss the diagram;

Start:

Starts the machine

a,a,R:

Read a from input tape and write a and move Right on input tape.

State 2:

Read a from input tape and write a and move Right on input tape. There is a loop of a, a, R on state 2.

If read b from input tape, then write b and move right and halts the machine by accepting the string.

If there is any a on accept state then again control moves to the state 2, enforcing the machine to not end with a.

## Demo of Turing machine Execution

Question: String ab can be ready by this Turing machine or not? If it can be read then what will be the path?

Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.

Path: start > 2 > accept.

Question: String ba can be ready by this Turing machine or not? If it can be read then what will be the path?

Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings that are started with alphabet a

Question: String abbba can be ready by this Turing machine or not? If it can be read then what will be the path?

Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings ended with alphabet b.

Path: start > 2 > accept > accept > accept > 2. Here, 2 is the ending state but actual ending state is “accept”.

Question: String ababab can be ready by this Turing machine or not? If it can be read then what will be the path?

Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.

Path: start > 2 > accept > 2 > accept > 2 > accept.

Question: String abbbb can be ready by this Turing machine or not? If it can be read then what will be the path?

Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.

Path: start > 2 > accept > accept > accept > accept.

Question: String baabbb can be ready by this Turing machine or not? If it can be read then what will be the path?

Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings that are started with alphabet a.

Question: String aababb can be ready by this Turing machine or not? If it can be read then what will be the path?

Answer: Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.

Path: start > 2 > 2 > accept > accept > accept.