Design a machine of the following language: L = Containing even a where ∑ = {a, b}
Answer:
Here L = {λ, b, aa, aabb, aaaabbbb, ……}
As per the question,
Here r indicates remainder when the number of ‘a’ is even remainder is zero i.e. r = 0 otherwise remainder is one i.e. r = 1 (when the number of ‘a’ is odd).
At , the number of ‘a’ is always even that’s why we assign r = 0 at state.
But at , the number of ‘a’ is always odd that’s why we assign r = 1 a state.
is the final state because the machine is for even ‘a’.
Same as above machine we can design even number of ‘b’:
Regular Expression for even number of b’s