Open In App

Operations on DFA

Last Updated : 24 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Deterministic Finite Automata (DFA) are simple machines that help computers recognize patterns in data. They follow a set of fixed rules and read input step by step to determine if it belongs to a specific language. DFAs are widely used in search engines, spell-checkers, and text-processing systems.

They are fundamental computational models used in automata theory to recognize regular languages. Various operations on DFAs allow us to construct new automata from existing ones, enabling us to build complex language recognizers.

One of the most interesting aspects of DFAs is that they can be combined or modified using different operations. Here are some key operations on DFAs, explained with examples:

1. Union of Two DFAs (L₁ ∪ L₂)

Union means combining two DFAs so that the new DFA accepts all words that either of the original DFAs would accept. Example: Let,

  • DFA 1 (L₁) accepts L₁ = {a, ab}
  • DFA 2 (L₂) accepts L₂ = {b, ab}
  • The union DFA accepts L₁ ∪ L₂ = {a, ab, b}

Read more about Union process in DFA.

2. Concatenation of Two DFAs (L₁ ∘ L₂)

Concatenation means creating a new DFA that accepts words formed by taking a word from L₁ followed by a word from L₂. Example:
Let,

  • DFA 1 (L₁) accepts L₁ = {a, b}
  • DFA 2 (L₂) accepts L₂ = {c, d}
  • The concatenation DFA accepts L₁ ∘ L₂ = {ac, ad, bc, bd}

Read more about Concatenation process in DFA

3. Reversal of a DFA (Lᴿ)

A new DFA that accepts the reversed versions of words accepted by the original DFA. Example:

  • Let DFA accept L = {ab, abc, ba}
  • Then, reversed DFA accepts Lᴿ = {ba, cba, ab}

Read more about Reversal process in DFA.

4. Complementation of a DFA (L̅)

A new DFA that accepts all words not accepted by the original DFA. Example:

  • Let DFA accept L = {all strings containing 'a'}
  • Then, the complement DFA accepts L̅ = {all strings that do not contain 'a'}

Read more about Complementation process in DFA.

5. Intersection of Two DFAs (L₁ ∩ L₂)

A new DFA that accepts only words that are in both original DFAs. Example:
Let:

  • DFA 1 (L₁) accepts L₁ = {a, ab, bc}
  • DFA 2 (L₂) accepts L₂ = {ab, bc, cd}
  • The intersection DFA accepts L₁ ∩ L₂ = {ab, bc}

Read more about Intersection process in DFA

6. Difference of Two DFAs (L₁ - L₂)

Accepts strings in A but not in B

Let :

  • DFA A accepts strings containing at least one '0'.
  • DFA B accepts strings ending with '1'.
  • Difference DFA L₁ - L₂ accepts strings that have at least one '0' and do not end with '1'.

Next Article
Article Tags :

Similar Reads