Finite-State Machines (FSM): A Short Note with Core Theory and Examples

Finite-State Machines (FSM): A Short Note with Core Theory and Examples

Verified Sources
Sep 12, 2026

A finite-state machine (FSM) is a mathematical model of computation used to describe systems with a limited number of modes (states). At each step, the machine reads an input symbol and updates its current state according to a transition rule. FSMs are especially important because they precisely capture the class of regular languages and appear in many practical designs like lexical analyzers, protocol logic, and digital circuits.

The formal structure is often given as a 5-tuple. A deterministic finite automaton (DFA) is commonly defined by: M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F) where QQ is a finite set of states, Σ\Sigma is the input alphabet, δ\delta is the transition function, q0q_0 is the start state, and FF is the set of accepting (final) states.

A DFA processes an input string by starting in q0q_0 and repeatedly applying δ\delta to determine the next state; acceptance occurs if the final state after consuming the entire string lies in FF.

Key terms to remember

  • state: one of the machine’s finite configurations
  • alphabet
  • transition function
  • start state
  • accepting state

Note: Many textbooks also describe nondeterminism (NFA) and show that NFAs and DFAs recognize the same class of languages (regular languages).

Pro Tip

When writing a short note, define the 5-tuple first (states, alphabet, transition, start, accepting) and then briefly explain how processing and acceptance work.

How an FSM runs on an input

Start

Initialize

Place the machine in start state q0q_0 before reading input."

Transition step

Read symbols

For each input symbol, update the state using 0˘3b4\u03b4."

Accept/Reject

Finish

After the last symbol, accept iff the current state is in FF."

DFA vs NFA vs “output” FSMs (Mealy/Moore)

FSMs appear in multiple variants depending on determinism and whether outputs are produced during operation.

DFA vs NFA (nondeterminism)

  • In a nondeterministic finite automaton (NFA) the transition function allows multiple next states for the same input symbol.
  • The usual definition of acceptance for an NFA is existential: the input is accepted if at least one computation path ends in an accepting state after consuming the entire string.

Mealy vs Moore machines (FSM with outputs)

When an FSM produces outputs, it can be modeled as:

  • A [Mealy machine]{def="FSM where outputs are associated with transitions}”: output depends on the current state and input symbol (on edges).
  • A [Moore machine]{def="FSM where outputs are associated with states}”: output depends only on the current state (in nodes).

Why this matters

  • In protocol/control systems, Mealy machines can react immediately to inputs (output on transition).
  • In hardware design and control, Moore machines are often preferred for stable outputs tied to states.

Construct (and describe) an FSM for a simple language property

  1. 1
    Step 1

    Example: recognize strings over {0,1} that contain an even number of 0s.

  2. 2
    Step 2

    Use two states representing parity: qeq_e (even # of 0s so far) and qoq_o (odd # of 0s so far).

  3. 3
    Step 3

    Start in qeq_e because before reading input, the count of 0s is even.

  4. 4
    Step 4

    On input 0: toggle parity (qe2˘192qoq_e \u2192 q_o, qo2˘192qeq_o \u2192 q_e). On input 1: parity unchanged.

  5. 5
    Step 5

    Accept in qeq_e and reject in qoq_o after the entire input is consumed.

Example short note (pattern-recognition style)

Here is a compact “short note” you can adapt:

A finite-state machine (FSM) is a formal model for computing with a finite number of states. A DFA can be described as a 5-tuple M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F), where QQ is the set of states, Σ\Sigma the input alphabet, δ\delta the transition function, q0q_0 the start state, and FF the set of accepting states. The machine processes an input string left-to-right by repeatedly updating its current state using δ\delta. The input is accepted if after the last symbol, the machine is in a state from FF.

More general variants include NFAs (multiple possible transitions per symbol) and output machines such as Mealy and Moore machines, which are useful when outputs must be generated during processing.

FSM variants: what they base output/next-state on

Conceptual comparison (not a performance benchmark)

Common clarifications (for a “short note” answer)

Knowledge Check

Question 1 of 4
Q1Single choice

In the standard DFA definition M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F), what does δ\delta represent?