Groups & Basic Properties

Addition of integers, multiplication of nonzero real numbers, multiplication of invertible matrices, symmetric difference of sets. These look like four unrelated operations, but they follow the same three rules. A group is any set with an operation that follows those rules. Once we prove something about groups in general, it's true for all four at once, and for every other group we'll ever meet. First we need to be precise about what an "operation" is.

Binary Operations

Suppose $G$ is a set. An operation takes two elements of $G$ and produces a third, and that's exactly what a function does if we feed it ordered pairs.

A binary operation is just a function whose domain is the Cartesian product $G \times G$ and whose codomain is $G$. Everything the Functions page said applies: every pair gets an output, exactly one, and it has to land in the codomain.

A binary operation on $G$ is a function $*\colon G \times G \to G$.

Notation: $*(a, b) = a * b$.

The two requirements hiding in that arrow are the whole story. Every pair $(a, b)$ needs an output, and the output has to be back in $G$. Here are operations that pass both tests.

Which of the following are binary operations?


Binary operations:

Each failure below breaks one of the two requirements: either some pair has no output at all, or the output escapes the set.

Every list of non-examples eventually features $1 \div 0$. I just want to try it once. For science.

Why aren't these binary operations?


Notice that $\div$ appears on both lists. Whether something is a binary operation depends on the set, not just the symbol.

"Is $\div$ a binary operation?" isn't a question you can answer until someone tells you the set. It's the same lesson as the Functions page, where "is $x^2$ surjective?" depended on the domain and codomain. Always check both requirements: an output for every pair (watch for $0$), and an output that stays inside the set (watch for $\frac{1}{2}$, numbers that should have been vectors, and matrices with determinant zero).

Sort a pile of candidates yourself. Each card is an operation together with its set, and the bins name the way it breaks, if it does.

Closed or Not?

To show an operation fails, one escaping pair is enough. Go hunting for one.

Escape Hunt

Associativity and Commutativity

Here are some properties that a binary operation $*\colon G \times G \to G$ could have. The first is about regrouping.

Associativity: $\forall a, b, c \in G$, $(a * b) * c = a * (b * c)$.

The second is about swapping.

Commutativity: $\forall a, b \in G$, $a * b = b * a$.

The familiar operations have both.

Is $+$ on $\mathbb{Z}, \mathbb{Q}, \mathbb{R}$, or $\mathbb{C}$ associative? Commutative? What about $\cdot$?


Their "opposite" operations have neither, and one counterexample is enough to show it.

Show that $-$ on $\mathbb{Z}, \mathbb{Q}, \mathbb{R}$, or $\mathbb{C}$, and $\div$ on $\mathbb{Q} \setminus \{0\}, \mathbb{R} \setminus \{0\}$, or $\mathbb{C} \setminus \{0\}$ are neither associative nor commutative.


$-$: not associative, not commutative.

$\div$: not associative, not commutative.

That's the asymmetry to remember.

To show an operation is not associative, one specific triple $a, b, c$ is enough. To show it is associative, you need an argument for every $a, b, c$. Checking examples proves nothing. The same goes for commutativity, with pairs.

Commutativity has a picture. Write out a table of $a * b$, and swapping $a$ and $b$ is flipping the table across its diagonal.

Operation Table

Associativity has no picture that simple, because it's about three elements at once. Here's the next best thing: both groupings, computed side by side.

$(a * b) * c$ vs. $a * (b * c)$

The cross product is the strangest operation on the list. Write $e_1, e_2, e_3$ for the standard basis of $\mathbb{R}^3$.

The cross product isn't associative, isn't commutative, and only exists in 3 and 7 dimensions. Physicists use it every day anyway.

Show that the cross product $u \times v$ on $\mathbb{R}^3$ is not associative and not commutative.


Matrices split the two properties apart. Adding matrices is entry by entry, so it inherits everything from $+$ on $\mathbb{R}$. Multiplying them keeps associativity but loses commutativity.

Is $+$ on $M_{m \times n}(\mathbb{R})$ associative and commutative? What about $\cdot$ on $M_{n \times n}(\mathbb{R})$?


For $n \ge 2$, take

$$A = \begin{pmatrix} 1 & 0 & \cdots & 0 & 2 \\ 0 & 1 & \cdots & 0 & 0 \\ \vdots & & \ddots & & \vdots \\ 0 & 0 & \cdots & 0 & 1 \end{pmatrix}$$

and

$$B = \begin{pmatrix} 2 & 0 & \cdots & 0 & 0 \\ 0 & 1 & \cdots & 0 & 0 \\ \vdots & & \ddots & & \vdots \\ 0 & 0 & \cdots & 0 & 1 \end{pmatrix}.$$

Then $AB \neq BA$: the $(1, n)$ entry of $AB$ is $2$, while for $BA$ it is $4$.

The last two examples finish the list.

$A \triangle B = (A \setminus B) \cup (B \setminus A)$, the elements in exactly one of the two sets, from the Sets page. Draw the Venn diagram for $(A \triangle B) \triangle C$: it shades the regions in an odd number of the three sets, and that description doesn't care which set is which. That's why it equals $A \triangle (B \triangle C)$.

Is $\cdot$ on $GL_2(\mathbb{R})$ associative? Commutative? What about $\triangle$ on $\mathcal{P}(S)$?


Groups

Associativity on its own isn't enough to do algebra. To solve $a * x = b$ the way you solved $3x = 12$, you need a "do nothing" element and a way to undo $a$. That's what a group adds.

A group is a pair $(G, *)$, where $G$ is a set and $*$ is a binary operation on $G$, satisfying:

  1. $*$ is associative.
  2. $\exists e \in G$ such that $\forall g \in G$, $e * g = g * e = g$ (existence of an identity element).
  3. $\forall g \in G$, $\exists h \in G$ such that $g * h = h * g = e$ (existence of inverses; $h$ is the inverse of $g$).

Read the quantifiers in order, as on the Logic & Equivalence page. Axiom 2 is $\exists e\, \forall g$: one identity that works for every $g$. Axiom 3 is $\forall g\, \exists h$: each $g$ gets its own inverse.

Two details in that definition are easy to skip. Both equations have to hold: $e * g$ and $g * e$, $g * h$ and $h * g$. And the $e$ in axiom 3 is the identity from axiom 2, so you have to find the identity before you can talk about inverses. Commutativity is not on the list. Groups that have it get their own name.

If, in addition, $*$ is commutative, then we say that $(G, *)$ is an Abelian group.

And the ones that don't:

A group $(G, *)$ whose operation is not commutative is non-Abelian.

Now let's run the examples from before through the definition. Addition on the integers is the model group.

Show that $(\mathbb{Z}, +)$ is an Abelian group.


The same argument works for the bigger number systems: $(\mathbb{Q}, +)$, $(\mathbb{R}, +)$, $(\mathbb{C}, +)$ are Abelian groups (identity $= 0$, inverse of $x$ is $-x$). Multiplication is where things go wrong.

Is $(\mathbb{Z}, \cdot)$ a group?


No.

Moving to $\mathbb{Q}$ fixes $2$, but not $0$.

Are $(\mathbb{Q}, \cdot)$, $(\mathbb{R}, \cdot)$, $(\mathbb{C}, \cdot)$ groups? What about $(\mathbb{Q} \setminus \{0\}, \cdot)$, $(\mathbb{R} \setminus \{0\}, \cdot)$, $(\mathbb{C} \setminus \{0\}, \cdot)$?


Throwing out the one element without an inverse fixed everything. Matrices follow the same pattern, with "determinant $0$" playing the role of $0$.

Are $(M_{m \times n}(\mathbb{R}), +)$ and $(M_{n \times n}(\mathbb{R}), \cdot)$ groups?


Keep only the matrices with nonzero determinant, and you get the first non-Abelian group in the course.

Show that $(GL_2(\mathbb{R}), \cdot)$ is a non-Abelian group.


The last example is the strangest-looking one, because its "numbers" are sets.

Show that $(\mathcal{P}(S), \triangle)$ is an Abelian group.


Every element is its own inverse.

Swap $\triangle$ for $\cup$ and almost everything survives. Watch the checklist run, and see which line breaks.

$(\mathcal{P}(S), \cup)$ Takes the Test

Now run the checklist yourself. Predict each property before you inspect, since the point is to know the answers before you see them.

Is It a Group?

Pick a structure, tap each stamp to predict ✓ or ✗, then press INSPECT.

Two exercises to try the definition on your own.

$-$ is a binary operation on $\mathbb{Z}$. Which of the group axioms does $(\mathbb{Z}, -)$ fail?

Show answer

Associativity fails: $(1 - 1) - 1 = -1 \neq 1 = 1 - (1 - 1)$.

There is no identity. An identity $e$ would need $g - e = g$ for all $g$, which forces $e = 0$. But it would also need $e - g = g$, and $0 - 1 = -1 \neq 1$. So $0$ is only a "right identity," and nothing else is even that.

Inverses don't make sense without an identity, so axiom 3 fails too.

The second one is a group in disguise.

Define $a * b = a + b - 1$ on $\mathbb{Z}$. Show that $(\mathbb{Z}, *)$ is a group. What is the identity, and what is the inverse of $a$? Is it Abelian?

Show answer
  • Binary operation: $a + b - 1 \in \mathbb{Z}$ for all $a, b \in \mathbb{Z}$.
  • Associative: $(a * b) * c = (a + b - 1) + c - 1$ $= a + b + c - 2$, and $a * (b * c) = a + (b + c - 1) - 1$ $= a + b + c - 2$.
  • Identity $e = 1$: $1 * a = 1 + a - 1 = a$ and $a * 1 = a$.
  • Inverses: the inverse of $a$ is $2 - a$, since $a * (2 - a) = a + 2 - a - 1 = 1$, and $(2 - a) * a = 1$ the same way.

It's Abelian, since $a + b - 1 = b + a - 1$. (The identity isn't $0$! It's whatever element does nothing, and here that's $1$.)

That Exercise's identity wasn't $0$. Shift the rule around and hunt down the identity each time.

Find the Identity

Notational Conventions

Writing $(G, *)$ every time gets old fast. When the operation is clear from context, we drop it and write just $G$ for the group $(G, *)$. We also want words for the size of a group.

If $|G| < \infty$, $G$ is a finite group.

And that size gets a name of its own.

If $G$ is a finite group, $|G|$ is the order of $G$.

Here's how big a few of our groups are.

Which of $(\mathcal{P}(\{1, 2, 3\}), \triangle)$, $(\{-1, 1\}, \cdot)$, $(\mathbb{Z}, +)$, and $(GL_2(\mathbb{R}), \cdot)$ are finite? What are their orders?


Groups come in two "accents." Abelian groups like $\mathbb{Z}$ are usually written additively, and everything else multiplicatively. The rules are identical; only the symbols change.

Additive notation writes the inverse as $-g$, writes $g + (-h)$ as $g - h$, and still insists there's no new operation called subtraction.

$$\begin{array}{|l|c|c|} \hline & \textbf{Additive notation} & \textbf{Multiplicative notation} \\ \hline \text{Operation} & g + h & gh \text{ or } g \cdot h \\ \hline \text{Identity} & 0 & e \\ \hline \text{Inverse of } g & -g & g^{-1} \\ \hline \text{Power / Multiple} & ng = \underbrace{g + \dots + g}_{n \text{ times}} \ (n \in \mathbb{N}) & g^n = \underbrace{g \cdot \dots \cdot g}_{n \text{ times}} \ (n \in \mathbb{N}) \\ \hline \text{Zero exponent} & 0g = 0 & g^0 = e \\ \hline \text{Negative exponent} & -ng = \underbrace{(-g) + \dots + (-g)}_{n \text{ times}} & g^{-n} = \underbrace{(g^{-1}) \cdot \dots \cdot (g^{-1})}_{n \text{ times}} \\ \hline \end{array}$$

So "$g^3$" in $GL_2(\mathbb{R})$ means $g \cdot g \cdot g$, and the same idea in $\mathbb{Z}$ is written $3g = g + g + g$. From here on, we'll write groups multiplicatively unless there's a reason not to.

Many books write the identity of a multiplicative group as 1 (or 1 with a subscript G) instead of e. On this site the identity of a general group is always $e$; the symbol $1$ shows up only when the identity really is the number $1$ or a matrix like $I_2$.

Negative and zero powers follow the table exactly. Here they are in three groups.

Compute some powers: (a) $A^2$, $A^3$, $A^0$, $A^{-2}$ in $(\mathcal{P}(S), \triangle)$ with $A = \{1, 2\}$; (b) $M^2$, $M^{-1}$, $M^{-2}$ in $GL_2(\mathbb{R})$ with $M = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}$; (c) $3g$, $0g$, $-2g$ in $(\mathbb{Z}, +)$ with $g = 4$.


See the two accents side by side: the same exponent $n$ is a stack of hops in one and a stack of stretches in the other.

Two Accents

The matrix $M$ from part (b) is a shear. Its powers, negative ones included, are just more shear.

Powers of a Shear

For small finite groups, the whole operation fits in a table. On Groups of Order 1–3, the properties below pin those tables down completely.

Basic Properties Satisfied by All Groups

Let $G$ be a group written multiplicatively. Everything in this section follows from the three axioms alone, so it holds in every group: $\mathbb{Z}$, $GL_2(\mathbb{R})$, $\mathcal{P}(S)$, and all the ones we haven't met yet. The definition says there is an identity. In fact there's only one.

Uniqueness of Identity: If $e, \tilde{e} \in G$ are identity elements, then $e = \tilde{e}$.

Show proof

Proof. $e = e\tilde{e}$ (since $\tilde{e}$ is an identity) $= \tilde{e}$ (since $e$ is an identity). $\blacksquare$

That's why we can say the identity. The proof is one product computed two ways; watch it happen.

Two Identities?

Inverses work the same way.

Uniqueness of Inverses: Suppose $g \in G$. If $h, \tilde{h} \in G$ are inverses of $g$, then $h = \tilde{h}$.

Show proof

Proof.

$$h = eh = (\tilde{h}g)h = \tilde{h}(gh) = \tilde{h}e = \tilde{h}. \quad \blacksquare$$

Here are both uniqueness properties in a group whose identity isn't $0$.

Define $a * b = a + b + 3$ on $\mathbb{Z}$, a group. Find its identity and the inverse of $4$, and check that neither has a rival.


In a group made of sets, finding an inverse is a guessing game with exactly one winner. Play it.

Inverse Hunt

Now the notation $g^{-1}$ makes sense: it names the one and only inverse of $g$. With inverses in hand, we can cancel.

Cancellation Laws: If $g, h, a \in G$ satisfy $ag = ah$, or if they satisfy $ga = ha$, then $g = h$.

Show proof

Proof.

$$\begin{align*} ag = ah &\implies a^{-1}(ag) = a^{-1}(ah) \implies (a^{-1}a)g = (a^{-1}a)h \implies eg = eh \implies g = h. \\ ga = ha &\implies (ga)a^{-1} = (ha)a^{-1} \implies g(aa^{-1}) = h(aa^{-1}) \implies ge = he \implies g = h. \quad \blacksquare \end{align*}$$

Cancel on the same side you multiplied. In a non-Abelian group, $ag = ha$ does not give $g = h$.

Cancellation only works on matching sides: $ag = ah$ (left) or $ga = ha$ (right). From $ag = ha$ you can't conclude anything in general, because to "divide by $a$" you'd have to multiply by $a^{-1}$ on the left of one side and the right of the other. In an Abelian group the sides don't matter, which is exactly why this never came up with numbers.

Here's that warning with actual matrices.

In $GL_2(\mathbb{R})$, let $a = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$, $g = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}$, and $h = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}$. Compare $ag$ with $ha$.


$ag = \begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatrix}$ and $ha = \begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatrix}$, so $ag = ha$. But $g \neq h$. Cancelling $a$ from opposite sides would have "proved" something false.

The matrix $a$ swaps the two coordinates, $g$ shears sideways, and $h$ shears upward. Watch both paths land on the same shape.

$ag = ha$, but $g \neq h$

Practice the legal moves. Every step is "multiply both sides by the same thing, on the same side."

Cancel Correctly

Cancellation already does real work. Try it.

Prove that if $g \in G$ and $g^2 = g$, then $g = e$.

Show proof

Proof. $g^2 = g$ means $gg = ge$. By the cancellation law (cancel $g$ on the left), $g = e$. $\blacksquare$

Associativity is only about three elements, but we constantly write longer products like $g_1 g_2 g_3 g_4$ with no brackets at all. That's allowed because of the next property.

Generalized Associativity: $\forall n \in \mathbb{N}$ and $\forall g_1, \dots, g_n \in G$, the value of $g_1 g_2 \dots g_n$ does not depend on the choice of parenthesization.

(For example, for $n = 4$: $(g_1 g_2)(g_3 g_4)$ $= g_1(g_2(g_3 g_4))$ $= (g_1(g_2 g_3))g_4 = \dots$)

With 10 factors there are 4,862 ways to parenthesize. Property 4 says they all agree, so I'm not checking.

Counting the bracketings is a puzzle of its own. A bracketing of $n$ factors splits at its last multiplication into a bracketing of the first $k$ factors times a bracketing of the last $n - k$. So the counts build on each other: for four factors, $1 \cdot 2 + 1 \cdot 1 + 2 \cdot 1 = 5$, and the counts for $n = 1, 2, 3, 4, 5, 6$ factors are $1, 1, 2, 5, 14, 42$.

Build all five bracketings of four factors below. With an associative operation they all agree. With $-$ or $\div$, they don't, which is why Property 4 needs associativity. (Proving Property 4 is the Spicy Bonus at the end of the page.)

Five Bracketings

Tap an operation symbol to combine its two neighbors. Each finished bracketing is saved with its value.

Each bracketing is a tree, and associativity is a single move on trees: it slides one branch across. Every tree can slide all the way to the right-leaning one, which is the idea behind the proof of Property 4.

Bracketing Trees

An inverse has to work on both sides: $gh = e$ and $hg = e$. It turns out that in a group, checking one side is enough.

One-Sided Inverse Implication: If $g, h \in G$ and $gh = e$, then $h = g^{-1}$.

Show proof

Proof. We only need to check that $hg = e$.

$$hg = e(hg) = (g^{-1}g)(hg) = (g^{-1}(gh))g = (g^{-1}e)g = g^{-1}g = e.$$

Since $gh = hg = e$, $h$ is an inverse of $g$, and by Property 2 it is the only one: $h = g^{-1}$. $\blacksquare$

The proof used $g^{-1}$, so it needs $g$ to have an inverse to begin with. Without that, one side really isn't enough.

Functions $\mathbb{N} \to \mathbb{N}$ under composition have an associative operation and an identity, the identity function. Let $s(n) = n + 1$ and $t(n) = \max(n - 1, 1)$. Compare $t \circ s$ with $s \circ t$.


$(t \circ s)(n) = \max(n, 1) = n$ for every $n \in \mathbb{N}$, so $t \circ s$ is the identity. But $(s \circ t)(1) = s(1) = 2 \neq 1$, so $s \circ t$ is not. Here $t$ undoes $s$ on one side only. That doesn't contradict Property 5: functions $\mathbb{N} \to \mathbb{N}$ don't form a group, because $s$ is injective but not surjective, so it has no inverse at all.

Compare the two worlds directly.

One Side Is Enough?

Property 5 is the shortcut used in the next two proofs: to show something is the inverse of $g$, multiply it by $g$ on one side and get $e$.

Double Inverse: $\forall g \in G$, $(g^{-1})^{-1} = g$.

Show proof

Proof. By definition of $g^{-1}$, $g(g^{-1}) = (g^{-1})g = e$, which implies $(g^{-1})^{-1} = g$. $\blacksquare$

Undoing an undo gets you back where you started. The last property is about undoing two things at once.

Socks and Shoes Property: $\forall g, h \in G$, $(gh)^{-1} = h^{-1}g^{-1}$.

Show proof

Proof. Observe that

$$(gh)(h^{-1}g^{-1}) = g(hh^{-1})g^{-1} = geg^{-1} = gg^{-1} = e.$$

By Property 5, $(gh)^{-1} = h^{-1}g^{-1}$. $\blacksquare$

The name says it all. You put on socks, then shoes. To undo that, you take off the shoes first, then the socks: the order reverses.

Undoing things in the wrong order is how you end up trying to pull your socks off through your shoes.

If $G$ is non-Abelian, it is not true in general that $(gh)^{-1} = g^{-1}h^{-1}$. That's the most common slip with inverses. It's correct for numbers only because numbers commute.

Here's a concrete case where the wrong order gives the wrong answer.

In $G = GL_2(\mathbb{R})$, take $A = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}$ and $B = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}$. Compare $(AB)^{-1}$ with $B^{-1}A^{-1}$ and $A^{-1}B^{-1}$.


Then $AB = \begin{pmatrix} 2 & 2 \\ 0 & 1 \end{pmatrix}$, so $(AB)^{-1} = \begin{pmatrix} \frac{1}{2} & -1 \\ 0 & 1 \end{pmatrix}$.

Here $A^{-1} = \begin{pmatrix} 1 & -2 \\ 0 & 1 \end{pmatrix}$ and $B^{-1} = \begin{pmatrix} \frac{1}{2} & 0 \\ 0 & 1 \end{pmatrix}$.

Then $B^{-1}A^{-1} = \begin{pmatrix} \frac{1}{2} & -1 \\ 0 & 1 \end{pmatrix} = (AB)^{-1}$, but $A^{-1}B^{-1} = \begin{pmatrix} \frac{1}{2} & -2 \\ 0 & 1 \end{pmatrix} \neq (AB)^{-1}$.

Those same two matrices are moves you can watch. $B$ stretches the plane sideways and $A$ shears it. Undo them in both orders and see which one gets home.

Socks & Shoes

The shape has been hit by $B$, then $A$. Drag the undo cards into the two slots (or tap a card), then press APPLY.

With more than two moves, the rule is the same: the last thing you did is the first thing you undo.

Undo Stack

On paper, the same rule turns into a two-step recipe for any product: reverse the order, then invert each letter.

Invert the Word

Put Property 7 to work.

Suppose every element of $G$ satisfies $g^2 = e$. Prove that $G$ is Abelian.

Show proof

Proof. If $g^2 = gg = e$, then by Property 5, $g^{-1} = g$. So every element is its own inverse. Let $a, b \in G$. Then $ab$ is also its own inverse, so by Property 7,

$$ab = (ab)^{-1} = b^{-1}a^{-1} = ba.$$

Therefore $G$ is Abelian. $\blacksquare$

($(\mathcal{P}(S), \triangle)$ is an example: $A \triangle A = \emptyset$ for every $A$.)

Endless Practice

Every question below makes a new version each time you press the button, in the same order as the lesson. Every wrong choice is a real mistake, and choosing one tells you which.

Loading practice engine...


Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Loading practice engine...


Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Multiple Choice Free Response

Loading practice engine...


Loading practice engine...


Loading practice engine...

Spicy Bonus

Property 4 was stated without proof. Here's your chance to fix that.

This is a job for strong induction: a bracketing of $n$ factors splits into two smaller bracketings, and you'll need the claim for all smaller sizes, not just $n - 1$.

🌶️ SPICY BONUS 🌶️

Prove Property 4 (Generalized Associativity). Hint: show that every parenthesization of $g_1 g_2 \cdots g_n$ equals the "right-nested" product $P(g_1, \dots, g_n) = g_1(g_2(\cdots(g_{n-1}g_n)\cdots))$.

Show proof

Proof. Define $P(g_1) = g_1$ and $P(g_1, \dots, g_n) = g_1 \, P(g_2, \dots, g_n)$ for $n \ge 2$. We prove, by strong induction on $n$, that every parenthesization of $g_1 \cdots g_n$ equals $P(g_1, \dots, g_n)$.

Base cases. For $n = 1$ and $n = 2$ there is only one parenthesization, and it is $P$.

Inductive step. Let $n \ge 3$, and suppose the claim holds for every number of factors less than $n$. Take any parenthesization of $g_1 \cdots g_n$. Its last multiplication splits it as $XY$, where $X$ is a parenthesization of $g_1 \cdots g_k$ and $Y$ is a parenthesization of $g_{k+1} \cdots g_n$, for some $1 \le k \le n - 1$. By the inductive hypothesis, $X = P(g_1, \dots, g_k)$ and $Y = P(g_{k+1}, \dots, g_n)$.

  • If $k = 1$: $XY = g_1 \, P(g_2, \dots, g_n) = P(g_1, \dots, g_n)$.
  • If $k \ge 2$: $X = g_1 \, P(g_2, \dots, g_k)$, so by associativity,

    $$XY = \big(g_1 \, P(g_2, \dots, g_k)\big) Y = g_1 \big(P(g_2, \dots, g_k) \, Y\big).$$

    The product $P(g_2, \dots, g_k) \, Y$ is a parenthesization of $g_2 \cdots g_n$, which has $n - 1$ factors. By the inductive hypothesis it equals $P(g_2, \dots, g_n)$. So $XY = g_1 \, P(g_2, \dots, g_n) = P(g_1, \dots, g_n)$.

Either way, the parenthesization equals $P(g_1, \dots, g_n)$. So all parenthesizations have the same value. $\blacksquare$