FOR FREE MATERIALS

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 q0, the number of ‘a’ is always even that’s why we assign r = 0 at q0 state.

But at q1, the number of ‘a’ is always odd that’s why we assign r = 1q1 state.

 

q0 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 RE1 = (a*ba*ba*)*