Regular Expression Equivalence: Which Pairs Generate the Same Language?

Regular Expression Equivalence: Which Pairs Generate the Same Language?

Verified Sources
Sep 11, 2026

When two regular expressions r1r_1 and r2r_2 are equivalent, they generate the same language: L(r1)=L(r2)\mathcal{L}(r_1)=\mathcal{L}(r_2).
We will decide equivalence for each pair by reasoning from the formal meaning of Kleene star: AA^* is the set of all concatenations of zero or more strings from AA, hence it always includes ε\varepsilon.

We consider the choices:

(i) xx^* and xxx^*x
(ii) 1(01)1(01)^* and (10)1(10)^*1
(iii) x(xx)x(xx)^* and (xx)x(xx)^*x
(iv) All of the above

Footnotes

  1. Regular expression — Wikipedia. https://en.wikipedia.org/wiki/Regular_expression - Discusses meaning of equivalence via same denoted language and methods to decide equivalence by automata.

  2. 2 Regular Languages (Kleene star definition, 0˘3b5\u03b5 inclusion) — UIUC CS 374 notes PDF. https://courses.grainger.illinois.edu/cs374al1/fa2025/notes/models/02-regular.pdf - Defines Kleene star formally and notes 0˘3b5\u03b5 is included via zero concatenations.

Regular Expression Equivalence via Automata (intuition)

Key definitions and tools

  • keyword Two regular expressions are equivalent if they generate the same language.
  • keyword L(r)\mathcal{L}(r) is the set of all strings matched/generated by regular expression rr.
  • keyword For language LL, LL^* is all concatenations of zero or more strings from LL.

We’ll repeatedly use the star expansion property:

  • εA\varepsilon \in A^*
  • any nonempty string in AA^* is a concatenation of one or more elements of AA.

Footnotes

  1. 2 Regular Languages (Kleene star definition, 0˘3b5\u03b5 inclusion) — UIUC CS 374 notes PDF. https://courses.grainger.illinois.edu/cs374al1/fa2025/notes/models/02-regular.pdf - Defines Kleene star formally and notes 0˘3b5\u03b5 is included via zero concatenations.

Decide equivalence for each pair (i)–(iii)

  1. 1
    Step 1

    Translate each regular expression into the form “zero or more repetitions of a block,” then list structural constraints (e.g., must end with x, must alternate patterns, etc.).

  2. 2
    Step 2

    To prove non-equivalence, find a string in one language but not the other. To prove equivalence, show every valid string in one can be decomposed into the other’s pattern.

  3. 3
    Step 3

    If every listed pair is equivalent, the correct answer is (iv); otherwise it is one of (i)–(iii) or none.

Pair (i): xx^* and xxx^*x

What language does each side describe?

  • xx^* is {ε,x,xx,xxx,}\{\varepsilon, x, xx, xxx, \dots\}, because star allows zero repetitions.
  • xxx^*x means: take any string from xx^*, then append an extra xx.
    So xx={x,xx,xxx,}x^*x = \{x, xx, xxx, \dots\} and does not include ε\varepsilon.

Immediate counterexample

  • εx\varepsilon \in x^* but εxx\varepsilon \notin x^*x (because xxx^*x always has the final appended xx).

Therefore, xx^* and xxx^*x are not equivalent.

Conclusion for (i): NOT equivalent.

(Claim justified because * includes ε\varepsilon.)

Footnotes

  1. 2 Regular Languages (Kleene star definition, 0˘3b5\u03b5 inclusion) — UIUC CS 374 notes PDF. https://courses.grainger.illinois.edu/cs374al1/fa2025/notes/models/02-regular.pdf - Defines Kleene star formally and notes 0˘3b5\u03b5 is included via zero concatenations. 2

Pair (ii): 1(01)1(01)^* and (10)1(10)^*1

Let L1=L(1(01))L_1 = \mathcal{L}(1(01)^*) and L2=L((10)1)L_2 = \mathcal{L}((10)^*1).

Analyze $1(01)^*`

A string in 1(01)1(01)^* looks like:

  • start with 1
  • followed by kk repetitions of the block 01, for k0k\ge 0 (since star allows k=0k=0). So for k=0k=0: string is 1
    for k=1k=1: 101
    for k=2k=2: 10101
    So generally: 1(01)={1(01)kk0}.1(01)^* = \{\, 1(01)^k \mid k\ge 0 \,\}.

Analyze $(10)^*1`

A string in (10)1(10)^*1 looks like:

  • take kk repetitions of 10, for $k\ge 0`
  • then end with 1. So for k=0k=0: string is 1
    for k=1k=1: 101
    for k=2k=2: 10101
    So generally: (10)1={(10)k1k0}. (10)^*1 = \{\, (10)^k1 \mid k\ge 0 \,\}.

Structural alignment

Notice that: (10)k1=1(01)kfor all k0.(10)^k1 = 1(01)^k \quad \text{for all } k\ge 0. (You can verify by expanding both sides for k=0,1,2k=0,1,2; they match exactly.)

Thus L1=L2L_1=L_2 and the two regular expressions are equivalent.

Conclusion for (ii): Equivalent.

Pair (iii): x(xx)x(xx)^* and (xx)x(xx)^*x

Let L3=L(x(xx))L_3 = \mathcal{L}(x(xx)^*) and L4=L((xx)x)L_4=\mathcal{L}((xx)^*x).

Expand x(xx)x(xx)^*

Strings look like:

  • start with a single xx
  • then append kk repetitions of xx (for k0duetostar).Sofork\ge 0` due to star). So for k=0:xfor: `x` for k=1: xxx for $k=2: xxxxx
    So: x(xx)={x(xx)kk0}.x(xx)^* = \{\, x(xx)^k \mid k\ge 0\,\}.

Expand (xx)x(xx)^*x

Strings look like:

  • append kk repetitions of xx
  • then finish with an xx.
    So: (xx)x={(xx)kxk0}. (xx)^*x = \{\, (xx)^k x \mid k\ge 0\,\}.

Same lengths, same form

But concatenation is associative, so: x(xx)k=x(xx)(xx)(xx)k times=(xx)(xx)(xx)k timesx=(xx)kx.x(xx)^k = x\underbrace{(xx)(xx)\cdots(xx)}_{k\text{ times}} = \underbrace{(xx)(xx)\cdots(xx)}_{k\text{ times}}x = (xx)^k x. Therefore every string in one set equals a string in the other set (same kk).

Conclusion for (iii): Equivalent.

(Uses the definition of Kleene star allowing k=0k=0 and repetition structure.)

Footnotes

  1. 2 Regular Languages (Kleene star definition, 0˘3b5\u03b5 inclusion) — UIUC CS 374 notes PDF. https://courses.grainger.illinois.edu/cs374al1/fa2025/notes/models/02-regular.pdf - Defines Kleene star formally and notes 0˘3b5\u03b5 is included via zero concatenations.

Final decision: Which option is correct?

  • (i) is not equivalent.
  • (ii) is equivalent.
  • (iii) is equivalent.

So not all of the above are equivalent; therefore (iv) is false.

Answer: Only (ii) and (iii) are equivalent.

Equivalence results for (i)–(iii)

Whether the two regular expressions generate the same language.

Pro Tip: use $\varepsilon$ as a quick discriminator

If one regular expression’s star can generate ε\varepsilon (because star includes zero repetitions), but the other forces at least one symbol via concatenation, the languages can’t be equal. This immediately settles many equivalence questions.

Warning: do not treat regular expressions syntactically

Even if two expressions look similar (e.g., moving a symbol from the right to the left), the language can change. Equivalence is semantic: compare the generated set of strings, not the text form.

Footnotes

  1. Regular expression — Wikipedia. https://en.wikipedia.org/wiki/Regular_expression - Discusses meaning of equivalence via same denoted language and methods to decide equivalence by automata.

Common equivalence-check strategies

Knowledge Check

Question 1 of 4
Q1Single choice

Which of the following is true about (i) xx^* and xxx^*x?