Finite automata for any even number of a's followed by any even number of b's

1.5k Views Asked by At

I'm new to formal languages. I'm stuck with the following question. Any help is appreciated.

Find finite automata for

$$L = \{a^i b^j \mid i, j\text{ are even, }j\ge0\}$$

Thank you

2

There are 2 best solutions below

0
On

Hint. Your language is $(aa)^*(bb)^*$. Now you may apply standard algorithms to get a finite automaton accepting $L$.

0
On

Start by making a FA to accept the $a$s: you'll need two states, the start state will be a final state and the other won't be final. Then make another FA to handle the $b$s: you'll need a machine similar to the first one. Then link your first FA to the second with an appropriate transition on input $b$. Finally, figure out which of the states of the second machine need to be final.

When you cover nondeterministic finite automata, you'll see a general construction for such critters, since your language can be written as the concatenation, $L_1L_2$, of two simpler languages,

$$ L_1=\{a^i\mid i\text{ even, } i\ge 0\}\quad L_2=\{b^i\mid i\text{ even, } i\ge 0\} $$