In Einstein Gravity by Zee chapter I.6, he discussed the local flatness of the metric. There are two steps in what he did. First, he showed that the metric at a point can always be written as a flat metric. Second, he showed that in general, a metric can be expanded around the flat metric and that the first order expansion vanishes.
The first part, consider a point $P$ in coordinates $x^\mu$ with metric $g_{\mu\nu}(x)$, if we go to a new coordinate $x'^\mu$, the new metric $g'_{\mu\nu}(x')$ transforms as,
\begin{equation} g'_{\lambda\sigma}(x') = g_{\mu\nu}(x) \frac{\partial x^\mu}{\partial x'^\lambda} \frac{\partial x^\nu}{\partial x'^\sigma} \end{equation}
We can always shift our coordinates so that $P$ is labeled by $x = 0$. Expand the metric around $P$ out to second order,
\begin{equation} g_{\mu\nu}(x) = g_{\mu\nu}(0) + A_{\mu\nu,\rho} x^\rho + B_{\mu\nu,\rho \gamma} x^\rho x^\gamma + \ldots \end{equation}
where the commas in the subscripts carried by $A$ and $B$ are purely for notational clarity to separate two sets of indices. Now, we change coordinates $$x^\mu = K^\mu_{\; \nu} x'^\nu + L^\mu_{\; \nu \lambda} x'^\nu x'^\lambda + \ldots. $$ At $P$, the new metric up to linear in $x'^\nu$ is then,
\begin{equation} g'_{\lambda\sigma}(0) = g_{\mu\nu}(0) K^\mu_{\; \lambda} K^\nu_{\; \sigma} \quad \rightarrow \quad g' = K^T g K \end{equation}
Since $g_{\mu\nu}(0)$ is symmetric and real there always exists a $K$ that diagonalizes it. After $g_{\mu\nu}(0)$ becomes diagonal we could scale each coordinate by an appropriate factor, $x^\mu \rightarrow x^\mu/\sqrt{g_{\mu\mu}(0)}$ (no sum over repeated indices), so that the diagonal elements become 1. So, $g_{\mu\nu}(0) = \delta_{\mu \nu}$. Since $g_{\mu\nu}(0)$ had $\frac{1}{2} D(D + 1)$ arbitrary elements to begin with, we had to use this many elements in $K^\mu_{\; \nu}$ to adjust these to $\delta_{\mu \nu}$. Hence, $K^\mu_{\; \nu}$ has $D^2 − \frac{1}{2}D(D + 1) = \frac{1}{2} D(D − 1)$ elements left over.
I don't understand the last statement "we had to use this many elements in $K^\mu_{\; \nu}$ to adjust these to $\delta_{\mu \nu}$", what elements in $K^\mu_{\; \nu}$?
As I understood, suppose $g_{\mu\nu}(0) \rightarrow (g_{xx},g_{yy},g_{xy},g_{yx})$ is a non-diagonal metric. There should be a $K^\mu_{\; \lambda}$ say, $(K^x_{\; \theta},K^y_{\; \theta}, \ldots)$ for some coordinate transformation $x^\mu (x') = (x(\theta,\phi),y(\theta,\phi))$, which makes the metric diagonal. Suppose the diagonal metric has the form $$ds^2 = g_{\theta \theta} d\theta^2 + g_{\phi \phi} d\phi^2.$$ Then, we can rescale $\theta \rightarrow \theta/\sqrt{g_{\theta \theta}}$, $\phi \rightarrow \phi/\sqrt{g_{\phi \phi}}$, which gives $ds^2 = d\theta^2 + d\phi^2$. This is just the flat metric which we can rewrite as $ds^2 = dX^2 + dY^2$.
The second part, the metric for some arbitrary point can be expanded such that $g_{\mu\nu} (x) = \delta_{\mu\nu} + A_{\mu\nu,\rho} x^\rho + \ldots$. The linear term $A_{\mu\nu,\rho} x^\rho$ can be removed by a suitable choice of $L^\mu_{\nu \lambda}$ in $$x^\mu = x'^\mu + L^\mu_{\nu \lambda} x'^\nu x'^\lambda + \ldots.$$ Evidently, $A_{\mu\nu,\rho}$ and $L^\mu_{\nu \lambda}$ have been modified already by what we have done thus far, but we do not want to introduce more letters.
What happened to $K^\mu_{\; \nu}$ in $$x^\mu = K^\mu_{\; \nu} x'^\nu + L^\mu_{\; \nu \lambda} x'^\nu x'^\lambda + \ldots~?$$ It seems like $K^\mu_{\; \nu}$ was set to $\delta^\mu_{\; \nu}$.
Suppose I take it to be correct, then expanding the metric transformation to linear in $x'$,
\begin{align} g'_{\lambda\sigma}(x') & = (\delta_{\mu\nu} + A_{\mu\nu,\rho} x'^\rho) (\delta^\mu_\lambda + L^\mu_{\; \alpha \lambda} x'^\alpha) (\delta^\nu_\sigma + L^\nu_{\; \beta \sigma} x'^\beta)\\ & = \delta_{\lambda\sigma} + \delta_{\mu \sigma} L^\mu_{\; \alpha \lambda} x'^\alpha + \delta_{\lambda \nu} L^\nu_{\; \beta \sigma} x'^\beta + A_{\lambda\sigma,\rho} x'^\rho \end{align}
I think what he meant is that $\delta_{\mu \sigma} L^\mu_{\; \alpha \lambda} x'^\alpha + \delta_{\lambda \nu} L^\nu_{\; \beta \sigma} x'^\beta + A_{\lambda\sigma,\rho} x'^\rho = 0$ after some relabelling of indices.
Any guidance is greatly appreciated.