Professional Documents
Culture Documents
2-Re or RL To Fa
2-Re or RL To Fa
Conversion of RE/RL to FA
To convert the RE to FA, we are going to use a method called the subset method. This method is
used to obtain FA from the given regular expression. This method is given below:
Step 1: Design a transition diagram for given regular expression, using NFA with ε moves.
In the above transition diagram, as we can see that state ‘X’ is not accepting any alphabet.
In the above transition diagram, as we can see that state ‘X’ on getting ‘a’ as the alphabet it transits
to a state ‘Y’. Thus, it accepts only ‘a’ as the alphabet.
Regular Expression 3: ‘a+b’ (Union process of two alphabets ‘a’ and ‘b’).
The language of the given RE is L3 = {a, b} i.e, a language containing ‘a’ and ‘b’ as the string.
Its finite automata will be like below-
In the above transition diagram, as we can see that state ‘X’ on getting either ‘a’ or ‘b’ as the alphabet
it transits to a state ‘Y’. Thus, it accepts the desired language’s strings.
In the above transition diagram, as we can see that state ‘X’ on getting ‘a’ as the alphabet it transits
to state ‘Y’ and the state ‘Y’ on getting ‘b’ as the input string it transits to the final state ‘Z’. Thus, it
accepts the desired language’s string.
Regular Expression 5: ‘ab*’ (‘a’ followed by any number of ‘b’). The language of the given RE is,
L1 = {a, ab, abb, abbb, .........}
Its finite automata will be like below-
In the above transition diagram, as we can see that state ‘X’ on getting ‘a’ as the input it transits to a
final state ‘Y’ which on getting ‘b’ as the input it remains in the state of itself. Thus, this FA accepting
all the strings of the given RE language.
Regular Expression 6: ‘(ab)*’ (‘a’ followed by ‘b’ but substring ‘ab’ can be repeated any number
of times). The language of the given RE is,
L2 = {ε, ab, abab, ababab, .........}
Its finite automata will be like below-
In the above transition diagram, as we can see that initial and final state ‘X’ on getting ‘a’ as the
input it transits to a final state ‘Y’ which on getting ‘b’ as the input it comes back to the state ‘X’.
Thus, this FA accepting all the strings of the given RE language.
Regular Expression 7: ‘(a+b)*’ (‘a’ union ‘b’ but substring ‘a+b’ can be repeated any number of
times). The language of the given RE is,
L3 = {ε, a, b, aa, aaab, bbbbb, ba, .......}
The language containing ε and any number of ‘a’ or ‘b’ or both combined.
Its finite automata will be like below-
In the above transition diagram, as we can see that state ‘X’ on getting ‘a’ as the input it remains in
the state of itself and on getting ‘b’ as the input it transits to another final state ‘Y’ which on getting
‘b’ or ‘a’ as the input it remains in the state of itself. Thus, this FA accepting all the strings of the
given RE language.
Note – The minimal DFA of regular expression (a+b)* will have only single state, which is both
starting and final state. This will contain only loop of alphabet ‘a’ and ‘b’.
In the above transition diagram, as we can see that initial and final state ‘Z’ on getting either ‘a’
or ‘b’ as the input it remains in the state of itself. Thus, this FA accepting all the strings of the
given RE language.
= (a+b)*
= (a*+b*)*
= (a*b*)*
= (a*+b)*
= (a+b*)*
= a*(ba*)*
= b*(ab*)*
In the above transition diagram, initial state ‘X’ on getting ‘a’ as the input it transits to a final state
‘Y’ which on getting ‘a’ as the input it remains in the state of itself. Thus, this FA accepting all the
strings of the given RE language.
More Examples
Example 1
Example 2
RE= ‘(ab+ba)*’ (‘ab’ union ‘ba’ but substring ‘ab+ba’ can be repeated any number of times). The
language of the given RE is,
L4 = {ε, ab, abab, abba, ba, baba, ........ }
The language containing ε and any number of ‘ab’ or ‘ba’ or both combined.
Its finite automata will be like below-
In the above transition diagram, the initial and final state ‘X’ on getting ‘a’ as input it go to a state
‘Y’ and on getting ‘b’ as the input it goes to another state ‘Z’ and so on for the remaining states.
Thus, this FA accepting all the strings of the given RE language.
Example 3
In the above transition diagram, as we can see that initial state ‘X’ on getting ‘a’ as the input it
transits to another state ‘Y’ and the state ‘Y’ on getting ‘b’ as the input it remains in the state of
itself and so on for the remaining states. Thus, this FA accepting all the strings of the given RE
language.
Example 4
Regular language L = 0(10)*
The language of the given RE is {0, 010, 01010, 0101010, ..........}
Its finite automata will be like below-
In the above transition diagram, as we can see that initial state ‘Y’ on getting ‘0’ as the input it
transits to a final state ‘Z’ and so on for the remaining states. Thus, this FA accepting all the strings
of the given RE language.