<s>[INST] Finding $P$ such that $P^TAP$ is a diagonal matrix 
Let $$A = \left(\begin{array}{cc} 2&3 \\ 3&4  \end{array}\right) \in
M_2(\mathbb{C})$$
Find $P$ such that $P^TAP = D$ where $D$ is a diagonal matrix.

So here's the solution:
$$A = \left(\begin{array}{cc|cc} 2&3&1&0\\ 3&4&0&1    \end{array}\right) \sim \left(\begin{array}{cc|cc} 2&0&1&-3/2\\ 0&-1/2&0&1    \end{array}\right)$$
Therefore, $$P = \left(\begin{array}{cc} 1&-3/2\\ 0&1    \end{array}\right) \\ P^TAP = \left(\begin{array}{cc} 2&0\\ 0&-1/2    \end{array}\right) $$
What was done here exactly? I'd be glad elaborate about the process.
Thanks.
 [/INST] Generally, in the process of diagonalization, it is easiest to approach via calculating the eigenvalues and corresponding eigenvectors to form an orthonormal eigenbasis.
Such an orthogonal matrix is guaranteed to exist by the Spectral Theorem since our matrix, $A$, is a real symmetric matrix.
step 1: calculate eigenvalues
Find the eigenvalues by finding the characteristic polynomial: $\det(A-\lambda I) = (2-\lambda)(4-\lambda) - 3\cdot 3 = 8-6\lambda + \lambda^2 - 9 = \lambda^2 - 6\lambda - 1$
Finding the roots of the characteristic polynomial will find our eigenvalues.  Solving via the quadratic formula gives us $\frac{6\pm\sqrt{36+4}}{2}=3\pm \sqrt{10}$
step 2: find the eigenvectors
Now, we try to find the eigenvectors.
Eigenvector for $\lambda_1=3+\sqrt{10}$ would be a vector in the kernel of $A-\lambda_1 I$.
$rref\left(\begin{bmatrix} 2-3-\sqrt{10}&3\\3&4-3-\sqrt{10}\end{bmatrix}\right) = \begin{bmatrix}1&\frac{1-\sqrt{10}}{3}\\0&0\end{bmatrix}$, so the eigenvector $v_1$ is $\begin{bmatrix}\frac{-1+\sqrt{10}}{3}\\1\end{bmatrix}$.
Similarly, the eigenvector for $\lambda_2=3-\sqrt{10}$ would be a vector in the kernel of $A-\lambda_2 I$.
$rref\left(\begin{bmatrix} 2-3+\sqrt{10}&3\\3&4-3+\sqrt{10}\end{bmatrix}\right) = \begin{bmatrix}1&\frac{1+\sqrt{10}}{3}\\0&0\end{bmatrix}$, so the eigenvector $v_2$ is $\begin{bmatrix}\frac{-1-\sqrt{10}}{3}\\1\end{bmatrix}$
step 3: form an orthonormal basis for each eigenspace
A convenient thing about this situation is, thanks to the spectral theorem and the fact that our $A$ is real symmetric, vectors in different eigenspaces are already guaranteed to be orthogonal.  Indeed $\langle v_1, v_2\rangle = (\frac{-1+\sqrt{10}}{3})(\frac{-1-\sqrt{10}}{3})+1\cdot 1 = 0$
If we had a repeated eigenvalue, then we would need to apply the gram-schmidt process to the basis vectors of its corresponding eigenspace.  In our case, each eigenvalue is of multiplicity one, so we only need to normalize the vectors.
$u_1 = \frac{v_1}{\|v_1\|} = \begin{bmatrix} ((1+\sqrt{10})/(3 \sqrt{1+1/9 (1+\sqrt{10})^2)}\\ 1/\sqrt{1+1/9 (1+\sqrt{10})^2)}\end{bmatrix}$
These numbers were not very pretty to work with...  oh well.
You have then $A = PDP^T$ where $P=[u_1,u_2]$ and $D=\begin{bmatrix}\lambda_1&0\\0&\lambda_2\end{bmatrix}$.  $P$ is an orthogonal matrix, so $P^T=P^{-1}$ and we have $P^T A P=D$
</s>