# design of self-loops and final states in fsm

I am learning about automata and finite state machines. Consider the following automaton, that accepts the word 'ab', does not have to be infinite, just once:

alphabet: 'a','b' states: 1,2, 3 (3 is the final state and 1 is the initial state)

transitions:

state 1, symbol a, state 2
state 2, symbol b, state 3


First part of my questions:

Question 1. Is it required to add self-loops at 1 for 'b', and a self-loop for 'a' at 2?

Question 2. What about at state 3(final)? Should I add self-loops for 'a' and 'b'?

I basically need to know, how to design my final state. So that even if my alphabet was expanded (say a, b, c), and I have a 'dump' state, with the following transitions:

state 1, symbol a, state 2
state 1, symbol b or c, state dump

state 2, symbol b, state 3
state 2 symbol a or c, state dump


Question 3. Now from final state 3, should I add a transition to dump state, with symbol values a,b,c ???

– mrk
Feb 12, 2013 at 19:03
• 1, 2. You don't have to show all possible transitions. Absent transitions generally imply rejection. So if you get b in state 1, and there is no loop for it, it means the input is rejected. 3. Yes, if you have a dump state. But you don't need to. Feb 12, 2013 at 19:20

Your original automaton is fine, it accepts the singleton $\{ab\}$. Here is a pictorial representation:
The self-loop at 1 labeled with $b$ changes the language to $\{ab, bab, bbab, bbbab, \dots\}$.
• @PiotrL. The $d$ is a typo in the automata... Glad it helps.