# Confused b/w non-deterministic finite state automata vs finite state automata

I am reading this example of FSA from book Martin & Jurafsky "Speech and Language Processing".

As per definition of FSA you can only transition to one state after consuming one input. In this example if the input is say "twenty" to which state it will transition q2 or q1 ? Say if the input was "twenty one". After consuming first string which state it will transition to?

• Welcome to Computer Science! The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! Commented Jan 24, 2018 at 0:09

The automaton in the image is indeed nondeterministic.

You need to think a little differently about nondeterministic machines. It's no longer a question of "what happens when X?" but about "what can happen when X?". For each input, there can be many different computations, even with different outcomes.

Note how the definition of acceptance is different. For DFA, it's "the (unique) computation is accepting"; for NFA, it's "there exists an accepting computation".

Here, in your example, if the input is "twenty", there are two computations:

1. $q_0 \to q_1$ and
2. $q_0 \to q_2$.

Since the second is accepting, "twenty" is in the language of this automaton.

Side note: A TCS book that uses twenty as terminal symbol and generally avoids LaTeX for it's mathematics typesetting is highly suspect. I recommend that if you run into any problems, look for a standard textbook before worrying too much.

• Thanks Raphael for the answer! So contrary to the label the automata is not deterministic. This book is referred as main textbook by our Professor. Should I point this out to him? Commented Jan 24, 2018 at 0:57
• @UjjwalMishra The label says "FSA" which, depending on the definition, is a synonym of "NFA". "DFA" would have a special label. Commented Jan 24, 2018 at 6:14
• @UjjwalMishra Let's assume your professor has their reasons; maybe the focus of the course is something else the book does good at? Nevertheless, for your own studies, you can (and should!) draw on other resources. Commented Jan 24, 2018 at 6:15