# Question about inverse in a two-step estimator as a joint GMM-estimators approach

I'm reading Newey & McFadden - Large sample estimation and hypothesis testing (in the Handbook of Econometrics, Volume 4, 1994, page 2178).

My model which I'm interested in has some former estimation done before the estimation of the primary model will take place. Hence the primary model (2nd-step) includes some estimated regressors from the former step (the 1st-step).

In order to account for the first-step variance I followed the approach from Newey & McFadden here the joint GMM-conditions are defined as $\widetilde{g}\left(z,\theta,\gamma\right) = \left[g\left(z,\theta,\gamma\right),m\left(z,\gamma\right)\right]$ where $g\left(z,\theta,\gamma\right)$ are the 2nd-step conditions and $m\left(z,\gamma\right)$ are the 1st-step ones.

The usual asymptotic GMM-variance of the GMM-estimator $\widehat{\theta}$ will look like

$Var\left(\widehat{\theta}\right)$ = $\left(G^TWG\right)^{-1}\mathbb{E}\left(g(z,\theta)g(z,\theta)^T\right)\left(G^TWG\right)^{-1}$

where $g(z,\theta)$ are some moment conditions, $G = \frac{\partial\mathbb{E}\left(g(z,\theta_0)\right)}{\partial \theta^T}$ and $W$ is some weight matrix.

In order to calculate the GMM-variance for the two-step approach I need to derive $G$, $W$ and the derivative of $\mathbb{E}$.

My Question: I struggle to understand why this is true.

Let $G_\theta = \frac{\partial\mathbb{E}\left(\widetilde{g}(z,\theta_0, \gamma_0)\right)}{\partial \theta^T}$, $G_\gamma = \frac{\partial\mathbb{E}\left(\widetilde{g}(z,\theta_0, \gamma_0)\right)}{\partial \gamma^T}$, $M = \frac{\partial\mathbb{E}\left(m(z, \gamma_0)\right)}{\partial \gamma^T}$

Then $\widetilde{G} = \frac{\partial\mathbb{E}\left(\widetilde{g}(z,\theta_0, \gamma_0)\right)}{\partial \left(\theta^T, \gamma^T\right)^T} = \begin{Bmatrix} G_\theta & G_\gamma\\ 0 & M\end{Bmatrix}$

This is easy to see but why is the inverse of $G$ this

$\widetilde{G}^{-1} = \begin{Bmatrix} G_\theta^{-1} & -G_\theta^{-1}G_\gamma M^{-1}\\ 0 & M^{-1}\end{Bmatrix}$

I know that the derivative of a 2x2-Jacobian-matrix is if $J = \begin{Bmatrix} x_u & x_v\\ y_u & y_v \end{Bmatrix}$ where $x_u,...$ are the partial derivatives then $J^{-1} = \frac{1}{det\left(J\right)}\begin{Bmatrix} y_v & -x_v\\ -y_u & x_u \end{Bmatrix}$

But then $\widetilde{G}^{-1} = M^{-1}G_\theta^{-1}\begin{Bmatrix} M & -G_\gamma\\ 0 & G_\theta \end{Bmatrix} = \begin{Bmatrix} M^{-1}G_\theta^{-1}M & -M^{-1}G_\theta^{-1}G_\gamma\\ 0 & M^{-1} \end{Bmatrix}$

But this is not the same. What have I done wrong?

First of all, the formula for the inverse of $J$ has nothing to do with Jacobians, it is just the general inverse of a $2 \times 2$ matrix.
Second, using the scalar expressions in the matrix context is extremely dangerous, as the matrix multiplication is not commutative, unlike the scalar multiplication (i.e., generally $AB \neq BA$). If you are not aware of this, you have very serious gaps in your math preparedness to tackle econometrics.
The inverse of a block matrix $$M = \left(\begin{array}{cc}A & B \\ C & D\end{array}\right)$$ is $$M^{-1} = \left(\begin{array}{cc} A^{-1} + A^{-1} B P^{-1} C A^{-1} & - A^{-1} B P^{-1} \\ - P^{-1} C A^{-1} & P^{-1} \end{array}\right), \quad P = D - CA^{-1} B$$ or $$M^{-1} = \left(\begin{array}{cc} Q^{-1} & - Q^{-1} B D^{-1} \\ - D^{-1} C Q^{-1} & D^{-1} + D^{-1} C Q^{-1} B D^{-1} \end{array}\right), \quad Q = A - BD^{-1} C$$ depending on which is easier to tackle. See Section 1.11 of Magnus & Neudecker (1999) and/or Exercise 5.13 of Abadir & Magnus (2005). Once again, an econometrician must have at least one of these books within an arm's length.