Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Operations on DFA
Next article icon

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
Operations on DFA

A

anushkadaym
Improve
Article Tags :
  • Theory of Computation

Similar Reads

    Cross Product Operation in DFA
    Prerequisite: Designing finite automata Let’s understand the cross product operation in Deterministic Finite Automata (DFA) with help of the below example- Designing a DFA for the set of string over {a, b} such that string of the language contains even number of a's and b's then desired language wil
    2 min read
    Union process in DFA
    In theory of computation, union of two Deterministic Finite Automata (DFAs) is an operation used to construct a new DFA that recognizes union of languages accepted by the original automata. For example, two DFAs each recognizing a language L1​ and L2​ respectively, their union DFA will accept any st
    4 min read
    Minimization of DFA
    DFA minimization stands for converting a given DFA to its equivalent DFA with minimum number of states. DFA minimization is also called as Optimization of DFA and uses partitioning algorithm.Minimization of DFA Suppose there is a DFA D < Q, Δ, q0, Δ, F > which recognizes a language L. Then the
    7 min read
    Transition Table in Automata
    Transition Table :Transition function(∂) is a function which maps Q * ∑ into Q . Here 'Q' is set of states and '∑' is input of alphabets. To show this transition function we use table called transition table. The table takes two values a state and a symbol and returns next state. A transition table
    4 min read
    DFA for Strings not ending with "THE"
    Problem - Accept Strings that not ending with substring "THE". Check if a given string is ending with "the" or not. The different forms of "the" which are avoided in the end of the string are: "THE", "ThE", "THe", "tHE", "thE", "The", "tHe" and "the" All those strings that are ending with any of the
    12 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences