Find an orthogonal matrix P and a diagonal matrix D such that $P^TAP$=D The symmetric matrix $A$ below has distinct eigenvalues $−6, −12$ and $−18$. Find an orthogonal matrix $P$ and a diagonal matrix $D$ such that $P^TAP=D$ 
$$
  A 
= \left[
  \begin{array}{ccc}
  -13 &  1  &  4  \\
   1  & -13 & -4  \\
   4  & -4  & -10 \\
  \end{array} 
  \right]
$$
I know my $D$ matrix will be the eigenvalues along the diagonal. But how do I find $P$? I am having trouble with this computation. I spent 15 minutes doing the computation but I get it wrong all the time. 

Find the orthogonal eigenvectors $v_1,v_2,v_3$ corresponding to your $3$ eigenvalues, put them as columns into the matrix $P$ and that will do it.
Here are the details:
$$
     A - (-6)I
=    \left[
     \begin{array}{ccc}
     -7 &  1 &  4 \\
      1 & -7 & -4 \\
      4 & -4 & -4 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
      1 & -7 & -4 \\
     -7 &  1 &  4 \\
      1 & -1 & -1 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
      1 & -7 & -4 \\
      0 & -6 & -3 \\
      0 &  6 &  3 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
      1 & 0 & -1/2 \\
      0 & 1 &  1/2 \\
      0 &  0 &  0 \\
     \end{array}
     \right]
$$
so a normalized evector for $\lambda_1 = -6$ is $v_1 = \frac{1}{\sqrt{6}}(1,-1,2)$,
$$
     A - (-12)I
=    \left[
     \begin{array}{ccc}
     -1 &  1 &  4 \\
      1 & -1 & -4 \\
      4 & -4 &  2 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
     1 & -1 & -4 \\
     0 &  0 &  0 \\
     0 &  0 & 18 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
     1 & -1 & 0 \\
     0 &  0 & 0 \\
     0 &  0 & 0 \\
     \end{array}
     \right]
$$
so a normalized evector for $\lambda_2 = -12$ is $v_2 = \frac{1}{\sqrt{2}}(1,1,0)$, and
$$
     A - (-18)I
=    \left[
     \begin{array}{ccc}
     5 &  1 &  4 \\
     1 &  5 & -4 \\
     4 & -4 &  8 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
     1 &  5 & -4 \\
     5 &  1 &  4 \\
     1 & -1 &  2 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
     1 &  5 & -4 \\
     0 &  6 & -6 \\
     0 & -6 &  6 \\
     \end{array}
     \right]
\sim \left[
     \begin{array}{ccc}
     1 & 0 &  1 \\
     0 & 1 & -1 \\
     0 & 0 &  0 \\
     \end{array}
     \right]
$$
so a normalized evector for $\lambda_3 = -18$ is $v_3 = \frac{1}{\sqrt{3}}(-1,1,1)$. Finally,
$$
P = \frac{1}{\sqrt{6}}\left[
     \begin{array}{ccc}
     1 &  \sqrt{3} & -\sqrt{2} \\
     -1 &  \sqrt{3} & \sqrt{2} \\
     2 & 0 &  \sqrt{2} \\
     \end{array}
     \right]
$$
