# Illustration DFA - number of a's and b's have the same remainder when divided by 3

Get illustration

Share — copy and redistribute the material in any medium or format

Adapt — remix, transform, and build upon the material for any purpose, even commercially.

Sharing and adapting of the illustration is allowed with indication of the link to the illustration.

Sketch of a deterministic finite automaton (DFA) for the following regular language (type 3):$$L ~=~ \{ w \in \{a,b\}^* ~:~ |w|_a \equiv |w|_b \text{ mod } 3 \}$$

This is an infinite language where $$|w|_a$$ (number of a's in the word $$w$$) and $$|w|_b$$ (number of b's in the word $$w$$) both give the same remainder when $$|w|_a$$ and $$|w|_b$$ are divided by two:$$L ~=~ \{ \varepsilon, aaa, bbb, aabb, aabbba, ~.... \}$$