Design a machine of the following language: L = Containing odd b where ∑ = {a, b}
Answer:
Here L = {b, bbb, ab, ba, ……}
As per the question,
Here r indicates remainder when the number of ‘b’ is odd, the remainder is one i.e. r = 1 otherwise remainder is zero i.e. r = 0 (when the number of ‘b’ is even).
At , the number of ‘b’ is always even that’s why we assign r = 0 at state.
But at number of ‘b’ is always odd that’s why we assign r = 1 a state.
is the final state because the machine is for odd ‘b’.
Regular Expression from machine
We can write another regular expression for
We can get odd numbers of b if we add one b at any even of b’s string. So, we first write regular expression for even number of b’s then odd one b.
Regular Expression for even number of b’s RE= (a*ba*ba*)*
Now we add one b to make it odd