For the following matrix A, find a unitary matrix U such that U*AU is diagonal:
A =
1 2 2 2
2 1 2 2
2 2 1 2
2 2 2 1
I found the following eigenvectors: (v1)=(1;1;1;1), (v2)=(-1;0;0;1), (v3)=(-1;0;1;0), (v4)=(-1;1;0;0).
I normalized them: ||(v1)|| = 2, ||(v2)|| = sqrt(2), ||(v3)|| = sqrt(2), ||(v4)|| = sqrt(2)
U=
1/2 -1/sqrt(2) -1/sqrt(2) -1/sqrt(2)
1/2 0 0 1/sqrt(2)
1/2 0 1/sqrt(2) 0
1/2 1/sqrt(2) 0 0
But as far as I can tell, this does not satisfy U*AU being diagonal.
the trouble is, v_{2} and v_{3} are not orthogonal to each other, so your matrix U is NOT unitary.
try replacing v_{3} with (0,-1,1,0) (with is also an eigenvector corresponding to the eigenvalue -1).
now we need to find an eigenvector v_{4}, corresponding to the eigenvalue -1 such that:
<v_{1},v_{4}> = 0
<v_{2},v_{4}> = 0
<v_{3},v_{4}> = 0
the first equation tells us that if v_{4} = (a,b,c,d) that a+b+c+d = 0.
the second equation tells us that a = d, and the third tells us that b = c. so a logical choice is v_{4} = (1,-1,-1,1).
normalizing vectors, we get:
$\displaystyle U = \begin{bmatrix}1/2&-1/\sqrt{2}&0&1/2\\1/2&0&-1/\sqrt{2}&-1/2\\1/2&0&1/\sqrt{2}&-1/2\\1/2&1/\sqrt{2}&0&1/2 \end{bmatrix}$
a (somewhat tedious but) straight-forward calculation shows that:
U*AU = U^{T}AU =
$\displaystyle \begin{bmatrix}7&0&0&0\\0&-1&0&0\\0&0&-1&0\\0&0&0&-1 \end{bmatrix}$
which is diagonal.