The first time I met the definition of the trace of the Ricci curvature $Ric$ on a Riemannian manifold (M^n,g), it was formulated thanks to local orthonormal coordinates: if $(x_{1}, \cdots, x_{n})$ are local orthonormal coordinates (i.e. $g\left(\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}\right)=\delta_{ij}$), then the trace of $Ric$ is $$Ric\left(\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^i}\right)$$ using the Eistein summation convention. Then I met an other definition. If $g=g_{ij}dx^i dx^j$ in local coordinates (note necessarly orthonormal), $$Tr_{g}(Ric)=g^{ij}Ric_{ij},$$ where $g^{ij}$ is the $(i,j)$ coefficient of the inverse of the matrix $(g_{ij})_{1\le i,j \le n}$. I denote this matrix $G$ in the sequel. According to this definition, the trace of $Ric$ can be understood as $$Tr\left((G^{-1})^{t}M_{Ric}\right),$$ where I write $M_{Ric}$ for the matrix $(Ric_{ij})_{1\le i,j \le n}$, and $(G^{-1})^t$ for the transpose of the matrix $G^{-1}$.
My question is: why $G^{-1}$ and why not $G$? In orthonormal coordinates these matrices are the same, equal to the identity, so it has no incidence on the first definition I learnt, but still, I don't understand. Is there any deep raison for this choice?