Question about proof of Morse Lemma I am working on a problem for my differential geometry course. We are proving the following special case of the Morse lemma:
Let $U \subseteq \mathbb{R}^n$ be open and containing the origin $\mathbf{0} \in \mathbb{R}^n$ (denote coordinates on $U$ by $x = (x_1, \dots, x_n)$). Suppose we have smooth $f : U \to \mathbb{R}$, $f(\mathbf{0}) = 0$, with $\mathbf{0}$ a nondegenerate critical point of $f$ of index $1 \le \lambda \le n$. That is, we know that:

*

*$\frac{\partial f}{\partial x_i}(\mathbf{0}) = 0$, all $i$.


*The Hessian matrix $\left[ \frac{\partial^2f}{\partial x_i \partial x_j} \left(\mathbf{0}\right)\right]$ is nonsingular.


*$\left[ \frac{\partial^2f}{\partial x_i \partial x_j} \left(\mathbf{0}\right)\right]$ has  $\lambda$ negative eigenvalues and $n - \lambda$ positive eigenvalues.

By transforming coordinates in a neighborhood of $\mathbf{0}$ to $y = (y_1, \dots ,y_n)$, prove that we can write:
$$f(y) = - \sum_1^\lambda (y_i)^2 + \sum_{\lambda + 1}^n (y_i)^2$$

Here is what I have so far. Because $f(\mathbf{0}) = 0$ and $\frac{\partial f}{\partial x_i}(\mathbf{0}) = 0$, all $i$, I know from a previous result in class that I am able to write
$$f(x) = \frac{1}{2} (x_1, \dots , x_n) \left[ \frac{\partial^2f}{\partial x_i \partial x_j} \left(\mathbf{0}\right)\right] (x_1, \dots, x_n)^T$$
in a sufficiently small spherical neighborhood $B$ of $\mathbf{0}$ ($B \subseteq U$). Then I can take the Hessian $\left[ \frac{\partial^2f}{\partial x_i \partial x_j} \left(\mathbf{0}\right)\right]$ and rewrite it in it's eigendecomposition
$$\left[ \frac{\partial^2f}{\partial x_i \partial x_j} \left(\mathbf{0}\right)\right] = Q^T \Lambda Q.$$
Here, $\Lambda$ is a diagonal matrix with the first $\lambda$ diagonal entries being the negative eigenvalues of the Hessian, and the last $n - \lambda$ diagonal values being the positive eigenvalues.
So it seems like I am getting close to finishing the proof, except $Q(x_1, \dots, x_n)^T$ is not quite the coordinate transformation I need. Roughly speaking, I need another transformation to ensure the diagonal elements of $\Lambda$ are $-1, -1, \dots ,1 ,1.$ But I'm not quite sure how to do this.
Hints or solutions are greatly appreciated.

Here's an example:
$$ \begin{pmatrix} -4 & 0 \\ 0 & 9 \end{pmatrix} =
\begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix}
\begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix}
\begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix} $$
