Which of the following regular expressions represent(s) the set of all binary numbers that are divisible by three? Assume that the string is divisible by three.
View worked solution
Answer: A;B;C
To find the regular expressions representing binary numbers divisible by , we construct the state transition diagram (DFA) where the states represent the remainder modulo :
- (remainder ): Start and accepting state.
- (remainder ): Non-accepting state.
- (remainder ): Non-accepting state.
The transition rules for a binary input are :
- From : on , on
- From : on , on
- From : on , on
Option A & C:
Eliminating state first, the self-loop at via becomes . The path from to and back to becomes . Combining this with the self-loop at , we get the regular expression:
This matches Option A. Since is equivalent to , we can rewrite this as , which matches Option C.
Option B:
If we eliminate state first:
- The path gives a self-loop of on .
- The path gives a self-loop of on .
- The transition becomes .
- The transition becomes .
Now, the simplified system has states and :
- Self-loops on :
- Self-loops on :
- Path from to and back:
Eliminating yields the regular expression:
This matches Option B.
Option D:
The binary representation of is , which is divisible by . However, Option D cannot generate because any string starting with must begin with according to its terms, whereas starts with . Thus, Option D is incorrect.
Free practice · Your answers on this page are not saved.
