# Find a matrix that simultaneously diagonalizes to matrices

struggling with a question from homework and would appreciate some assistance.

Let $$A, B \in M_2^{\mathbb{R}}$$ be defined as follows:

$$A = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}, B = \begin{pmatrix} -4 & 1 \\ 1 & 1 \end{pmatrix}$$

Find a regular $$P \in M_2^\mathbb{R}$$ such that $$P^tAP=I$$ and $$P^tBP$$ is diagonal.

I'm familiar with the theorem that states that a simultaneous diagonlization exists if one of the matrices is positive-definite (or negative-definite).

I've found an invertible P such that $$P^tAP=I$$: $$P=\begin{pmatrix}1\over\sqrt{2}&-1\over\sqrt{2}\\0&\sqrt{2}\end{pmatrix}$$

But $$P^tBP$$ is not diagonal.

Would appreciate any assistance / hints. Thanks!

• Are you aware of the concept of congruent matrices? – Git Gud Apr 1 '13 at 9:05
• I am, and also of the invariance of $\rho(A)$ across congruence, Sylvester's law of inertia and such. – iravid Apr 1 '13 at 9:19

Assuming you can find a matrix $S$ such that $S^TAS=I$ (such a matrix does exist because $A$ is positive definite - I think this is called Sylvester's theorem - or rather a consequence of it), consider the matrix $V=S^TBS$. You should be able to prove that $V$ is symmetric.
Since $V$ is symmetric, there exist an orthogonal matrix $Q$ and a diagonal matrix $D$ such that $Q^TVQ=D$.
Now let $P=SQ$.You should be able to prove this one works:
$P^TAP=Q^TS^TASQ=Q^TIQ=I \wedge P^TBP=Q^TS^TBSQ=Q^TVQ=D$
Note that this method works for any positive definite matrix $A$ and any symmetric matrix $B$.