Trap State vs. Dead State in TOC

The trap state is used in DFA, while the Dead State is found in NFA. Let’s see the comparison of trap state vs. dead state in TOC.

Trap State in Automata

The trap state considered the receiving inputs as rejected inputs. This concept is used in DFA. It is also known as trap configuration.

As we know, in the case of DFA, there must be a dedicated path for each input of Sigma. So, some of the inputs have to be rejected according to requirements.

Example: Draw a DFA that accepts only the string “aaab”.

The following is the DFA representation of the given string.

Trap state in automata

According to DFA, the initial state is q0, and it changes to q1 through input “a”, but for input “b”, it does not need for self-loop. So, input “b” transition goes to the trap state (q3). 

Therefore, the transition of input “b” at state q0,  input “a” at state q1, and both input “a” and “b” at q2 leads toward the trap state (q3).  

Dead State in Automata

When there is no path to reach a certain state, then that state will be considered a dead state. It may be found in NFA but cannot be used in DFA. It is also known as a dead configuration.

Example: [q4 is deat state]

Look at the following DFA where q4 is dead because there is no path to reach at state q4.

Dead state in automata

Note: If dead state is non-final then it can be removed without any problem from NFA graph