TITLE: Insertion and deletion of cubed words $w^3$
QUESTION [6 upvotes]: Evan Chen's seminal text presents the following as (spicy) problem 11C:

Consider the set of finite binary words. Show that you can't get from $01$ to $10$ using only the operation "insert or delete any cubed word $www$."

Given a word $w = a_1 a_2 \cdots a_n$, we can define an invariant $$f(w) := a_1 - a_2 + a_4 - a_5 + a_7 - a_8 + \cdots$$ and it's not hard to show that if $v$ and $w$ are equivalent under the operation, then $f(v) \equiv f(w) \pmod{3}$. Thus, $1 = f(10) \not\equiv f(01) = 2 \pmod{3}$ tells us $10$ and $01$ are inequivalent.
But this problem appears in Evan's section on group actions. Is there a group-theoretic way to preempt the invariant defined above? (I thought of it by guessing a bunch of things)
Edit: Here is a proof that the above $f$ is invariant. Start with the binary word $v:= a_1 \cdots a_n$ and insert the cubed word $(b_1 \cdots b_m)^{3}$ between $a_k$ and $a_{k+1}$. Denote the new word by $w:= c_1 \cdots c_{n+3m}$. 
Let $\chi: \mathbb{Z}/3 \to \{-1,0,1\}$ be given by $\chi(1) = 1$, $\chi(2) = -1$, and $\chi(3) = 0$.
Then we have $$f(w) = \sum_{j=1}^{n+3m} \chi(j) c_j = \sum_{j=1}^{k} \chi(j) c_j + \sum_{j=k+1}^{k+3m} \chi(j) c_j + \sum_{j = k+3m+1}^{n+3m} \chi(j) c_j$$ $$ = \sum_{j=1}^{k} \chi(j) a_j + \sum_{j=1}^{m} (\chi(k+j) + \chi(k+j+m) + \chi(k+j+2m)) b_j  + \sum_{j=k+1}^{n} \chi(j) a_j$$ Since $\chi(x) + \chi(x+a) + \chi(x+2a) \equiv 0 \pmod{3}$ for any $x$, $a$, we see that $$f(w) \equiv \sum_{j=1}^{n} \chi(j) a_j = f(v) \pmod{3}$$ as desired.

REPLY [3 votes]: This is not a new answer.  It is a comment to Robert Bell's answer.  In the end, it is unnecessary to introduce the "verbal group" $G$ at all.  You only need a non-commutative group $H$ such that each non-identity element of $H$ has order $3$.   Let $M_2$ be the free monoid on two letters $a, b$.  Let $a', b'$ be two non-commuting elements of $H$.  There exists a unique monoid homomorphism from $M_2$ to $H$ sending $a \to a'$ and $b \to b'$.  Denote this homomorphism by $x \mapsto x'$.  By hypothesis on $H$, $(ab)' \ne (ba)'$.  However any cube $w^3$ in $M_2$ satisfies $(w^3)' = 1$.  Hence if $ab$ and $ba$ were equivalent in $M_2$ by insertion and deletion of cubed words, it would follow that $(ab)' = (ba)'$.  As this is false, $ab$ and $ba$ are not equivalent in $M_2$ by insertion and deletion of cubed words.
Edit:  I will add a more "grouplike" description of Sameer Kailasa's original solution.  There is also nothing very new or different here.  Sameer's solution involves a sort of Fourier transform with values in $\mathbb Z_3$.   Let $a : \mathbb Z \to \mathbb Z_3$ be any function with finite support; i.e. $a(j) = 0$ except for finitely many values of $j$.  Let $\chi: \mathbb Z \to \mathbb Z_3$ be a non-trivial character; thus $\chi(j) = j \,\chi(1)$ and $\chi(1) \ne 0$.  We can define the Fourier transform $$\mathcal F a(\chi) = \sum_j a(j) \chi(j).$$      If we are given a finite sequence with values in $\mathbb Z_3$, $a = (a_1, a_2, \dots, a_n)$,  pad it by declaring $a_j = 0$ for $j \le 0$ or $j >n$, and compute $\mathcal F a(\chi)$ by the same rule. In particular, $\mathcal F{(1, 0)}(\chi) = \chi(1)$ and $\mathcal F{(0, 1)} = \chi(2) = 2 \chi(1)$. (These are the Fourier transforms of "delta functions".)
Sameer's calculation shows that  $\mathcal F a$  is unchanged if a cubed word is inserted into $a$. For this the crucial property is that $\chi(k) + \chi(k + r) + \chi(k + 2r) = 0$ for any $k$ and $r$, and any character $\chi$.