On minimizing finite automata

Given a DFA M , can we find an equivalent DFA (i.e., one that recognizes the same language as M) with the minimum possible number of states? This is a very natural question, and has important applications to the efficiency of procedures that use finite automata. In this note, we will see an efficient algorithm that solves this problem. To begin, we need a couple of definitions. Let M be any DFA with alphabet Σ. Then M naturally defines an equivalence relation ∼ M over Σ * , given by x ∼ M y iff M ends in the same state on inputs x and y. Note that the number of equivalence classes is finite (being equal to the number of states of M). Now let L = L(M) be the language recognized by M. This language also defines a natural equivalence relation ∼ L , as follows. Call two strings x, y ∈ Σ * indistinguishable by L if, for all z ∈ Σ * , xz ∈ L ⇔ yz ∈ L. Otherwise we say that x and y are distinguishable. Then the relation ∼ L is defined by x ∼ L y iff x and y are indistinguishable.