Assume that
$$\textbf{y} = X\boldsymbol\beta + \boldsymbol\varepsilon $$
, where $\boldsymbol\varepsilon$ is an $n \times 1$ random vector and that X is an $n \times k$ matrix of regressors; $m$ of these regressors are endogenous. Let $Z$ be an $n \times (k-m+l)$ matrix where the endogenous regressors are replaced by exogenous instruments. If $\boldsymbol\beta$ is estimated by 2SLS
$$ \hat{\boldsymbol\beta}_{2SLS} = \left(X^\prime P_Z X \right)^{-1} X^\prime P_Z \textbf{y}$$ $$ P_Z= Z\left(Z^\prime Z \right)^{-1} Z^\prime $$
, it is (supposedly) possible to show that if $E[\boldsymbol{z}_i^\prime\varepsilon_i]=\textbf{0} $, then
$$ n\frac{\hat{\boldsymbol\varepsilon}^\prime P_Z \hat{\boldsymbol\varepsilon}}{\hat{\boldsymbol\varepsilon}^\prime \hat{\boldsymbol\varepsilon}} \sim \chi^2 \left(l-m \right)$$
See, e.g., https://en.wikipedia.org/wiki/Sargan%E2%80%93Hansen_test . I have not been able to find an explanation of how it is possible to show this. That is, I have not found one that I am able to understand; see, e.g., http://www.jstor.org/stable/1907619 for the original article. My guess is that we would invoke the Central Limit Theorem
$$ \frac{1}{\sqrt n} Z^\prime \hat{\boldsymbol\varepsilon} \sim N(0,\Omega) $$
and assume that $\Omega$ is invertible, such that
$$ \frac{1}{\sqrt n} \Omega^{-\frac{1}{2}} Z^\prime \hat{\boldsymbol\varepsilon} \sim N(0,I) $$
Then
$$ \left(\frac{1}{\sqrt n} \Omega^{-\frac{1}{2}} Z^\prime \hat{\boldsymbol\varepsilon} \right)^\prime \left(\frac{1}{\sqrt n} \Omega^{-\frac{1}{2}} Z^\prime \hat{\boldsymbol\varepsilon} \right) \sim \chi^2 (l-m) $$
, since it is a sum of independent squares. Assuming homoskedasticity, we can replace $ \Omega $ by
$$ \hat{\Omega} = \frac{\sigma^2_{\hat{\varepsilon}}}{n} Z^\prime Z$$
, which yields the Sargan test statistic.
My question is if this proof is correct? Also, how can we show that the degrees of freedom are $l-m$? The $l$-part makes sense, since all except $l$ elements of $Z^\prime \hat{\boldsymbol\varepsilon} $ are 0 by construction. Any help would be much appreciated.