How to perform union of two NFAs. This question is from Peter Linz's book.
Find an NFA with four states for $L=\{ a^n \ | \ n \geq 0 \} \cup \{b^n a \ | \ n \geq 1\}$.
Now Considering the first part as $L_1$ and second part as $L_2$ I am enclosing the solution.
The problem is I can't make out how strings like $\{\epsilon,a,aa,aaa,\dots\}$ are getting accepted in the final NFA.
Please help me to interpret the solution.
To take the union of two NFAs, you just need to add an initial state with an $\epsilon$-transition to each of the initial states of the original NFAs. So if your $L_1$ and $L_2$ are
you get
That doesn't fully satisfy the requirements of the exercise, because you're supposed to have only 4 states. But because $L$ and $C$ have exactly the same incoming edges (i.e. none) and the same termination value (i.e. not accepting) we can merge them, eliminating the epsilon transition, to get
In this particular case, it's also possible to eliminate the remaining epsilon transition:
To make it a proper DFA, however, would require adding a sink state for the edges which are suppressed in the NFA: