Eigenvalues and eigenvectors

Key properties of square matrices are their eigenvalues and eigenvectors, which enable them to be written in a simpler form, through a process known as eigenvalue decomposition. This is useful for performing mathematical and numerical analysis of matrices in order to identify their key features. A similar process is available for non-square matrices, known as singular value decomposition (SVD). (Note that SVD also exists for square matrices.) There are inbuilt tools within MATLAB that may be used to perform both of these decompositions.

We now look at the commands in MATLAB that enable us to calculate these decompositions.

Walkthrough

Consider the square matrix

A=randn(10);

The following commands calculate the eigenvalues and eigenvectors of the matrix (enter the commands):

e=eig(A);
[V,D]=eig(A);

Print e, V and D.

Evaluate the following:

A*V - V*D
Question

What does this give you? Why is this? Use the MATLAB help files to work out what V and D are.

Expand for solution
Solution

This gives you a matrix that is zero to machine precision (that is, all their entries are less than $10^{−12}$). This is because the eigenvalue decomposition of $A$ is $A=VDV^{-1}$, where $V$ is a matrix whose columns are the eigenvectors of $A$ and $D$ is a diagonal matrix containing the eigenvalues of $A$.

Now consider the non-square matrix:

A=randn(10,5);

The following commands calculate the singular value decomposition (SVD) of the matrix:

[U,S,V]=svd(A);

Evaluate the following

A - U*S*V'
Question

What does this give you? Why is this?

Expand for solution
Solution

Again, this gives you a matrix that is zero to machine precision (all entries are less than $10^{−12}$). This is because the singular value decomposition of $A$ is $A=USV^{T}$, where $U$ and $V$ are square orthogonal matrices of different sizes and $S$ is a matrix of the same size as $A$ whose diagonal entries are the singular values of $A$, with extra rows or columns of zeros depending on the size of $A$.

Info

Note that the command [U,S,V]=svd(A,0) calculates the economic version of the SVD. What is this?

Expand for solution
Solution

The economic form just removes the zero rows/columns from $S$.

Now clear the workspace

clear