[proofplan]
The constant case $p \equiv a_0$ is handled by direct computation. For non-constant $p$, the engine is the factorisation of $\mu - p(z)$ over $\mathbb{C}$ into linear factors $C \prod_k (\lambda_k - z)$, which translates into an algebra factorisation $\mu 1 - p(x) = C \prod_k (\lambda_k 1 - x)$ in $A$. The factors all commute (they are polynomials in $x$), so a product-of-commuting-elements lemma reduces invertibility of the product to invertibility of every factor. The conclusion is that $\mu \in \sigma_A(p(x))$ iff some root $\lambda_k$ of $\mu - p$ lies in $\sigma_A(x)$, iff $\mu \in p(\sigma_A(x))$.
[/proofplan]
[step:Dispose of the constant-polynomial case]
Suppose $\deg p \leq 0$, so $p(z) = a_0$ for all $z \in \mathbb{C}$. Then $p(x) = a_0 \cdot 1 \in A$ and
\begin{align*}
\sigma_A(p(x)) = \sigma_A(a_0 \cdot 1) = \{\mu \in \mathbb{C} : \mu 1 - a_0 1 \notin G(A)\} = \{\mu \in \mathbb{C} : (\mu - a_0) 1 \notin G(A)\} = \{a_0\},
\end{align*}
where the last equality follows because $(\mu - a_0) 1$ is invertible (with inverse $(\mu - a_0)^{-1} 1$) iff $\mu - a_0 \neq 0$.
On the other hand, by [Spectrum is Non-Empty and Compact](/theorems/2669), $\sigma_A(x) \neq \varnothing$, so
\begin{align*}
p(\sigma_A(x)) = \{a_0 : \lambda \in \sigma_A(x)\} = \{a_0\}.
\end{align*}
Hence $\sigma_A(p(x)) = \{a_0\} = p(\sigma_A(x))$.
For the remainder of the proof, assume $\deg p = n \geq 1$ with leading coefficient $a_n \neq 0$.
[/step]
[step:Factor $\mu - p(z)$ and lift the factorisation to $A$]
Fix $\mu \in \mathbb{C}$. The polynomial $z \mapsto \mu - p(z) = -a_n z^n + \dots + (\mu - a_0) \in \mathbb{C}[z]$ has degree $n \geq 1$. By the **fundamental theorem of algebra**, it factors over $\mathbb{C}$ as
\begin{align*}
\mu - p(z) = C \prod_{k=1}^n (\lambda_k - z),
\end{align*}
where $C = -a_n \neq 0$ and $\lambda_1, \dots, \lambda_n \in \mathbb{C}$ are the roots of $\mu - p(z)$ (with multiplicity).
The polynomial functional calculus for elements of a unital algebra is a unital algebra homomorphism: for any $q(z) \in \mathbb{C}[z]$, the assignment $q \mapsto q(x)$ preserves sums, products, and the unit. Applying this homomorphism to the polynomial identity $\mu - p(z) = C \prod_{k=1}^n (\lambda_k - z)$ in $\mathbb{C}[z]$ — equivalently, evaluating both sides at $z := x$ — yields the identity in $A$:
\begin{align*}
\mu 1 - p(x) = C \prod_{k=1}^n (\lambda_k 1 - x),
\end{align*}
where the product on the right is computed in $A$. The order of multiplication does not matter because all factors $\lambda_k 1 - x$ are polynomials in $x$ and any two polynomials in $x$ commute (this follows from $x \cdot x = x \cdot x$ and the distributive law).
[/step]
[step:Establish the commuting-product lemma]
[claim:Product-of-commuting-elements lemma]
Let $A$ be a unital algebra and $u_1, \dots, u_n \in A$ pairwise commuting elements. Then
\begin{align*}
\prod_{k=1}^n u_k \in G(A) \iff u_k \in G(A) \text{ for every } k = 1, \dots, n.
\end{align*}
[/claim]
[proof]
*$(\Leftarrow)$* If each $u_k \in G(A)$ with inverse $u_k^{-1}$, then since the $u_k$ commute, the inverses also commute (left-multiplying $u_j u_k = u_k u_j$ by $u_j^{-1} u_k^{-1}$ on both sides gives $u_k^{-1} u_j^{-1} = u_j^{-1} u_k^{-1}$). The element $w := u_n^{-1} u_{n-1}^{-1} \cdots u_1^{-1}$ satisfies
\begin{align*}
w \cdot \prod_{k=1}^n u_k = u_n^{-1} \cdots u_1^{-1} u_1 \cdots u_n = 1,
\end{align*}
and similarly $\prod_{k=1}^n u_k \cdot w = 1$. Hence $\prod_{k=1}^n u_k \in G(A)$ with inverse $w$.
*$(\Rightarrow)$* Suppose $u := \prod_{k=1}^n u_k \in G(A)$ with two-sided inverse $u^{-1} \in A$. Fix any index $j \in \{1, \dots, n\}$ and let $v_j := \prod_{k \neq j} u_k$ (the product of the other factors, in any fixed order — they commute, so the order is immaterial). Then $u = u_j v_j = v_j u_j$ since $u_j$ commutes with all $u_k$ for $k \neq j$, and consequently with $v_j$.
We claim $u_j$ has both a left and a right inverse, namely $v_j u^{-1}$ and $u^{-1} v_j$. Indeed,
\begin{align*}
u_j (v_j u^{-1}) = (u_j v_j) u^{-1} = u u^{-1} = 1, \\
(u^{-1} v_j) u_j = u^{-1} (v_j u_j) = u^{-1} u = 1.
\end{align*}
A two-sided inverse exists when both a left and a right inverse exist (and they coincide):
\begin{align*}
v_j u^{-1} = (u^{-1} v_j) u_j (v_j u^{-1}) = u^{-1} v_j \cdot 1 = u^{-1} v_j,
\end{align*}
where we inserted the left-inverse identity then the right-inverse identity. Hence $u_j \in G(A)$ with $u_j^{-1} = v_j u^{-1} = u^{-1} v_j$. Since $j$ was arbitrary, all $u_k$ are invertible.
[/proof]
[/step]
[step:Apply the lemma to characterise non-invertibility of the factored product]
The factors $\lambda_k 1 - x$ for $k = 1, \dots, n$ are pairwise commuting elements of $A$: they are all polynomials in $x$ (each is degree $\leq 1$ in $x$), and polynomials in a fixed element commute. The non-zero scalar $C \cdot 1$ commutes with everything and is invertible (with inverse $C^{-1} \cdot 1$).
By the lemma in Step 3 applied to the family $\{C \cdot 1, \lambda_1 1 - x, \dots, \lambda_n 1 - x\}$,
\begin{align*}
C \prod_{k=1}^n (\lambda_k 1 - x) \in G(A) \iff \lambda_k 1 - x \in G(A) \text{ for every } k = 1, \dots, n.
\end{align*}
Combining with Step 2,
\begin{align*}
\mu 1 - p(x) \in G(A) \iff \lambda_k 1 - x \in G(A) \text{ for every } k = 1, \dots, n.
\end{align*}
Negating both sides,
\begin{align*}
\mu \in \sigma_A(p(x)) \iff \mu 1 - p(x) \notin G(A) \iff \exists k : \lambda_k 1 - x \notin G(A) \iff \exists k : \lambda_k \in \sigma_A(x).
\end{align*}
[/step]
[step:Identify the equivalence with $\mu \in p(\sigma_A(x))$]
By construction in Step 2, $\lambda_1, \dots, \lambda_n$ are precisely the roots of $\mu - p(z)$, i.e.\ $p(\lambda_k) = \mu$ for every $k$. Conversely, if $\lambda \in \mathbb{C}$ satisfies $p(\lambda) = \mu$, then $\lambda$ is a root of $\mu - p$, hence $\lambda = \lambda_k$ for some $k$. Therefore
\begin{align*}
\{\lambda \in \mathbb{C} : p(\lambda) = \mu\} = \{\lambda_1, \dots, \lambda_n\}.
\end{align*}
Combining with Step 4:
\begin{align*}
\mu \in \sigma_A(p(x)) &\iff \exists k \in \{1, \dots, n\} : \lambda_k \in \sigma_A(x) \\
&\iff \exists \lambda \in \sigma_A(x) : p(\lambda) = \mu \\
&\iff \mu \in p(\sigma_A(x)).
\end{align*}
Since $\mu \in \mathbb{C}$ was arbitrary, $\sigma_A(p(x)) = p(\sigma_A(x))$.
[guided]
Let us trace the logic once more, since the chain of equivalences is the substance of the theorem.
*The starting point is the factorisation.* For a non-constant polynomial $p$ and a fixed scalar $\mu$, the polynomial $\mu - p(z) \in \mathbb{C}[z]$ has degree $n \geq 1$ and factors over $\mathbb{C}$ into linear factors $C \prod_k (\lambda_k - z)$ by the fundamental theorem of algebra, with $C = -a_n$ the negative of the leading coefficient of $p$.
*Transferring to $A$.* The map $\mathbb{C}[z] \to A$, $q \mapsto q(x)$, is a unital algebra homomorphism (sums go to sums, products to products, $1$ to $1$). Applying it to the polynomial identity yields the algebra identity $\mu 1 - p(x) = C \prod_k (\lambda_k 1 - x)$.
*Why the factors commute.* Each $\lambda_k 1 - x$ is a polynomial in $x$. Two polynomials in the single element $x$ commute, since multiplication and addition of polynomials in one variable are commutative operations. Hence the product makes sense without specifying an order.
*The lemma.* For commuting elements, the product is invertible iff every factor is. This is the algebraic content. The forward direction uses that the product of inverses (in reverse order) is an inverse of the product. The reverse direction is more subtle: from a global inverse $u^{-1}$, we extract a candidate inverse for each factor by separating off the other factors as $v_j$, and verify both one-sided inverses then coincide.
*The chain of equivalences.* Now
\begin{align*}
\mu \in \sigma_A(p(x)) &\iff \mu 1 - p(x) \notin G(A) & &\text{(definition of spectrum)} \\
&\iff C \prod_k (\lambda_k 1 - x) \notin G(A) & &\text{(Step 2 factorisation)} \\
&\iff \exists k : \lambda_k 1 - x \notin G(A) & &\text{(commuting-product lemma)} \\
&\iff \exists k : \lambda_k \in \sigma_A(x) & &\text{(definition of spectrum)} \\
&\iff \mu \in p(\sigma_A(x)) & &\text{(roots of $\mu - p$)}.
\end{align*}
The fundamental theorem of algebra is the irreplaceable tool: without root factorisation we cannot reduce a polynomial in $x$ to linear factors in $x$, and without that reduction the spectrum cannot be tracked through $p$.
[/guided]
[/step]