Concatenation Process in DFA (original) (raw)

Last Updated : 11 Jul, 2025

In the context of Deterministic Finite Automata (DFA), concatenation refers to the process of combining two regular languages (or strings) together to form a new language.

How Concatenation Works in DFA

When you concatenate two regular languages (represented by DFAs), you essentially want to combine the DFAs that recognize each of the individual languages into one DFA that can recognize the concatenated language.

**1. Initial Setup: Start with two separate DFAs, i.e. DFA1 and DFA2, where:

**2. Modify the Final States: In the concatenation process, the final state of DFA1 is connected to the start state of DFA2. This means:

**3. Accepting States: The new DFA should accept the concatenated string if:

**4. Final Automaton: After these adjustments, the new DFA recognizes the concatenation of both languages and can accept any string that is a valid combination of the two languages.

**Example: Designing a DFA for the set of string over {a, b} such that string of the language start with "a" and end with "b". There two desired language will be formed:

L1 = {a, aab, aabab, ...}
L2 = {b, bbab, bbabab, ...}

**1. Designing a DFA for Strings That Start with 'a' and End with 'b'

**Examples of valid strings:

**Examples of invalid strings:

**2. Defining Sub-Languages L1 and L2

**2.1 Language L1: Strings that start with a

This DFA accepts any string that begins with the letter a. As soon as it sees the first character, if it's not a, it moves to a dead state (where no accepted string is possible anymore). After seeing an initial a, it can accept any combination of as and bs.

**Examples: a, ab, aab, aaba, aaabb

**Rejected: b, ba, bb

**2.2 Language L2: Strings that end with b

This DFA accepts any string as long as its last character is b. It keeps track of the last symbol. If the last input symbol was b, the string is accepted. If the string ends in a, it's rejected.

**Examples: b, ab, aab, bab

**Rejected: a, aa, aba

**3. Concatenation L1.L2

Now, to create the final DFA, we combine the logic of L1 and L2. We want a string that:

This means the DFA must first verify that the first letter is a, and after that, it must watch for the last letter to be b. Both conditions must be satisfied.

**Examples of accepted strings:

**Examples of rejected strings: