**Deterministic finite automaton (DFA)**—also known as deterministic finite state machine—is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automaton for each input string. ‘Deterministic’ refers to the uniqueness of the computation.

Formal Definition of a DFA

A DFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where:

Q is a finite set of states.

Σ is a finite set of symbols called the alphabet.

δ is the transition function where δ: Q × Σ → Q

q0 is the initial state from where any input is processed (q0 ∈ Q).

F is a set of final state/states of Q (F ⊆ Q).

Graphical Representation of a DFA

A DFA is represented by digraphs called state diagram.

The vertices represent the states.

The arcs labeled with an input alphabet show the transitions.

The initial state is denoted by an empty single incoming arc.

The final state is indicated by double circles.

**Nondeterministic finite automaton (NFA or NDFA)** or nondeterministic finite state machine is a finite state machine where from each state and a given input symbol the automaton may jump into several possible next states. This distinguishes it from the deterministic finite automaton (DFA), where the next possible state is uniquely determined. Although the DFA and NFA have distinct definitions, a NFA can be translated to equivalent DFA using the subset construction algorithm

Formal Definition of an NDFA

An NDFA can be represented by a 5-tuple (Q, Σ, δ, q0, F) where:

Q is a finite set of states.

Σ is a finite set of symbols called the alphabets.

δ is the transition function where δ: Q × Σ → 2^Q (Here the power set of Q (2^Q) has been taken because in case of NDFA, from a state, transition can occur to any combination of Q states)

q0 is the initial state from where any input is processed (q0 ∈ Q).

F is a set of final state/states of Q (F ⊆ Q).

Graphical Representation of an NDFA: (same as DFA)

An NDFA is represented by digraphs called state diagram.

The vertices represent the states.

The arcs labeled with an input alphabet show the transitions.

The initial state is denoted by an empty single incoming arc.

The final state is indicated by double circles