[step:Separate the second-order part of the Ricci tensor]The Ricci tensor of $\hat{g}$ has coordinate expression
\begin{align*}
\operatorname{Ric}(\hat{g})_{ij}
=
\sum_{a=1}^n \partial_{x_a}\Gamma(\hat{g})^a_{ij}
-
\partial_{x_j}\Gamma(\hat{g})^a_{ia}
+
\sum_{a,b=1}^n
\Gamma(\hat{g})^a_{ij}\Gamma(\hat{g})^b_{ab}
-
\Gamma(\hat{g})^a_{ib}\Gamma(\hat{g})^b_{ja}.
\end{align*}
When the derivatives fall on the inverse coefficients $\hat{g}^{ab}$, the resulting terms contain only first derivatives of $\hat{g}$ because
\begin{align*}
\partial_{x_c}\hat{g}^{ab}
=
-\sum_{p,q=1}^n \hat{g}^{ap}\hat{g}^{bq}\partial_{x_c}\hat{g}_{pq}.
\end{align*}
Thus the only second derivatives of $\hat{g}$ arise by differentiating the first derivatives inside the Christoffel symbols. The genuine second-order part of $2\sum_a\partial_{x_a}\Gamma(\hat{g})^a_{ij}$ is
\begin{align*}
\sum_{a,b=1}^n \hat{g}^{ab}
\bigl(
\partial_{x_a}\partial_{x_i}\hat{g}_{jb}
+
\partial_{x_a}\partial_{x_j}\hat{g}_{ib}
-
\partial_{x_a}\partial_{x_b}\hat{g}_{ij}
\bigr),
\end{align*}
and the genuine second-order part of $2\partial_{x_j}\sum_a\Gamma(\hat{g})^a_{ia}$ is
\begin{align*}
\sum_{a,b=1}^n \hat{g}^{ab}\partial_{x_j}\partial_{x_i}\hat{g}_{ab}.
\end{align*}
Define the lower-order bookkeeping term $A_{ij}$ to be the sum of all terms produced when one of the outer derivatives falls on an inverse coefficient $\hat{g}^{ab}$ in the two traced-Christoffel derivatives below. By the inverse-derivative identity above, $A_{ij}$ is smooth in $\hat{g}^{-1}$ and $\partial\hat{g}$ and contains no second derivatives of $\hat{g}$. Expanding those two traced-Christoffel derivatives gives the following identity, where $A_{ij}$ is already defined:
\begin{align*}
\partial_{x_i}\left(\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,j}\right)+\partial_{x_j}\left(\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,i}\right) = \frac{1}{2}\sum_{a,b=1}^n \hat{g}^{ab}\bigl(\partial_{x_i}\partial_{x_a}\hat{g}_{bj}+\partial_{x_i}\partial_{x_b}\hat{g}_{aj}-\partial_{x_i}\partial_{x_j}\hat{g}_{ab}\bigr)+\frac{1}{2}\sum_{a,b=1}^n \hat{g}^{ab}\bigl(\partial_{x_j}\partial_{x_a}\hat{g}_{bi}+\partial_{x_j}\partial_{x_b}\hat{g}_{ai}-\partial_{x_j}\partial_{x_i}\hat{g}_{ab}\bigr)+A_{ij}.
\end{align*}
Since $\hat{g}^{ab}=\hat{g}^{ba}$ and coordinate partial derivatives commute on the smooth coefficient functions $\hat{g}_{ij}$, the first two terms in each parenthesis combine to
\begin{align*}
\sum_{a,b=1}^n \hat{g}^{ab}
\bigl(
\partial_{x_a}\partial_{x_i}\hat{g}_{jb}
+
\partial_{x_a}\partial_{x_j}\hat{g}_{ib}
\bigr),
\end{align*}
while the two final traced terms combine to
\begin{align*}
-\sum_{a,b=1}^n \hat{g}^{ab}\partial_{x_i}\partial_{x_j}\hat{g}_{ab}.
\end{align*}
Therefore the difference of the displayed second-order Ricci terms equals
\begin{align*}
-\sum_{a,b=1}^n \hat{g}^{ab}\partial_{x_a}\partial_{x_b}\hat{g}_{ij}
+
\partial_{x_i}
\left(
\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,j}
\right)
+
\partial_{x_j}
\left(
\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,i}
\right)
-
A_{ij}.
\end{align*}
Define $R_{ij}$ to be the sum of $A_{ij}$ and all quadratic Christoffel terms and inverse-coefficient derivative terms produced in this computation after multiplying by $-1$. By the preceding identities, $R_{ij}$ is a smooth expression in $\hat{g}^{-1}$ and $\partial \hat{g}$. Multiplying by $-1$ for $-2\operatorname{Ric}(\hat{g})_{ij}$ and collecting those lower-order terms gives
\begin{align*}
-2\operatorname{Ric}(\hat{g})_{ij}
=
\sum_{a,b=1}^n \hat{g}^{ab}\partial_{x_a}\partial_{x_b}\hat{g}_{ij}
-
\partial_{x_i}
\left(
\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,j}
\right)
-
\partial_{x_j}
\left(
\sum_{a,b=1}^n \hat{g}^{ab}\Gamma(\hat{g})_{ab,i}
\right)
+
R_{ij},
\end{align*}[/step]