Palindromic length in FnF_n via reflection length in C2∗(n+1)C_2^{*(n+1)} and noncrossing matchings

16.9

Problem

Give an algorithm computing the palindromic length of an element of a finite-rank free group.

pl⁡(w)=min⁡{k:w=p1⋯pk, pi palindromes}.\operatorname{pl}(w)=\min\{k:w=p_1\cdots p_k,\ p_i\text{ palindromes}\}.

A palindrome equals its reversal as a reduced signed word. Multiplication is in the group, so cancellation between factors is allowed. The algorithm below also returns an optimal factorization.

Setup and result

Fix a free group FnF_n with specified basis X={x1,…,xn}X=\{x_1,\ldots,x_n\}, where n≥0n\geq0. A signed letter is xix_i or xi−1x_i^{-1}. An element is a palindrome if its freely reduced word reads the same in both directions, with the signs retained. The identity is a palindrome. Its palindromic length is

pl(w)=min⁡{k≥0:w=p1⋯pk, pj is a palindrome for every j}.\mathop{\mathrm{pl}}(w)=\min\{k\geq0:w=p_1\cdots p_k, \ p_j\text{ is a palindrome for every }j\}.

The empty product is the identity, so pl(1)=0\mathop{\mathrm{pl}}(1)=0. The minimum exists because every signed letter is a palindrome. All products in this definition are group products, and cancellation between factors is allowed. The basis is part of the definition.

This last distinction is essential. For distinct basis elements a,b,ca,b,c, the word abcaabca has no contiguous palindromic subword of length greater than one, but

abca=(aba) a−2 (aca)(2) \tag{2} abca=(aba)\,a^{-2}\,(aca)

is a product of three group palindromes. This example appears in Saarela (7, Example 4); its optimality will also follow from the computation in Section “A worked factorization”.

Bardakov, Shpilrain, and Tolstykh proved that palindromic length is unbounded in every nonabelian free group and asked for an algorithm computing it (2, Problem 2). Their question is recorded as Problem 16.9 of the Kourovka Notebook (6). Computability already follows from the theorem on twisted equations of Dahmani and Guirardel (1, Theorem 4), as explained below. We give an explicit reflection-length formula and the following quantitative construction.

Theorem 1. There is a terminating algorithm which, given a word representing w∈Fnw\in F_n, returns the integer q=pl(w)q=\mathop{\mathrm{pl}}(w) and freely reduced palindromes p1,…,pqp_1,\ldots,p_q with p1⋯pq=wp_1\cdots p_q=w. For a freely reduced input of positive length LL, the computation uses O(L3)O(L^3) arithmetic and symbol operations, O(L2)O(L^2) table entries, and O(L2)O(L^2) letters of written output. Table values and indices have O(log⁡(L+1))O(\log(L+1)) bits. The empty reduced input returns zero and the empty list of factors.

The model charges constant time for equality of basis labels, table access, and arithmetic on integers of the stated size. These are operation counts, rather than bit-complexity bounds for arbitrary encodings of generator names. A raw input of NN signed letters can be freely reduced with a stack in O(N)O(N) operations. Thus the complete bound is O(N+L3)O(N+L^3) when L>0L>0, and O(N)O(N) when L=0L=0.

The algebraic step is particularly simple to state. Let

W=⟨t,s1,…,sn∣t2=s12=⋯=sn2=1⟩≅C2∗⋯∗C2⏟n+1 factors,ι(xi)=sit.W=\langle t,s_1,\ldots,s_n\mid t^2=s_1^2=\cdots=s_n^2=1\rangle \cong\underbrace{C_2*\cdots*C_2}_{n+1\text{ factors}}, \qquad \iota(x_i)=s_i t.

A reflection of WW is a conjugate of one of its displayed generators, and ℓR(g)\mathop{\mathrm{\ell_{\mathcal R}}}(g) is the minimum number of reflections with product gg. The homomorphism ι\iota identifies FnF_n with the subgroup of even words in WW.

Theorem 2. For every w∈Fnw\in F_n,

pl(w)=min⁡{ℓR(ι(w)),ℓR(ι(w)t)}.(4) \tag{4} \mathop{\mathrm{pl}}(w)=\min\{\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)),\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)t)\}.

An optimal reflection factorization for the smaller term can be converted explicitly into an optimal palindromic factorization of ww. The two reflection lengths in (4) differ by exactly one.

Relation to earlier work

Proposition 3. Theorem 4 of Dahmani and Guirardel (1) implies an algorithm computing pl(w)\mathop{\mathrm{pl}}(w) and an optimal palindromic factorization.

Proof. Let θ(xi)=xi−1\theta(x_i)=x_i^{-1}. Then θ2=1\theta^2=1 and, by uniqueness of reduced words, pp is palindromic if and only if θ(p)p=1\theta(p)p=1. For 1≤k≤L=∣w∣1\leq k\leq L=|w|, consider the system

P1⋯Pk=w,θ(Pj)Pj=1(1≤j≤k).P_1\cdots P_k=w,\qquad \theta(P_j)P_j=1\quad(1\leq j\leq k).

Its twists generate a finite subgroup of Out⁡(Fn)\operatorname{Out}(F_n), so the cited theorem decides solvability. The first solvable system has k=pl(w)k=\mathop{\mathrm{pl}}(w); identities allow padding, and the individual signed letters give the upper bound LL. Enumerating tuples of reduced words then finds a solution for this least kk. The identity is handled separately. This deduction gives computability, without the explicit polynomial bound proved below. ◻

Reflection length and its computation have an established literature. Dyer (4) identifies reflection length in a Coxeter group with the fewest deletions from a fixed reduced expression that leave the identity. Brandenbursky, Gal, Kędra, and Marcinkowski (3) develop the cancellation norm and a cubic-time, quadratic-space interval algorithm for free groups. Their updated preprint includes a March 2023 erratum establishing the required word-independence statement for Coxeter groups and right-angled Artin groups. In the universal Coxeter group, inverse-letter pairing becomes equal-letter pairing. The matching recurrence used below is this cancellation-norm method specialized to the involutive alphabet.

The contribution developed here is the exact reduction (4), its use to compute group-palindromic length and recover optimal factors, and a formal verification of the assembled algorithm. The cancellation-norm recurrence is not claimed as a new algorithm. A direct proof of its specialization is included, in particular the cancellation argument in Appendix “Cancellation surgery for noncrossing matchings”.

Saarela (7) compares palindromic length in free monoids and free groups. Frid (5) gives structural characterizations for products of at most two or three palindromes and discusses the general algorithmic question. Those characterizations describe the reduced word itself as a concatenation of prescribed forms. The present algorithm allows arbitrary palindromic length and returns a group factorization; it does not assert analogous concatenation forms for all lengths.

The reflection-length reduction

Normal forms and involutions

Let S={s0,s1,…,sn}S=\{s_0,s_1,\ldots,s_n\}, put t=s0t=s_0, and consider

W=⟨s0,s1,…,sn∣si2=1 (0≤i≤n)⟩.(6) \tag{6} W=\langle s_0,s_1,\ldots,s_n\mid s_i^2=1\ (0\leq i\leq n)\rangle.

We use capital letters such as U,V,CU,V,C for words on SS, and write [U][U] for the element of WW represented by UU. The empty word is ∅\varnothing. A word on SS is reduced if adjacent letters are different. The elementary reduction is deletion of an adjacent pair aaaa.

For completeness we establish the normal form used below directly. If RR is reduced and a∈Sa\in S, define the stack update

Ta(R)={R′,R=R′a,Ra,R is empty or its last letter is different from a.T_a(R)= \begin{cases} R',&R=R'a,\\ Ra,&R\text{ is empty or its last letter is different from }a. \end{cases}

Both outputs are reduced. Moreover, Ta(Ta(R))=RT_a(T_a(R))=R: an appended letter is removed on the next update, while a removed letter is appended again because the preceding letter, if any, is different from aa.

Lemma 4. Every element of WW has exactly one reduced representative. Reading a word from left to right with the updates TaT_a computes that representative. Two words represent the same element if and only if they are connected by insertions and deletions of adjacent equal pairs.

Proof. Let N(U)N(U) be the stack output starting at the empty word. It is reduced. Induction on the number of letters read shows that the prefix already read can be reduced to the current stack: the next letter is either appended or cancels the last stack letter. Hence UU is equivalent, by adjacent-pair deletions, to N(U)N(U).

Insertion or deletion of aaaa anywhere in the input leaves the stack output unchanged. Indeed, after the prefix preceding that pair has been read, the two intervening updates have composite Ta2T_a^2, which is the identity. The suffix is then read from the same stack in both cases. Thus NN is constant on the equivalence relation generated by the defining insertions and deletions. A reduced word is its own stack output, so equivalent reduced words are literally equal.

The quotient of the word monoid by these insertions and deletions is a group: rev(U)\mathop{\mathrm{rev}}(U) is an inverse to UU, since Urev(U)U\mathop{\mathrm{rev}}(U) and rev(U)U\mathop{\mathrm{rev}}(U)U cancel from the middle outwards. This quotient has exactly the presentation (6). Consequently the preceding existence and uniqueness statements are statements about WW itself. ◻

In particular, the inverse of a reduced word on SS is its literal reversal. Each defining cancellation changes length by two. There is therefore a well-defined homomorphism

ϵ:W⟶Z/2Z,ϵ([U])=∣U∣(mod2).(8) \tag{8} \epsilon:W\longrightarrow\mathbb Z/2\mathbb Z, \qquad \epsilon([U])=|U|\pmod 2.

Write W+=ker⁡ϵW^+=\ker\epsilon for its even subgroup.

Definition 5. A reflection of WW is an element csic−1c s_i c^{-1}, where c∈Wc\in W and 0≤i≤n0\leq i\leq n. Write R\mathcal R for the set of reflections and put

ℓR(g)=min⁡{q≥0:g=r1⋯rq, rj∈R}.\mathop{\mathrm{\ell_{\mathcal R}}}(g)=\min\{q\geq 0:g=r_1\cdots r_q,\ r_j\in\mathcal R\}.

This is the reflection length of gg.

The minimum exists because the generators themselves are reflections. Every reflection has odd parity, so every reflection factorization of gg has the same parity of factor count:

ℓR(g)≡ϵ(g)(mod2).(10) \tag{10} \mathop{\mathrm{\ell_{\mathcal R}}}(g)\equiv\epsilon(g)\pmod 2.

Lemma 6. The reflections are exactly the nonidentity involutions of WW.

Proof. A conjugate of a generator is nonidentity and has square one. Conversely, let g≠1g\ne 1 have square one, and start with its nonempty reduced word. Whenever the first and last letters agree, remove them, recording the removal as a conjugation. The process terminates with

g=c[h]c−1,g=c[h]c^{-1},

where hh is reduced and either has one letter or has different first and last letters. The word hh cannot be empty: deleting matching end letters from a nonempty reduced word cannot pass through a reduced word of length two with equal letters. If ∣h∣≥2|h|\geq 2, the word hhhh is reduced, since there is no cancellation at its central junction. It is nonempty, and hence [h]2≠1[h]^2\ne 1 by Lemma 4. This contradicts g2=1g^2=1. Therefore h=sih=s_i for some ii, and gg is a reflection. ◻

The even subgroup and palindromes

The assignment

ι(xi)=sit(1≤i≤n)(12) \tag{12} \iota(x_i)=s_i t\qquad(1\leq i\leq n)

extends uniquely to a homomorphism ι:Fn→W\iota:F_n\to W. Its image lies in W+W^+. At the level of signed words, the two substitution rules are

xi⟼sit,xi−1⟼tsi.(13) \tag{13} x_i\longmapsto s_i t, \qquad x_i^{-1}\longmapsto t s_i.

Lemma 7. The map ι\iota is an isomorphism from FnF_n onto W+W^+. Its inverse δ:W+→Fn\delta:W^+\to F_n can be computed by splitting any even representative into consecutive pairs and making the replacement

sisj⟼xixj−1,x0=1.(14) \tag{14} s_i s_j\longmapsto x_i x_j^{-1}, \qquad x_0=1.

Proof. We first show that pair decoding does not depend on the even representative. Consider deletion of an adjacent pair sasas_a s_a. If the two letters form one decoding block, their contribution is xaxa−1=1x_a x_a^{-1}=1. If they straddle two blocks, the affected substring has the form (sisa)(sasj)(s_i s_a)(s_a s_j). Before deletion its contribution is

xixa−1xaxj−1,x_i x_a^{-1}x_a x_j^{-1},

and after deletion it is xixj−1x_i x_j^{-1}. These are equal. In the second case both outside letters exist because the total length is even and the deleted letters straddle a block boundary. The convention x0=1x_0=1 makes the same argument valid when some indices are zero. All later block boundaries retain their parity. The decoded group element is consequently unchanged by every elementary deletion and, in reverse, by every insertion. Lemma 4 proves that δ\delta is well-defined.

Concatenating even words preserves their block boundaries, so δ\delta is a homomorphism. For 1≤i≤n1\leq i\leq n we have δ(ι(xi))=δ(sit)=xi\delta(\iota(x_i))=\delta(s_i t)=x_i. In the other direction,

ι(xixj−1)=sittsj=sisj.\iota(x_i x_j^{-1})=s_i t t s_j=s_i s_j.

This identity also holds for zero indices if one interprets ι(x0)=1=s0t\iota(x_0)=1=s_0t. Applying it to every pair shows that ιδ\iota\delta is the identity on W+W^+. Hence the homomorphisms are mutually inverse. ◻

Let θ\theta be the automorphism of FnF_n defined on the basis by θ(xi)=xi−1\theta(x_i)=x_i^{-1}. Applying this substitution twice fixes every generator, so θ2\theta^2 is the identity. Conjugation by tt realizes this automorphism in WW:

tι(g)t=ι(θ(g))(g∈Fn).(17) \tag{17} t\iota(g)t=\iota(\theta(g))\qquad(g\in F_n).

Indeed, on a generator the left side is t(sit)t=tsi=ι(xi−1)t(s_it)t=ts_i=\iota(x_i^{-1}), and both sides define homomorphisms in gg.

Lemma 8. For every p∈Fnp\in F_n, the following statements are equivalent:

  1. pp is a palindrome;

  2. θ(p)=p−1\theta(p)=p^{-1};

  3. ι(p)t\iota(p)t is a reflection of WW.

These equivalences include p=1p=1.

Proof. Let b1⋯bkb_1\cdots b_k be the reduced representative of pp. The word b1−1⋯bk−1b_1^{-1}\cdots b_k^{-1} is reduced and represents θ(p)\theta(p), whereas bk−1⋯b1−1b_k^{-1}\cdots b_1^{-1} is reduced and represents p−1p^{-1}. Uniqueness of free reduction makes their equality equivalent to bi=bk+1−ib_i=b_{k+1-i} for every ii. This proves the first equivalence.

By (17),

(ι(p)t)2=ι(p) tι(p)t=ι(pθ(p)).(\iota(p)t)^2 =\iota(p)\,t\iota(p)t =\iota(p\theta(p)).

Injectivity of ι\iota shows that this square is one exactly when θ(p)=p−1\theta(p)=p^{-1}. The element ι(p)t\iota(p)t has odd parity and so is never the identity. Lemma 6 now gives the second equivalence. For p=1p=1 the corresponding reflection is tt. ◻

Transporting factorizations

The need for two reflection lengths is a parity issue: a product of an even number of palindromes and a product of an odd number lead to different elements of WW.

Proof of the identity in Theorem 2. Suppose first that w=p1⋯pkw=p_1\cdots p_k, where every pjp_j is a palindrome. For 1≤j≤k1\leq j\leq k, set

rj=tj−1ι(pj)tj=tj−1(ι(pj)t)tj−1.(19) \tag{19} r_j=t^{j-1}\iota(p_j)t^j =t^{j-1}(\iota(p_j)t)t^{j-1}.

The second equality uses t2=1t^2=1. By Lemma 8, each rjr_j is a conjugate of a reflection and hence a reflection. In the product the powers tjtjt^j t^j at successive junctions cancel, giving

r1⋯rk=ι(p1⋯pk)tk=ι(w)tk.r_1\cdots r_k=\iota(p_1\cdots p_k)t^k=\iota(w)t^k.

Thus one of the two reflection lengths in (4) is at most kk. Taking the minimum over palindromic factorizations proves that the right side is at most pl(w)\mathop{\mathrm{pl}}(w). The argument also covers k=0k=0.

Conversely, fix e∈{0,1}e\in\{0,1\} and take a shortest reflection factorization

ι(w)te=r1⋯rq,q=ℓR(ι(w)te).(21) \tag{21} \iota(w)t^e=r_1\cdots r_q, \qquad q=\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)t^e).

Odd parity of reflections implies q≡e(mod2)q\equiv e\pmod 2. Define

Pj=tj−1rjtj∈W+,pj=δ(Pj).(22) \tag{22} P_j=t^{j-1}r_jt^j\in W^+, \qquad p_j=\delta(P_j).

The parity of PjP_j is (j−1)+1+j=2j(j-1)+1+j=2j, as required to apply δ\delta. Further,

Pjt=tj−1rjtj−1P_jt=t^{j-1}r_jt^{j-1}

is a reflection. Lemma 8 shows that pjp_j is a palindrome. Multiplication again cancels all intervening even powers of tt, and gives

ι(p1⋯pq)=r1⋯rqtq=ι(w)te+q=ι(w).\iota(p_1\cdots p_q) =r_1\cdots r_qt^q =\iota(w)t^{e+q} =\iota(w).

Injectivity of ι\iota proves that their product is ww. Consequently pl(w)≤q\mathop{\mathrm{pl}}(w)\leq q for each choice of ee, which is the other inequality in (4). ◻

Corollary 9. The integers ℓR(ι(w))\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)) and ℓR(ι(w)t)\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)t) differ by exactly one.

Proof. Since tt is a reflection, appending it to a factorization proves ℓR(gt)≤ℓR(g)+1\mathop{\mathrm{\ell_{\mathcal R}}}(gt)\leq\mathop{\mathrm{\ell_{\mathcal R}}}(g)+1. Applying this with gtgt instead of gg gives the reverse inequality up to one. By (10), gg and gtgt have reflection lengths of opposite parity. Their difference is therefore nonzero and has absolute value one. ◻

Remark 10. For later reconstruction, there is a convenient equivalent form of (22). Put hj=δ(rjt)h_j=\delta(r_jt). Then

pj=θj−1(hj).(25) \tag{25} p_j=\theta^{j-1}(h_j).

Indeed, Pj=tj−1(rjt)tj−1P_j=t^{j-1}(r_jt)t^{j-1}, and (17) applies. Thus one need only append a single tt to each reflection word, decode its consecutive pairs, freely reduce, and invert every signed letter when jj is even. The last operation retains the order of the letters. Formula (25) avoids writing long powers of tt.

Reflection length and noncrossing matchings

Definition 11. Let v=a0⋯am−1v=a_0\cdots a_{m-1} be any word on SS, without a reduction assumption. An equal-letter noncrossing matching on vv is a set MM of pairs (i,j)(i,j) of positions such that

  1. 0≤i<j<m0\leq i<j<m and ai=aja_i=a_j;

  2. every position occurs in at most one pair; and

  3. there are no pairs (i,j),(k,l)(i,j),(k,l) with i<k<j<li<k<j<l.

Positions in no pair are called unmatched. The cost of MM is the number of unmatched positions, and D(v)D(v) is the minimum of these costs.

There are finitely many matchings on a finite set of positions, and the empty set of pairs is allowed. Hence this minimum is attained. Every matching cost is of the form m−2∣M∣m-2|M|; in particular,

0≤D(v)≤m,D(v)≡m(mod2).(26) \tag{26} 0\leq D(v)\leq m, \qquad D(v)\equiv m\pmod 2.

It is useful to record the recursive structure of these matchings. In a nonempty word, either the first position is unmatched, or it is paired to some later occurrence of the same letter. In the second case write the word as aUaVaUaV, with the indicated two occurrences paired. No pair connects a position in UU to a position in VV, because it would cross the indicated pair. Thus every matching is obtained uniquely in one of the following ways, with the displayed costs:

wordconstructioncost∅empty matching0aUfirst position unmatched; a matching on U1+uaUaVpair the displayed a’s; match U and Vu+v.(27) \tag{27} \begin{array}{c|c|c} \text{word}&\text{construction}&\text{cost}\\ \hline \varnothing&\text{empty matching}&0\\ aU&\text{first position unmatched; a matching on }U&1+u\\ aUaV&\text{pair the displayed }a\text{'s; match }U\text{ and }V&u+v. \end{array}

Here uu and vv are the costs of the chosen matchings on the corresponding subwords, rather than necessarily their minimum costs. Conversely, each construction in (27) gives a noncrossing matching. Concatenation of matchings on consecutive subwords also preserves noncrossing and adds their costs.

The essential point is that DD respects group cancellation. We give a proof using the first-position decomposition, so that all changes to a matching are explicit.

Proposition 12. For all words U,VU,V on SS and every letter a∈Sa\in S,

D(UaaV)=D(UV).(28) \tag{28} D(UaaV)=D(UV).

Proof. Adding an adjacent matched pair gives D(UaaV)≤D(UV)D(UaaV)\leq D(UV). For the converse, a matching can be carried through the deletion of aaaa without increasing its unmatched count. The complete matching surgery, including the case where the two deleted positions have distinct partners, is proved in Appendix “Cancellation surgery for noncrossing matchings”. ◻

The matching formula

Lemma 13. The value D(v)D(v) depends only on [v]∈W[v]\in W. Regarded as a function on WW, it satisfies

D(gh)≤D(g)+D(h),D(cgc−1)=D(g),D(si)=1.(29) \tag{29} \begin{gathered} D(gh)\leq D(g)+D(h),\\ D(cgc^{-1})=D(g),\qquad D(s_i)=1. \end{gathered}

Proof. Well-definedness follows from Proposition 12 and Lemma 4. Concatenation of optimal matchings proves subadditivity.

For a letter aa and a word VV, pair the outer letters of aVaaVa and retain an optimal matching inside. This gives D(aVa)≤D(V)D(aVa)\leq D(V). Apply the same inequality with aVaaVa in place of VV. Two adjacent cancellations then give

D(V)=D(aaVaa)≤D(aVa).D(V)=D(aaVaa)\leq D(aVa).

Thus conjugation by a generator preserves DD. Iterating this identity proves invariance under conjugation by an arbitrary element of WW. Finally, a one-letter word has no possible pair, so its minimum unmatched count is one. ◻

Proposition 14. For every word vv on SS,

D(v)=ℓR([v]).(31) \tag{31} D(v)=\mathop{\mathrm{\ell_{\mathcal R}}}([v]).

More precisely, every matching on vv with qq unmatched positions determines a factorization of [v][v] into qq reflections.

Proof. By Lemma 13, each reflection has DD-value one. For a factorization [v]=r1⋯rq[v]=r_1\cdots r_q, subadditivity therefore gives

D(v)≤D(r1)+⋯+D(rq)=q.D(v)\leq D(r_1)+\cdots+D(r_q)=q.

Taking a shortest reflection factorization proves D(v)≤ℓR([v])D(v)\leq\mathop{\mathrm{\ell_{\mathcal R}}}([v]).

We prove the more precise statement by induction on ∣v∣|v|, using the matching decomposition (27). The empty word requires the empty factorization. If v=aUv=aU and its first position is unmatched, factor [U][U] by induction and precede those factors by the reflection aa. This adds exactly one factor, corresponding to the unmatched first position.

If the first position is paired, write v=aUaVv=aUaV. The restrictions of the matching to UU and VV have, say, uu and v′v' unmatched positions. By induction choose reflection factorizations

[U]=r1⋯ru,[V]=ru+1⋯ru+v′.[U]=r_1\cdots r_u, \qquad [V]=r_{u+1}\cdots r_{u+v'}.

Then

[aUaV]=(ar1a)⋯(arua)ru+1⋯ru+v′.(34) \tag{34} [aUaV] =(a r_1 a)\cdots(a r_u a) r_{u+1}\cdots r_{u+v'}.

Every displayed factor is a reflection. The number of factors is u+v′u+v', the cost of the given matching. The identities also hold when either factor list is empty. Applying this result to an optimal matching gives ℓR([v])≤D(v)\mathop{\mathrm{\ell_{\mathcal R}}}([v])\leq D(v), proving (31). ◻

One can also formulate the same quantity as a deletion minimum. For reduced words this is Dyer’s characterization (4) in the universal Coxeter group; the statement here also permits unreduced representatives.

Corollary 15. For any word vv on SS, D(v)D(v) is the least number of positions whose deletion leaves a word representing the identity in WW.

Proof. Delete the unmatched positions of a noncrossing matching. The remaining matching is perfect. Its word reduces to the empty word: by (27), a nonempty perfectly matched word is aUaVaUaV with UU and VV perfectly matched; inductively reduce UU and VV and cancel the resulting aaaa. Thus any matching of cost qq supplies qq deletions leaving the identity.

Conversely, suppose qq deletions leave a word representing the identity. By Lemma 4, the surviving word reduces to the empty word. Record the two original positions removed at each adjacent cancellation. These pairs form a perfect equal-letter noncrossing matching on the surviving positions. To see noncrossing directly, a pair removed later cannot have exactly one endpoint between the endpoints of an earlier pair: that endpoint would still separate the earlier pair at the time it was removed. Reinserting the deleted positions as unmatched positions preserves the order of all paired endpoints and hence preserves noncrossing. It produces a matching on vv of cost qq. Taking minima in both directions proves the claim. ◻

The interval dynamic program

Fix a word v=a0⋯am−1v=a_0\cdots a_{m-1} on SS. For integers 0≤i≤j≤m0\leq i\leq j\leq m, write v[i,j)=ai⋯aj−1v[i,j)=a_i\cdots a_{j-1} and set

di,j=D(v[i,j)).d_{i,j}=D(v[i,j)).

The interval is half open: it includes ii and excludes jj. In particular, di,i=0d_{i,i}=0.

Proposition 16. For every i<ji<j,

di,j=min⁡({1+di+1,j} ∪ {di+1,k+dk+1,j:i<k<j, ai=ak}).(36) \tag{36} d_{i,j}= \min\left( \{1+d_{i+1,j}\}\, \cup\, \{d_{i+1,k}+d_{k+1,j}:i<k<j,\ a_i=a_k\} \right).

The minimum always has at least one candidate.

Proof. If the first position is unmatched, its cost is one plus the cost of a matching on v[i+1,j)v[i+1,j). The best such matching has cost 1+di+1,j1+d_{i+1,j}, and adjoining the unmatched position attains this value.

If the first position is paired to kk, equality of labels requires ai=aka_i=a_k. Noncrossing separates the remaining matching into one on v[i+1,k)v[i+1,k) and one on v[k+1,j)v[k+1,j). Its cost is at least di+1,k+dk+1,jd_{i+1,k}+d_{k+1,j}, and pairing ii to kk around optimal matchings on those two intervals attains that bound. These possibilities exhaust all matchings by (27). The unmatched alternative is available even when there is no equal-letter partner. ◻

Algorithm 17. Given v=a0⋯am−1v=a_0\cdots a_{m-1}, construct a cost table dd and a choice table cc as follows.

  1. Set di,i=0d_{i,i}=0 for 0≤i≤m0\leq i\leq m.

  2. For i=m−1,m−2,…,0i=m-1,m-2,\ldots,0, and for each j=i+1,i+2,…,mj=i+1,i+2,\ldots,m, perform these steps:

    1. initialize di,j=1+di+1,jd_{i,j}=1+d_{i+1,j} and ci,j=skipc_{i,j}=\mathsf{skip};

    2. examine k=i+1,i+2,…,j−1k=i+1,i+2,\ldots,j-1 in order; whenever ai=aka_i=a_k and di+1,k+dk+1,j<di,jd_{i+1,k}+d_{k+1,j}<d_{i,j}, replace di,jd_{i,j} by this sum and set ci,j=pair(k)c_{i,j}=\mathsf{pair}(k).

A tie retains the previously stored choice. No choice is required on an empty interval.

Every table entry on the right side of (36) has starting index strictly greater than ii. Thus every read in Algorithm 17 accesses an already computed row. All loops are finite. Increasing interval width is an equivalent valid evaluation order, but the decreasing-row order above agrees with the accompanying implementation.

Proposition 18. Algorithm 17 terminates and returns di,j=D(v[i,j))d_{i,j}=D(v[i,j)) for every interval. Each stored choice attains that minimum and, recursively, specifies an optimal noncrossing matching of the interval.

Proof. Induct downwards on the starting index ii. Empty intervals have the correct value zero. Every dependency of a positive-width interval starts strictly to the right of ii, and hence has already been computed correctly. The initialization supplies exactly the first candidate of (36); the finite scan compares it to every other permissible candidate. The final entry is therefore exactly the minimum in that equation. Its stored choice attains the entry because a choice is changed only together with the corresponding value. Combining the inductively optimal submatchings according to that choice gives an attaining matching, as in the proof of Proposition 16. ◻

Reconstructing reflections and palindromes

We give the reconstruction explicitly, including a form that avoids repeated copying of whole lists of reflection factors.

Use a word CC on SS as an accumulated conjugator. Define Reflect(i,j,C)\mathsf{Reflect}(i,j,C) to return a list of reflection words by the following recursion, in which the product of the returned list will be [C] [v[i,j)] [C]−1[C]\,[v[i,j)]\,[C]^{-1}:

  1. If i=ji=j, return the empty list.

  2. If ci,j=skipc_{i,j}=\mathsf{skip}, emit the word Cairev(C)C a_i\mathop{\mathrm{rev}}(C), and then return the list Reflect(i+1,j,C)\mathsf{Reflect}(i+1,j,C) after it.

  3. If ci,j=pair(k)c_{i,j}=\mathsf{pair}(k), return, in this order, the list Reflect(i+1,k,Cai)\mathsf{Reflect}(i+1,k,Ca_i) followed by the list Reflect(k+1,j,C)\mathsf{Reflect}(k+1,j,C).

The initial call is Reflect(0,m,∅)\mathsf{Reflect}(0,m,\varnothing). All subintervals in recursive calls have strictly smaller width. One may equivalently use an explicit stack; in the paired case, put the tail task on the stack before the interior task so that the interior is processed first.

Proposition 19. Fix an interval [i,j)[i,j) and a word CC. The call Reflect(i,j,C)\mathsf{Reflect}(i,j,C) terminates. It returns exactly di,jd_{i,j} reflections, and their ordered product is

[C] [v[i,j)] [C]−1.[C]\,[v[i,j)]\,[C]^{-1}.

Proof. Induct on j−ij-i. The empty-interval claim is immediate. In the unmatched case the first emitted word represents a reflection, and induction gives the product of the remaining list. Their product is

([C]ai[C]−1)([C] [v[i+1,j)] [C]−1)=[C] [v[i,j)] [C]−1.([C]a_i[C]^{-1}) ([C]\,[v[i+1,j)]\,[C]^{-1}) =[C]\,[v[i,j)]\,[C]^{-1}.

The number of factors is 1+di+1,j=di,j1+d_{i+1,j}=d_{i,j} by the stored choice.

In the paired case let U=v[i+1,k)U=v[i+1,k) and V=v[k+1,j)V=v[k+1,j). Then v[i,j)=aiUaiVv[i,j)=a_iUa_iV. By induction the two returned lists have products

[C]ai[U]ai[C]−1and[C][V][C]−1.[C]a_i[U]a_i[C]^{-1} \quad\text{and}\quad [C][V][C]^{-1}.

Their product is the required conjugate of aiUaiVa_iUa_iV. Their factor counts add to di+1,k+dk+1,j=di,jd_{i+1,k}+d_{k+1,j}=d_{i,j}. Each factor is a reflection by the same induction, since every emission has the form of a conjugated generator. Strict decrease of widths proves termination in both cases. ◻

We can now state the complete algorithm in the original free group without leaving any minimization as an oracle.

Algorithm 20. Given a word on the signed basis X±1X^{\pm1}, perform the following operations.

  1. Freely reduce the input to a word ww. If it is empty, return zero and the empty list.

  2. Substitute the rules (13) and reduce adjacent equal pairs to obtain a word vv representing ι(w)\iota(w).

  3. Set v0=vv_0=v and v1=vtv_1=vt. Use Algorithm 17 to compute the cost and choice tables for each of these two words. Write qeq_e for the full-interval entry of the table for vev_e.

  4. Choose e∈{0,1}e\in\{0,1\} for which qeq_e is smaller, and reconstruct the reflection words R1,…,RqR_1,\ldots,R_q for vev_e, where q=qeq=q_e.

  5. For j=1,…,qj=1,\ldots,q, decode the even word RjtR_jt using (14) and freely reduce the result to hjh_j. If jj is odd, put pj=hjp_j=h_j; if jj is even, put pj=θ(hj)p_j=\theta(h_j) by inverting every signed letter without changing its position.

  6. Return qq and the list p1,…,pqp_1,\ldots,p_q.

The word vtvt need not be reduced. Proposition 12 is the reason it may be used directly. By Corollary 9, the two full-interval values differ by one, so the choice in step 4 is unambiguous. If desired, one table for vtvt supplies both costs and both sets of choices: the relevant root intervals are [0,∣v∣)[0,|v|) and [0,∣v∣+1)[0,|v|+1). Using two tables makes no difference to the asymptotic bounds.

Theorem 21. Algorithm 20 terminates. Its output satisfies q=pl(w)q=\mathop{\mathrm{pl}}(w), every pjp_j is a freely reduced palindrome, and p1⋯pq=wp_1\cdots p_q=w in FnF_n.

Proof. All reductions and substitutions scan finite words. Table construction terminates by Proposition 18, and reconstruction terminates by Proposition 19. There are finitely many output words, each finite, so the remaining decoding and free reduction also terminate.

For a nonempty reduced input, Propositions 18 and 14 identify the two costs as

q0=ℓR(ι(w)),q1=ℓR(ι(w)t).q_0=\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)),\qquad q_1=\mathop{\mathrm{\ell_{\mathcal R}}}(\iota(w)t).

Theorem 2 gives q=min⁡(q0,q1)=pl(w)q=\min(q_0,q_1)=\mathop{\mathrm{pl}}(w). Reconstruction yields qq reflections rj=[Rj]r_j=[R_j] with product ι(w)te\iota(w)t^e. Every RjR_j has odd length, since it is explicitly a word Carev(C)C a\mathop{\mathrm{rev}}(C). Therefore RjtR_jt is even and can be decoded. Remark 10 identifies the resulting pjp_j with the factors (22). The proof of Theorem 2 establishes that they are palindromes and that their product is ww.

Step 5 explicitly freely reduces each hjh_j. Inverting all signed letters preserves reducedness, so the returned pjp_j are freely reduced as well. A returned identity factor, if there were one, could be omitted, contradicting q=pl(w)q=\mathop{\mathrm{pl}}(w). Thus the optimal nonempty output contains no identity factors. The empty reduced input is handled directly and has all the asserted properties with q=0q=0. ◻

Time, storage, and output bounds

The bounds on the written factors require some care: the recursive identity (34) is a correct construction, but naively copying every intermediate factor list is unnecessary. The accumulated-conjugator recursion above gives the stated bounds directly.

Lemma 22. For an input word of length mm, the interval table has exactly

(m+1)(m+2)2(41) \tag{41} \frac{(m+1)(m+2)}{2}

entries, including empty intervals. Algorithm 17 examines exactly

∑h=1m(m−h+1)(h−1)=(m+13)(42) \tag{42} \sum_{h=1}^{m}(m-h+1)(h-1) =\binom{m+1}{3}

possible partner positions. Table construction uses O(m3)O(m^3) operations and O(m2)O(m^2) entries. Costs and choice indices require O(log⁡(m+1))O(\log(m+1)) bits for m≥1m\geq1.

Proof. There are m−h+1m-h+1 intervals of width hh for 0≤h≤m0\leq h\leq m. Summing these counts gives (41). Each positive width-hh interval initializes one unmatched candidate and examines its h−1h-1 possible partners, which gives the sum in (42). Equivalently, a partner examination is a triple 0≤i<k<j≤m0\leq i<k<j\leq m; the number of such triples is (m+13)\binom{m+1}{3}. At each examination there is one label test and, if the labels agree, a bounded number of accesses, additions, comparisons, and assignments. Initialization uses O(m2)O(m^2) operations, so the total is O(m3)O(m^3) for m≥1m\geq1.

Every cost is at most its interval width by (26). The sum in a paired candidate is at most (k−i−1)+(j−k−1)=j−i−2(k-i-1)+(j-k-1)=j-i-2, and the unmatched candidate is at most j−ij-i. Thus intermediate candidate values also fit between zero and mm. Indices lie between zero and mm; one additional tag distinguishes the unmatched choice. These quantities use O(log⁡(m+1))O(\log(m+1)) bits. ◻

Lemma 23. Starting from a word of length mm, the reconstruction produces at most mm reflection words, each of length at most mm. Their total written length is at most m2m^2, and reconstruction can be performed in O(m2)O(m^2) operations using an additional O(m)O(m) working space besides the output.

Proof. One reflection is emitted for each unmatched position of the chosen matching. Hence the number of emitted words is q=D(v)≤mq=D(v)\leq m. For a particular emitted word Cairev(C)C a_i\mathop{\mathrm{rev}}(C), let d=∣C∣d=|C|. Each letter of CC was appended on a descent into the interior of a matched pair. These dd pair descents involve 2d2d distinct positions of the original word, and the emitted unmatched position is distinct from all of them. Therefore 2d+1≤m2d+1\leq m, and

∣Cairev(C)∣=2d+1≤m.|C a_i\mathop{\mathrm{rev}}(C)|=2d+1\leq m.

Summing over the qq emitted words gives total length at most qm≤m2qm\leq m^2. Reducing any emitted word can only shorten it.

For the time bound, a skip node of the recursion consumes one position, and a pair node consumes two. The subintervals at a pair node are disjoint. Thus there are at most mm nonempty nodes; the number of empty children is also O(m)O(m). Maintain the conjugator by a linked stack, appending or removing one letter on descent or return. This takes constant time per change and at most O(m)O(m) simultaneous storage. On each emission, traverse that stack to write the conjugator and its reversal around the central letter. The work per emission is linear in its written length. The node traversal uses O(m)O(m) operations and the emissions use O(m2)O(m^2). The task stack for a depth-first traversal has depth at most mm, with constant-size data in each frame. ◻

Proposition 24. For a freely reduced input of length L>0L>0, the work in Algorithm 20 after free reduction is O(L3)O(L^3) operations. It uses O(L2)O(L^2) table entries with O(log⁡(L+1))O(\log(L+1)) bits per entry, and the total length of its returned free-group factors is O(L2)O(L^2).

Proof. The letter substitutions (13) create 2L2L Coxeter letters. Stack reduction never increases that length. Hence the reduced encoding vv has length at most 2L2L, while vtvt has length at most 2L+12L+1. Lemma 22 applied to the two tables gives the time, entry-count, and integer-size bounds. Encoding and its reduction take O(L)O(L) operations.

Let m≤2L+1m\leq2L+1 be the length of the word chosen for reconstruction, and q≤mq\leq m its minimum cost. By Lemma 23, each RjR_j has length at most mm, and the sum of their lengths is at most m2m^2. Appending tt adds one letter per factor. The decoder replaces each pair by at most two signed letters; occurrences of x0x_0 are omitted. Free reduction and the possible application of θ\theta do not increase the resulting length. Consequently

∑j=1q∣pj∣≤∑j=1q(∣Rj∣+1)≤m2+m≤(2L+1)(2L+2)≤12L2.(44) \tag{44} \sum_{j=1}^q |p_j| \leq\sum_{j=1}^q (|R_j|+1) \leq m^2+m \leq(2L+1)(2L+2) \leq12L^2.

Decoding, free reduction, and inversion of signed letters are linear in the words processed. They therefore use O(m2)=O(L2)O(m^2)=O(L^2) operations. The additional working space and written output also fit within O(L2)O(L^2) words of storage. ◻

Proof of Theorem 1. Theorem 21 proves termination, validity of every output factor, equality of the product, and optimality of the factor count. Proposition 24 proves all resource bounds after free reduction. A stack computes free reduction in linear time: each raw input letter is pushed at most once and popped at most once. The empty reduced word is handled by the first step of the algorithm. These statements include the rank-zero group, where the only reduced word is empty. ◻

A worked factorization

Let a=x1a=x_1, b=x2b=x_2, and c=x3c=x_3 be distinct basis elements, and revisit Saarela’s example w=abcaw=abca (7, Example 4). The reduced Coxeter encoding and the reduced representative after multiplication by tt are

v=s1ts2ts3ts1t,u=s1ts2ts3ts1.v=s_1t s_2t s_3t s_1t, \qquad u=s_1t s_2t s_3t s_1.

Since vt=uttvt=utt cancels to uu, Proposition 12 gives D(vt)=D(u)D(vt)=D(u). In uu choose pairs (0,6)(0,6) and (1,5)(1,5). The remaining three positions, with letters s2,t,s3s_2,t,s_3, are unmatched.

The labels s2s_2 and s3s_3 occur only once, so their two positions must be unmatched in every matching of uu. Since ∣u∣=7|u|=7 is odd, every matching has an odd number of unmatched positions. Thus D(u)≥3D(u)\geq3, and the displayed matching proves D(u)=3D(u)=3.

In the word vv, again the s2s_2 and s3s_3 positions must be unmatched. A matching of cost two would consequently pair the two occurrences of s1s_1 at positions 00 and 66 and would match all four occurrences of tt at positions 1,3,5,71,3,5,7. But position 77 would then be paired to one of 1,3,51,3,5, crossing (0,6)(0,6). Such a matching is impossible. The parity bound (26) now gives D(v)≥4D(v)\geq4. The pairs (0,6),(1,5)(0,6),(1,5) in vv leave exactly four unmatched positions, so D(v)=4D(v)=4. The reflection-length formula yields

pl(abca)=min⁡{4,3}=3.\mathop{\mathrm{pl}}(abca)=\min\{4,3\}=3.

For the indicated matching of uu, reconstruction gives the three reflections

r1=s1ts2ts1,r2=s1ts1,r3=s1ts3ts1.r_1=s_1t s_2t s_1,\qquad r_2=s_1t s_1,\qquad r_3=s_1t s_3t s_1.

They arise by conjugating the unmatched letters s2,t,s3s_2,t,s_3 by s1ts_1t; the middle conjugate has been reduced. Appending tt, pair decoding, and applying (25) give the optimal factorization

abca=(aba) a−2 (aca).(48) \tag{48} abca=(aba)\,a^{-2}\,(aca).

Each factor is a reduced palindrome, and multiplication reduces the right side to abcaabca. Another optimal factorization is

abca=a2 (a−1ba−1) (aca).abca=a^2\,(a^{-1}ba^{-1})\,(aca).

There is no contiguous palindromic subword of abcaabca with length greater than one. Thus a partition of this particular reduced string into contiguous palindromes would need four pieces, even though its group palindromic length is three. The cancellations permitted in the definition are essential.

Explicit counting bounds

For the reduced input length L>0L>0, let CC denote the number of partner candidates inspected in the two tables, EE their total number of entries, and p1,…,pqp_1,\ldots,p_q the output. The companion proves

C≤35L3,E≤25L2,∑j=1q∣pj∣≤12L2.(50) \tag{50} C\leq35L^3,\qquad E\leq25L^2,\qquad \sum_{j=1}^{q}|p_j|\leq12L^2.

These are bounds on combinatorial counters and written output. The operation-model analysis is given in Section “Time, storage, and output bounds”; the formal bounds do not assert a compiler-level running time.

Cancellation surgery for noncrossing matchings

This appendix proves the matching transformation used in Proposition 12. It works for arbitrary words on the involutive alphabet, including unreduced words. Throughout, the restriction of a matching to a block retains exactly those pairs whose two endpoints lie in that block.

Lemma 25. If UU and VV are words, every matching on UVUV gives a matching of the same cost on VUVU. Consequently D(UV)=D(VU)D(UV)=D(VU).

Proof. It suffices first to move the initial letter to the end. If that letter is unmatched in aUaU, retain the matching of UU and make the last position of UaUa unmatched. If it is matched, write the word as aXaYaXaY using its partner. The existing matching restricts to matchings of XX and YY. On the rotated word XaYaXaYa, retain both restrictions and pair the two displayed aa’s around YY. This is the concatenation of a matching on XX with a matching on aYaaYa, so it is noncrossing. The cost is unchanged in both cases. Repeating this operation ∣U∣|U| times takes UVUV to VUVU. It gives D(VU)≤D(UV)D(VU)\leq D(UV). Interchanging UU and VV gives the reverse inequality. ◻

Lemma 26. For every word VV and letter aa, a matching on aaVaaV can be changed into a matching on VV with no greater cost.

Proof. Call the two initial occurrences of aa the first and second positions. Apply (27) at these positions.

If the first position is unmatched, there are two cases. If the second is also unmatched, remove both; the cost decreases by two. If the second is paired, write V=XaYV=XaY where the displayed aa is its partner. The remaining matching consists of restrictions to XX and YY. On V=XaYV=XaY retain these restrictions and make the displayed aa unmatched. The cost remains 1+cost⁡(X)+cost⁡(Y)1+\operatorname{cost}(X)+\operatorname{cost}(Y).

If the first position is paired to the second, remove this pair and retain the matching on VV, with unchanged cost.

It remains to consider a first position paired farther to the right. Then the word is a (aX) aYa\,(aX)\,aY, and the matching splits into one on the interior aXaX and one on YY. If the initial position of aXaX is unmatched, keep the restrictions on XX and YY and make the intervening aa of V=XaYV=XaY unmatched. Again the cost is unchanged.

Finally, suppose that this initial position of aXaX is paired within aXaX. Write X=UaBX=UaB according to that partner. The whole word and its two indicated pairs have the form

a a U a B a Y,a\,a\,U\,a\,B\,a\,Y,

with the first aa paired to the last displayed aa, and the second aa paired to the third displayed aa. The matching restricts separately to UU, BB, and YY. After removing the two initial positions, the remaining word is UaBaYUaBaY. Retain the three restrictions and pair the two remaining displayed aa’s around BB. This is a concatenation of a matching on UU, a matching on aBaaBa, and a matching on YY, so it is noncrossing. Its cost, like the original cost, is the sum of the costs on UU, BB, and YY. These cases exhaust the possibilities. ◻

Completion of the proof of Proposition 12. Insert an adjacent matched pair to obtain D(UaaV)≤D(UV)D(UaaV)\leq D(UV). For the other inequality, rotation and Lemma 26 give

D(UV)=D(VU)≤D(aaVU)=D(UaaV).D(UV)=D(VU)\leq D(aaVU)=D(UaaV).

Both inequalities hold when either UU or VV is empty. ◻

References

Preprint · Lean (GitHub)

  1. F. Dahmani and V. Guirardel, Foliations for solving equations in groups: free, virtually free, and hyperbolic groups, J. Topol. 3 (2010), no. 2, 343–404. doi:10.1112/jtopol/jtq010.
  1. V. G. Bardakov, V. Shpilrain, and V. Tolstykh, On the palindromic and primitive widths of a free group, J. Algebra 285 (2005), no. 2, 574–585. doi:10.1016/j.jalgebra.2004.11.003.
  1. M. Brandenbursky, Ś. R. Gal, J. Kędra, and M. Marcinkowski, The cancellation norm and the geometry of bi-invariant word metrics, Glasgow Math. J. 58 (2016), no. 1, 153–176. doi:10.1017/S0017089515000129. Author version, including the March 2023 erratum: arXiv:1310.2921v3.
  1. M. J. Dyer, On minimal lengths of expressions of Coxeter group elements as products of reflections, Proc. Amer. Math. Soc. 129 (2001), no. 9, 2591–2595. doi:10.1090/S0002-9939-01-05876-2.
  1. A. E. Frid, Small palindromic lengths in free groups and word equations with antimorphisms, 2025. arXiv:2512.10024.
  1. E. I. Khukhro and V. D. Mazurov (eds.), Unsolved problems in group theory: The Kourovka Notebook, 21st ed., version of 1 September 2026, Problem 16.9. arXiv:1401.0300v46.
  1. A. Saarela, Palindromic length in free monoids and free groups, in Combinatorics on Words (WORDS 2017), Lecture Notes in Computer Science, vol. 10432, Springer, 2017, 203–213. doi:10.1007/978-3-319-66396-8_19.