[proofplan]
The proof is obtained by taking the $g$-trace of the tensor identity defining the gradient Ricci soliton. At an arbitrary point $p \in M$, we choose a $g_p$-[orthonormal basis](/page/Orthonormal%20Basis) of $T_pM$ and evaluate the trace term by term. The trace of the Ricci tensor is the scalar curvature, the trace of the Hessian is the Laplace-Beltrami operator applied to $f$, and the trace of $\lambda g$ is $n\lambda$.
[/proofplan]
custom_env
admin
[step:Take the $g$-trace of the soliton equation at an arbitrary point]Fix a point $p \in M$. Let $(e_1,\dots,e_n)$ be a $g_p$-orthonormal basis of the tangent space $T_pM$. For any symmetric $(0,2)$-tensor $A$ on $M$, define its $g$-trace at $p$ by
\begin{align*}
\operatorname{tr}_g A(p) := \sum_{i=1}^n A_p(e_i,e_i).
\end{align*}
This definition is independent of the chosen $g_p$-orthonormal basis. Applying this trace operation at $p$ to the tensor identity
\begin{align*}
\operatorname{Ric} + \operatorname{Hess}_{g} f = \lambda g
\end{align*}
and using linearity of the finite sum gives
\begin{align*}
\operatorname{tr}_g \operatorname{Ric}(p) + \operatorname{tr}_g(\operatorname{Hess}_{g} f)(p)
= \operatorname{tr}_g(\lambda g)(p).
\end{align*}[/step]
custom_env
admin
[guided]Fix a point $p \in M$. Since the desired identity is pointwise, it is enough to prove it at this arbitrary point. Choose a $g_p$-orthonormal basis $(e_1,\dots,e_n)$ of the tangent space $T_pM$, meaning $g_p(e_i,e_i)=1$ for every $i \in \{1,\dots,n\}$ and $g_p(e_i,e_j)=0$ whenever $i,j \in \{1,\dots,n\}$ with $i \neq j$.
For a symmetric $(0,2)$-tensor $A$ on $M$, define the $g$-trace at $p$ by
\begin{align*}
\operatorname{tr}_g A(p) := \sum_{i=1}^n A_p(e_i,e_i).
\end{align*}
The trace is independent of the chosen orthonormal basis because it is the ordinary trace of the linear endomorphism associated to $A_p$ by raising one index using the [inner product](/page/Inner%20Product) $g_p$.
Now apply this trace operation to the gradient Ricci soliton equation
\begin{align*}
\operatorname{Ric} + \operatorname{Hess}_{g} f = \lambda g.
\end{align*}
Since trace is a linear operation on tensors at the fixed point $p$, we get
\begin{align*}
\operatorname{tr}_g \operatorname{Ric}(p) + \operatorname{tr}_g(\operatorname{Hess}_{g} f)(p)
= \operatorname{tr}_g(\lambda g)(p).
\end{align*}
This is the entire mechanism of the proof: no derivative commutation or curvature identity is involved, only the trace of a tensor equation.[/guided]
custom_env
admin
[step:Identify the three traces with $R$, $\Delta f$, and $n\lambda$]By definition of scalar curvature,
\begin{align*}
R(p)=\operatorname{tr}_g \operatorname{Ric}(p).
\end{align*}
By definition of the Laplace-Beltrami operator on functions under the convention used here,
\begin{align*}
\Delta f(p)=\operatorname{tr}_g(\operatorname{Hess}_{g} f)(p).
\end{align*}
Finally,
\begin{align*}
\operatorname{tr}_g(\lambda g)(p)
= \sum_{i=1}^n \lambda g_p(e_i,e_i)
= \sum_{i=1}^n \lambda
= n\lambda.
\end{align*}
Substituting these three identities into the traced soliton equation gives
\begin{align*}
R(p)+\Delta f(p)=n\lambda.
\end{align*}
Because $p \in M$ was arbitrary, the identity holds pointwise on all of $M$.[/step]
custom_env
admin
[guided]We now translate each term in the traced equation into the standard scalar quantities appearing in the theorem statement. By definition, the scalar curvature $R: M \to \mathbb{R}$ is the $g$-trace of the Ricci tensor, so at the fixed point $p$,
\begin{align*}
R(p)=\operatorname{tr}_g \operatorname{Ric}(p).
\end{align*}
By the sign convention for the Laplace-Beltrami operator on functions used here, the map $\Delta f: M \to \mathbb{R}$ is the $g$-trace of the Hessian $\operatorname{Hess}_{g} f$, hence
\begin{align*}
\Delta f(p)=\operatorname{tr}_g(\operatorname{Hess}_{g} f)(p).
\end{align*}
It remains to compute the trace of the metric term. Since $(e_1,\dots,e_n)$ is $g_p$-orthonormal, each diagonal entry satisfies $g_p(e_i,e_i)=1$. Therefore
\begin{align*}
\operatorname{tr}_g(\lambda g)(p)
= \sum_{i=1}^n \lambda g_p(e_i,e_i)
= \sum_{i=1}^n \lambda
= n\lambda.
\end{align*}
Substituting these three identifications into
\begin{align*}
\operatorname{tr}_g \operatorname{Ric}(p) + \operatorname{tr}_g(\operatorname{Hess}_{g} f)(p)
= \operatorname{tr}_g(\lambda g)(p)
\end{align*}
gives
\begin{align*}
R(p)+\Delta f(p)=n\lambda.
\end{align*}
The point $p \in M$ was arbitrary, so the same identity holds at every point of $M$.[/guided]