# The word problem

Most people have heard of word problems, but not as many have heard of the word problem. If you’re imagining that the word problem is some superlatively awful word problem, I can assure you it’s not. It’s both simpler and weirder than that.

The word problem is essentially about whether you can always apply algebraic rules in an automated way. The reason it is called the word problem is that you start by a description of your algebraic system in terms of symbols (“letters”) and concatenations of symbols (“words”) subject to certain rules, also called relations.

## The word problem for groups

For example, you can describe a group by saying it contains a and b, and it satisfies the relations

a² = b²

and

a−1ba = b−1.

A couple things are implicit here. We’ve said this a group, and since every element in a group has an inverse, we’ve implied that a−1 and b−1 are in the group as well. Also from the definition of a group comes the assumption that multiplication is associative, that there’s an identity element, and that inverses work like they’re supposed to.

In the example above, you could derive everything about the group from the information given. In particular, someone could give you two words—strings made up of a, b, a−1, and b−1—and you could determine whether they are equal by applying the rules. But in general, this is not possible for groups.

## Undecidable

The bad news is that in general this isn’t possible. In computer science terminology, the word problem is undecidable. There is no algorithm that can tell whether two words are equal given a list of relations, at least not in general. There are special cases where the word problem is solvable, but a general algorithm is not possible.

## The word problem for semigroups

I presented the word problem above in the context of groups, but you could look at the word problem in more general contexts, such as semigroups. A semigroup is closed under some associative binary operation, and that’s it. There need not be any inverses or even an identity element.

Here’s a concrete example of a semigroup whose word problem has been proven to be undecidable. As before we have two symbols, a and b. And because we are in a semigroup, not a group, there are no inverses. Our semigroup consists of all finite sequences make out of a‘s and b‘s, subject to these five relations.

aba2b2 = b2a2ba

a2bab2a = b2a3ba

aba3b2 = ab2aba2

b3a2b2a2ba = b3a2b2a4

a4b2a2ba = b2a4

Source: Term Rewriting and All That

## Experience

When I first saw groups presented this as symbols and relations, I got my hopes up that a large swath of group theory could be automated. A few minutes later my naive hopes were dashed. So in my mind I thought “Well, then this is hopeless.”

But that is not true. Sometimes the word problem is solvable. It’s like many other impossibility theorems. There’s no fifth degree analog of the quadratic equation in general, but there are fifth degree polynomials whose roots can be found in closed form. There’s no program that can tell whether any arbitrary program will halt, but that doesn’t mean you can’t tell whether some programs halt.

It didn’t occur to me at the time that it would be worthwhile to explore the boundaries, learning which word problems can or cannot be solved. It also didn’t occur to me that I would run into things like the word problem in practical applications, such as simplifying symbolic expressions and optimizing their evaluation. Undecidable problems lurk everywhere, but you can often step around them.

## 3 thoughts on “The word problem”

1. Michael Watts

In the example above, you could derive everything about the group from the information given. In particular, someone could give you two words—strings made up of a, b, a⁻¹, and b⁻¹—and you could determine whether they are equal by applying the rules.

This is a funny example. I take it you mean that the specification includes the information that (1) both a and b are in the group; (2) a and b are not equal; and (3) no other elements are in the group. (Only item (1) was actually stated.)

But that’s already enough to completely characterize the group. The two equations you provide are redundant; they can be derived directly from the fact that the group is of order two.

2. There are more elements in the group. The group is the free group on two elements, modulo the relations given. That is, any sequence of a’s, b’s, a inverses, and b inverses is an element. But some of these sequences are the same element. For example, ba is an element, and ab^-1 is an element, but from the second relation we can see they are the same element.

It turns out the group has eight unique elements.

3. Jonathan

I’d be curious to hear more about “I would run into things like the word problem in practical applications,”. Or, as I first thought about it, “Wait, he got *paid* to work on an instance of the word problem?!”.