Reversing Deterministic Finite Automata
Last Updated :
11 Jul, 2025
Prerequisite – Designing finite automata
Reversal: We define the reversed language L^R \text{ of } L to be the language L^R = \{ w^R \mid w \in L \} , where w^R := a_n a_{n-1} \dots a_1 a_0 \text{ for } w = a_0 a_1 \dots a_{n-1} a_n
Steps to Reversal:
- Draw the states as it is.
- Add a new single accepting state
- Make the accepting state the initial state and initial state the accepting state
- Invert the transition function into a transition relation
- Remove any states that are no longer necessary
Note :
Reversing deterministic finite automaton results in a non-deterministic finite automaton. This can then be converted to a deterministic finite automaton by the conversion algorithm.
The reversal process goes like this:

Let’s understand the Reversal process in Deterministic Finite Automata (DFA) with the help of the example below.
Example 1:
We propose a deterministic finite automaton for the language of words beginning with the symbol 'a':
L_1 = \{ w \in \{a, b\}^* \mid w = ab^n \text{ for some } n \geq 0 \}
We can construct the following state transition diagram:
We now want to construct the finite automaton that will accept the reverse of this language, L_2 .
First, we add a new single accepting state. This is because eventually we will need to swap the accepting and initial states, and there can only be a single initial state.

Then, switch the initial and accepting states:

Invert the transition function into a transition relation:

Whilst this is a valid solution, the node marked as C is dangling since it has no incident edges. Therefore it can be removed to give a clean, final result:

This resulting finite automaton is a non-deterministic finite automaton. Therefore the resulting reversed language is regular.
Explanation:
- Same states (A, B, C) are drawn as present in an original state diagram
- Since A is the initial state make it the final state.
- Since B is the final state make it the initial state.
- Reversing the edges, since previously edges point A to B and A to C . Change the direction, now edges points toward B to A and C to A.
- Assign the values as same as the original.
- Draw the loop as in the original state diagram
- Since there is no incident edge on state C so, we can reduce this state C.
- Since there is no transition for 'a' and 'b' in state A . Therefore resultant FA is NFA.
Example-2:
Designing a DFA for the set of strings over {a, b} such that string of the language contains an even number of 'a'. The desired language will be formed:
L1 = {\epsilon, aa, aab, aba, aab, aababa, .......}In L1, each string has an even number of elements a.
State Transition Diagram for the language L1:

This DFA accepts all the strings containing an even number of elements a. Here, State A is the initial state, and state A is the final state. Now, Reversing the L1 language which gives the final result of the language L2.
State Transition Diagram of L2 (reverse of L1):

Thus as we see that L2 has been obtained through the reversal process and this final DFA accepts all the strings containing an even number of element a which is the same as the original language.
L2 = {\epsilon, aa, aab, aba, aab, aababa, .......}Explanation:
- Same states (A, B) are drawn as present in an original state diagram.
- Since A is the initial state make it the final state.
- Since A is the final state make it the initial state.
- Reversing the edges, since previously edges point A to B and so on. Change the direction, now edges points toward B to A and so on.
- Assign the values as same as the original.
- Since there is a transition for 'a' and 'b' in states A and B.Therefore resultant FA is DFA.
- Since the State diagram after and before the reversal is the same. Therefore L1 = L2
Explore
Automata _ Introduction
Regular Expression and Finite Automata
CFG
PDA (Pushdown Automata)
Introduction of Pushdown Automata
5 min read
Pushdown Automata Acceptance by Final State
4 min read
Construct Pushdown Automata for given languages
4 min read
Construct Pushdown Automata for all length palindrome
6 min read
Detailed Study of PushDown Automata
3 min read
NPDA for accepting the language L = {anbm cn | m,n>=1}
2 min read
NPDA for accepting the language L = {an bn cm | m,n>=1}
2 min read
NPDA for accepting the language L = {anbn | n>=1}
2 min read
NPDA for accepting the language L = {amb2m| m>=1}
2 min read
NPDA for accepting the language L = {am bn cp dq | m+n=p+q ; m,n,p,q>=1}
2 min read
Construct Pushdown automata for L = {0n1m2m3n | m,n ⥠0}
3 min read
Construct Pushdown automata for L = {0n1m2n+m | m, n ⥠0}
2 min read
NPDA for accepting the language L = {ambncm+n | m,n ⥠1}
2 min read
NPDA for accepting the language L = {amb(m+n)cn| m,n ⥠1}
3 min read
NPDA for accepting the language L = {a2mb3m|m>=1}
2 min read
NPDA for accepting the language L = {amb2m+1 | m ⥠1}
2 min read
NPDA for accepting the language L = {aibjckdl | i==k or j==l,i>=1,j>=1}
3 min read
Construct Pushdown automata for L = {a2mc4ndnbm | m,n ⥠0}
3 min read
NPDA for L = {0i1j2k | i==j or j==k ; i , j , k >= 1}
2 min read
NPDA for accepting the language L = {anb2n| n>=1} U {anbn| n>=1}
2 min read
NPDA for the language L ={wÐ{a,b}* | w contains equal no. of a's and b's}
3 min read
Turing Machine
Decidability
TOC Interview preparation
TOC Quiz and PYQ's in TOC