# Whitehead's algorithm

Whitehead's algorithm is a mathematical algorithm in group theory for solving the automorphic equivalence problem in the finite rank free group F$_n$. The algorithm is based on a classic 1936 paper of J. H. C. Whitehead. It is still unknown (except for the case n = 2) if Whitehead's algorithm has polynomial time complexity.

## Statement of the problem

Let $F_{n}=F(x_{1},\dots ,x_{n})$ be a free group of rank $n\geq 2$ with a free basis $X=\{x_{1},\dots ,x_{n}\}$. The automorphism problem, or the automorphic equivalence problem for $F_{n}$ asks, given two freely reduced words $w,w'\in F_{n}$ whether there exists an automorphism $\varphi \in \operatorname {Aut} (F_{n})$ such that $\varphi (w)=w'$.
Thus the automorphism problem asks, for $w,w'\in F_{n}$ whether $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$. For $w,w'\in F_{n}$ one has $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$ if and only if $\operatorname {Out} (F_{n})[w]=\operatorname {Out} (F_{n})[w']$, where $[w],[w']$ are conjugacy classes in $F_{n}$ of $w,w'$ accordingly. Therefore, the automorphism problem for $F_{n}$ is often formulated in terms of $\operatorname {Out} (F_{n})$-equivalence of conjugacy classes of elements of $F_{n}$.
For an element $w\in F_{n}$, $|w|_{X}$ denotes the freely reduced length of $w$ with respect to $X$, and $\|w\|_{X}$ denotes the cyclically reduced length of $w$ with respect to $X$. For the automorphism problem, the length of an input $w$ is measured as $|w|_{X}$ or as $\|w\|_{X}$, depending on whether one views $w$ as an element of $F_{n}$ or as defining the corresponding conjugacy class $[w]$ in $F_{n}$.

## History

The automorphism problem for $F_{n}$ was algorithmically solved by J. H. C. Whitehead in a classic 1936 paper, and his solution came to be known as Whitehead's algorithm. Whitehead used a topological approach in his paper. Namely, consider the 3-manifold $M_{n}=\#_{i=1}^{n}\mathbb {S} ^{2}\times \mathbb {S} ^{1}$, the connected sum of $n$ copies of $\mathbb {S} ^{2}\times \mathbb {S} ^{1}$. Then $\pi _{1}(M_{n})\cong F_{n}$, and, moreover, up to a quotient by a finite normal subgroup isomorphic to $\mathbb {Z} _{2}^{n}$, the mapping class group of $M_{n}$ is equal to $\operatorname {Out} (F_{n})$; see. Different free bases of $F_{n}$ can be represented by isotopy classes of "sphere systems" in $M_{n}$, and the cyclically reduced form of an element $w\in F_{n}$, as well as the Whitehead graph of $[w]$, can be "read-off" from how a loop in general position representing $[w]$ intersects the spheres in the system. Whitehead moves can be represented by certain kinds of topological "swapping" moves modifying the sphere system.
Subsequently, Rapaport, and later, based on her work, Higgins and Lyndon, gave a purely combinatorial and algebraic re-interpretation of Whitehead's work and of Whitehead's algorithm. The exposition of Whitehead's algorithm in the book of Lyndon and Schupp is based on this combinatorial approach. Culler and Vogtmann, in their 1986 paper that introduced the Outer space, gave a hybrid approach to Whitehead's algorithm, presented in combinatorial terms but closely following Whitehead's original ideas.

## Whitehead's algorithm

Our exposition regarding Whitehead's algorithm mostly follows Ch.I.4 in the book of Lyndon and Schupp, as well as.

### Overview

The automorphism group $\operatorname {Aut} (F_{n})$ has a particularly useful finite generating set ${\mathcal {W}}$ of Whitehead automorphisms or Whitehead moves. Given $w,w'\in F_{n}$ the first part of Whitehead's algorithm consists of iteratively applying Whitehead moves to $w,w'$ to take each of them to an "automorphically minimal" form, where the cyclically reduced length strictly decreases at each step. Once we find automorphically these minimal forms $u,u'$ of $w,w'$, we check if $\|u\|_{X}=\|u'\|_{X}$. If $\|u\|_{X}\neq \|u'\|_{X}$ then $w,w'$ are not automorphically equivalent in $F_{n}$.
If $\|u\|_{X}=\|u'\|_{X}$, we check if there exists a finite chain of Whitehead moves taking $u$ to $u'$ so that the cyclically reduced length remains constant throughout this chain. The elements $w,w'$ are not automorphically equivalent in $F_{n}$ if and only if such a chain exists.
Whitehead's algorithm also solves the search automorphism problem for $F_{n}$. Namely, given $w,w'\in F_{n}$, if Whitehead's algorithm concludes that $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$, the algorithm also outputs an automorphism $\varphi \in \operatorname {Aut} (F_{n})$ such that $\varphi (w)=w'$. Such an element $\varphi \in \operatorname {Aut} (F_{n})$ is produced as the composition of a chain of Whitehead moves arising from the above procedure and taking $w$ to $w'$.

### Whitehead automorphisms

A Whitehead automorphism, or Whitehead move, of $F_{n}$ is an automorphism $\tau \in \operatorname {Aut} (F_{n})$ of $F_{n}$ of one of the following two types:
* There is a permutation $\sigma \in S_{n}$ of $\{1,2,\dots ,n\}$ such that for $i=1,\dots ,n$ $\tau (x_{i})=x_{\sigma (i)}^{\pm 1}$ Such $\tau$ is called a Whitehead automorphism of the first kind.
* There is an element $a\in X^{\pm 1}$, called the multiplier, such that for every $x\in X^{\pm 1}$ $\tau (x)\in \{x,xa,a^{-1}x,a^{-1}xa\}.$ Such $\tau$ is called a Whitehead automorphism of the second kind. Since $\tau$ is an automorphism of $F_{n}$, it follows that $\tau (a)=a$ in this case.
Often, for a Whitehead automorphism $\tau \in \operatorname {Aut} (F_{n})$, the corresponding outer automorphism in $\operatorname {Out} (F_{n})$ is also called a Whitehead automorphism or a Whitehead move.

#### Examples

Let $F_{4}=F(x_{1},x_{2},x_{3},x_{4})$.
Let $\tau :F_{4}\to F_{4}$ be a homomorphism such that $\tau (x_{1})=x_{2}x_{1},\quad \tau (x_{2})=x_{2},\quad \tau (x_{3})=x_{2}x_{3}x_{2}^{-1},\quad \tau (x_{4})=x_{4}$ Then $\tau$ is actually an automorphism of $F_{4}$, and, moreover, $\tau$ is a Whitehead automorphism of the second kind, with the multiplier $a=x_{2}^{-1}$.
Let $\tau ':F_{4}\to F_{4}$ be a homomorphism such that $\tau '(x_{1})=x_{1},\quad \tau '(x_{2})=x_{1}^{-1}x_{2}x_{1},\quad \tau '(x_{3})=x_{1}^{-1}x_{3}x_{1},\quad \tau '(x_{4})=x_{1}^{-1}x_{4}x_{1}$ Then $\tau '$ is actually an inner automorphism of $F_{4}$ given by conjugation by $x_{1}$, and, moreover, $\tau '$ is a Whitehead automorphism of the second kind, with the multiplier $a=x_{1}$.

### Automorphically minimal and Whitehead minimal elements

For $w\in F_{n}$, the conjugacy class $[w]$ is called automorphically minimal if for every $\varphi \in \operatorname {Aut} (F_{n})$ we have $\|w\|_{X}\leq \|\varphi (w)\|_{X}$. Also, a conjugacy class $[w]$ is called Whitehead minimal if for every Whitehead move $\tau \in \operatorname {Aut} (F_{n})$ we have $\|w\|_{X}\leq \|\tau (w)\|_{X}$.
Thus, by definition, if $[w]$ is automorphically minimal then it is also Whitehead minimal. It turns out that the converse is also true.

### Whitehead's "Peak Reduction Lemma"

The following statement is referred to as Whitehead's "Peak Reduction Lemma", see Proposition 4.20 in and Proposition 1.2 in:
Let $w\in F_{n}$. Then the following hold:
* If $[w]$ is not automorphically minimal, then there exists a Whitehead automorphism $\tau \in \operatorname {Aut} (F_{n})$ such that $\|\tau (w)\|_{X}<\|w\|_{X}$.
* Suppose that $[w]$ is automorphically minimal, and that another conjugacy class $[w']$ is also automorphically minimal. Then $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$ if and only if $\|w\|_{X}=\|w'\|_{X}$ and there exists a finite sequence of Whitehead moves $\tau _{1},\dots ,\tau _{k}\in \operatorname {Aut} (F_{n})$ such that $\tau _{k}\cdots \tau _{1}(w)=w'$ and $\|\tau _{i}\cdots \tau _{1}(w)\|_{X}=\|w\|_{X}{\text{ for }}i=1,\dots ,k.$
Part (1) of the Peak Reduction Lemma implies that a conjugacy class $[w]$ is Whitehead minimal if and only if it is automorphically minimal.

### The automorphism graph

The automorphism graph ${\mathcal {A}}$ of $F_{n}$ is a graph with the vertex set being the set of conjugacy classes $[u]$ of elements $u\in F_{n}$. Two distinct vertices $[u],[v]$ are adjacent in ${\mathcal {A}}$ if $\|u\|_{X}=\|v\|_{X}$ and there exists a Whitehead automorphism $\tau$ such that $[\tau (u)]=[v]$. For a vertex $[u]$ of ${\mathcal {A}}$, the connected component of $[u]$ in ${\mathcal {A}}$ is denoted ${\mathcal {A}}[u]$.

### Whitehead graph

For $1\neq w\in F_{n}$ with cyclically reduced form $u$, the Whitehead graph $\Gamma _{[w]}$ is a labelled graph with the vertex set $X^{\pm 1}$, where for $x,y\in X^{\pm 1},x\neq y$ there is an edge joining $x$ and $y$ with the label or "weight" $n(\{x,y\};[w])$ which is equal to the number of distinct occurrences of subwords $x^{-1}y,y^{-1}x$ read cyclically in $u$. (In some versions of the Whitehead graph one only includes the edges with $n(\{x,y\};[w])>0$.)
If $\tau \in \operatorname {Aut} (F_{n})$ is a Whitehead automorphism, then the length change $\|\tau (w)\|_{X}-\|w\|_{X}$ can be expressed as a linear combination, with integer coefficients determined by $\tau$, of the weights $n(\{x,y\};[w])$ in the Whitehead graph $\Gamma _{[w]}$. See Proposition 4.16 in Ch. I of. This fact plays a key role in the proof of Whitehead's peak reduction result.

### Whitehead's minimization algorithm

Whitehead's minimization algorithm, given a freely reduced word $w\in F_{n}$, finds an automorphically minimal $[v]$ such that $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})v.$
This algorithm proceeds as follows. Given $w\in F_{n}$, put $w_{1}=w$. If $w_{i}$ is already constructed, check if there exists a Whitehead automorphism $\tau \in \operatorname {Aut} (F_{n})$ such that $\|\tau (w_{i})\|_{X}<\|w_{i}\|_{X}$. (This condition can be checked since the set of Whitehead automorphisms of $F_{n}$ is finite.) If such $\tau$ exists, put $w_{i+1}=\tau (w_{i})$ and go to the next step. If no such $\tau$ exists, declare that $[w_{i}]$ is automorphically minimal, with $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w_{i}$, and terminate the algorithm.
Part (1) of the Peak Reduction Lemma implies that the Whitehead's minimization algorithm terminates with some $w_{m}$, where $m\leq \|w\|_{X}$, and that then $[w_{m}]$ is indeed automorphically minimal and satisfies $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w_{m}$.

### Whitehead's algorithm for the automorphic equivalence problem

Whitehead's algorithm for the automorphic equivalence problem, given $w,w'\in F_{n}$ decides whether or not $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$.
The algorithm proceeds as follows. Given $w,w'\in F_{n}$, first apply the Whitehead minimization algorithm to each of $w,w'$ to find automorphically minimal $[v],[v']$ such that $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})v$ and $\operatorname {Aut} (F_{n})w'=\operatorname {Aut} (F_{n})v'$. If $\|v\|_{X}\neq \|v'\|_{X}$, declare that $\operatorname {Aut} (F_{n})w\neq \operatorname {Aut} (F_{n})w'$ and terminate the algorithm. Suppose now that $\|v\|_{X}=\|v'\|_{X}=t\geq 0$. Then check if there exists a finite sequence of Whitehead moves $\tau _{1},\dots ,\tau _{k}\in \operatorname {Aut} (F_{n})$ such that $\tau _{k}\dots \tau _{1}(v)=v'$ and $\|\tau _{i}\dots \tau _{1}(v)\|_{X}=\|v\|_{X}=t{\text{ for }}i=1,\dots ,k.$
This condition can be checked since the number of cyclically reduced words of length $t$ in $F_{n}$ is finite. More specifically, using the breadth-first approach, one constructs the connected components ${\mathcal {A}}[v],{\mathcal {A}}[v']$ of the automorphism graph and checks if ${\mathcal {A}}[v]\cap {\mathcal {A}}[v']=\varnothing$.
If such a sequence exists, declare that $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$, and terminate the algorithm. If no such sequence exists, declare that $\operatorname {Aut} (F_{n})w\neq \operatorname {Aut} (F_{n})w'$ and terminate the algorithm.
The Peak Reduction Lemma implies that Whitehead's algorithm correctly solves the automorphic equivalence problem in $F_{n}$. Moreover, if $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$, the algorithm actually produces (as a composition of Whitehead moves) an automorphism $\varphi \in \operatorname {Aut} (F_{n})$ such that $\varphi (w)=w'$.

## Computational complexity of Whitehead's algorithm

* If the rank $n\geq 2$ of $F_{n}$ is fixed, then, given $w\in F_{n}$, the Whitehead minimization algorithm always terminates in quadratic time $O(|w|_{X}^{2})$ and produces an automorphically minimal cyclically reduced word $u\in F_{n}$ such that $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})u$. Moreover, even if $n$ is not considered fixed, (an adaptation of) the Whitehead minimization algorithm on an input $w\in F_{n}$ terminates in time $O(|w|_{X}^{2}n^{3})$.
* If the rank $n\geq 3$ of $F_{n}$ is fixed, then for an automorphically minimal $u\in F_{n}$ constructing the graph ${\mathcal {A}}[u]$ takes $O\left(\|u\|_{X}\cdot \#V{\mathcal {A}}[u]\right)$ time and thus requires a priori exponential time in $|u|_{X})$. For that reason Whitehead's algorithm for deciding, given $w,w'\in F_{n}$, whether or not $\operatorname {Aut} (F_{n})w=\operatorname {Aut} (F_{n})w'$, runs in at most exponential time in $\max\{|w|_{X},|w'|_{X}\}$.
* For $n=2$, Khan proved that for an automorphically minimal $u\in F_{2}$, the graph ${\mathcal {A}}[u]$ has at most $O\left(\|u\|_{X}\right)$ vertices and hence constructing the graph ${\mathcal {A}}[u]$ can be done in quadratic time in $|u|_{X}$. Consequently, Whitehead's algorithm for the automorphic equivalence problem in $F_{2}$, given $w,w'\in F_{2}$ runs in quadratic time in $\max\{|w|_{X},|w'|_{X}\}$.

## Applications, generalizations and related results

* Whitehead's algorithm can be adapted to solve, for any fixed $m\geq 1$, the automorphic equivalence problem for m-tuples of elects of $F_{n}$ and for m-tuples of conjugacy classes in $F_{n}$; see Ch.I.4 of and
* McCool used Whitehead's algorithm and the peak reduction to prove that for any $w\in F_{n}$ the stabilizer $\operatorname {Stab} _{\operatorname {Out} (F_{n})}([w])$ is finitely presentable, and obtained a similar results for $\operatorname {Out} (F_{n})$-stabilizers of m-tuples of conjugacy classes in $F_{n}$. McCool also used the peak reduction method to construct of a finite presentation of the group $\operatorname {Aut} (F_{n})$ with the set of Whitehead automorphisms as the generating set. He then used this presentation to recover a finite presentation for $\operatorname {Aut} (F_{n})$, originally due to Nielsen, with Nielsen automorphisms as generators.
* Gersten obtained a variation of Whitehead's algorithm, for deciding, given two finite subsets $S,S'\subseteq F_{n}$, whether the subgroups $H=\langle S\rangle ,H'=\langle S'\rangle \leq F_{n}$ are automorphically equivalent, that is, whether there exists $\varphi \in \operatorname {Aut} (F_{n})$ such that $\varphi (H)=H'$.
* Whitehead's algorithm and peak reduction play a key role in the proof by Culler and Vogtmann that the Culler–Vogtmann Outer space is contractible.
* Collins and Zieschang obtained analogs of Whitehead's peak reduction and of Whitehead's algorithm for automorphic equivalence in free products of groups.
* Gilbert used a version of a peak reduction lemma to construct a presentation for the automorphism group $\operatorname {Aut} (G)$ of a free product $G=\ast _{i=1}^{m}G_{i}$.
* Levitt and Vogtmann produced a Whitehead-type algorithm for saving the automorphic equivalence problem (for elects, m-tuples of elements and m-tuples of conjugacy classes) in a group $G=\pi _{1}(S)$ where $S$ is a closed hyperbolic surface.
* If an element $w\in F_{n}=F(X)$ chosen uniformly at random from the sphere of radius $m\geq 1$ in $F(X)$, then, with probability tending to 1 exponentially fast as $m\to \infty$, the conjugacy class $[w]$ is already automorphically minimal and, moreover, $\#V{\mathcal {A}}[w]=O\left(\|w\|_{X}\right)=O(m)$. Consequently, if $w,w'\in F_{n}$ are two such ``generic" elements, Whitehead's algorithm decides whether $w,w'$ are automorphically equivalent in linear time in $\max\{|w|_{X},|w'|_{X}\}$.
* Similar to the above results hold for the genericity of automorphic minimality for ``randomly chosen" finitely generated subgroups of $F_{n}$.
* Lee proved that if $u\in F_{n}=F(X)$ is a cyclically reduced word such that $[u]$ is automorphically minimal, and if whenever $x_{i},x_{j},i<j$ both occur in $u$ or $u^{-1}$ then the total number of occurrences of $x_{i}^{\pm 1}$ in $u$ is smaller than the number of occurrences of $x_{i}^{\pm 1}$, then $\#V{\mathcal {A}}[u]$ is bounded above by a polynomial of degree $2n-3$ in $|u|_{X}$. Consequently, if $w,w'\in F_{n},n\geq 3$ are such that $w$ is automorphically equivalent to some $u$ with the above property, then Whitehead's algorithm decides whether $w,w'$ are automorphically equivalent in time $O\left(\max\{|w|_{X}^{2n-3},|w'|_{X}^{2}\}\right)$.
* The Garside algorithm for solving the conjugacy problem in braid groups has a similar general structure to Whitehead's algorithm, with "cycling moves" playing the role of Whitehead moves.
* Clifford and Goldstein used Whitehead-algorithm based techniques to produce an algorithm that, given a finite subset $Z\subseteq F_{n}$ decides whether or not the subgroup $H=\langle Z\rangle \leq F_{n}$ contains a primitive element of $F_{n},$ that is an element of a free generating set of $F_{n}.$
* Day obtained analogs of Whitehead's algorithm and of Whitehead's peak reduction for automorphic equivalence of elements of right-angled Artin groups.