- 2070 Chaitra
DFA: even 0s and even 1s
Short answer
DFA with four states tracking parity mod 2 of 0's and 1's: q00 (even, even) start and accepting. Transitions: 0 flips first index, 1 flips second. 0110 returns to q00 (accepted); 010 ends in q01 (rejected).
Design a DFA for L = {x ∈ {0,1}* : x has an even number of 0's and an even number of 1's}.
Idea. Track the parity of 0's and 1's. Four states qᵢⱼ: i = number of 0's mod 2, j = number of 1's mod 2. The start state q00 is also the only final state (even, even; ε is accepted).
M = ({q00, q01, q10, q11}, {0, 1}, δ, q00, {q00})
| State | 0 | 1 |
|---|---|---|
| → *q00 | q10 | q01 |
| q01 | q11 | q00 |
| q10 | q00 | q11 |
| q11 | q01 | q10 |
0 0
──►((q00)) <──────────> (q10)
▲ ▲
1 │ │ 1
▼ ▼
(q01) <──────────> (q11)
0 0
Each edge is two-way: 0 joins q00–q10 and q01–q11; 1 joins q00–q01 and q10–q11.
Test
- "0110": q00 →0 q10 →1 q11 →1 q10 →0 q00. Accepted.
- "010": q00 → q10 → q11 → q01. Rejected (two 0's, one 1).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- DFA: even a and odd b · Theory of Computation, chapter 2
- Pumping lemma: equal 0s and 1s · Theory of Computation, chapter 2 · asked 2×
- Configuration of DFA; DFA with 01 and 10 · Theory of Computation, chapter 2
- Convert NFA (q0,q1,q2) to DFA · Theory of Computation, chapter 2
- DFA for (a(ab)*b)* · Theory of Computation, chapter 2
- DFA avoiding substring 10110 · Theory of Computation, chapter 2
- Design FSA accepting even number of a's · Discrete Structure, chapter 2 · asked 4×
- Handshaking theorem; even number of odd vertices · Discrete Structure, chapter 4 · asked 3×
- Count number of 0s in ROM data · Embedded System, chapter 9 · asked 2×
- Count number of 1s in ROM data · Embedded System, chapter 9 · asked 2×