How to calculate the spectral(eigen) decomposition of a symmetric matrix?

460 Views Asked by At

I am aiming to find the spectral decomposition of a symmetric matrix. From what I understand of spectral decomposition; it breaks down like this:

For a symmetric matrix $B$, the spectral decomposition is $VDV^T$ where V is orthogonal and D is a diagonal matrix.

Now the way I am tackling this is to set $V$ to be an $nxn$ matrix consisting of the eigenvectors in columns corresponding to the positions of the eigenvalues i will set along the diagonal of $D$.

The problem I am running into is that V is not orthogonal, ie $V*V^T$ does not equal the identity matrix( I am doing all of this in $R$). Any help would be appreciated, an example on a simple 2x2 or 3x3 matrix would help me greatly.