I'm currently looking at deterministic finite automata, and learning how to combine two DFAs using AND or OR. I think I understand how to construct the INTERSECTION (AND) of two DFAs, but I'm at a loss when it comes to constructing the UNION (OR) of the same DFAs.
For instance, assume we have language L defined as follows:
L = {w | w contains the substring ab (AND/OR) ba}
This can be thought of as two sub-languages, respectively:
L1 = {w | w contains the substring ab}
L2 = {w | w contains the substring ba}
As such, we can construct DFAs for each language (namely L1 and L2), and combine them using either the AND og OR scheme.
AND - Intersection
For intersection (AND), the individual DFAs become as follows:
Furthermore, the intersection M = M(L1) AND M(L2), corresponding to the language
L = {w | w contains the substring ab AND ba}
would be represented by the following DFA:
This should, after what I gather, be correct. If not; please tell me where the faults are.
QUESTION
However, HOW does one construct the UNION of the same DFAs?
I have seen some examples/solutions online, such as the figure below, but I do not understand how they have reached this setup.
Any help on this is extremely appreciated!



If your definition of DFA allows for multiple accept states (usually it does), then the simplest way is to take the same DFA for the intersection, with the only difference being that your set of accept states should contain any state in which either machine 1 was accepting or machine 2 was accepting. In this case, that means any state with either a "3" or a "C" in the name.
This will not result in a DFA that looks identical to the one you posted, but it will result in a different DFA that accepts the union of the two languages.
You can think about which states your diagram really needs: some of them may not be reachable from the start state, so perhaps you can eliminate them, and perhaps you can combine some other states in such a way that you will end up getting something that looks like the one you posted. But if your only goal is to find any DFA that will accept that language, the construction for the intersection and the construction for the union can be the same, with only the set of accepting states differing.