Home

PDF letter size

Review of similarity transformation and Singular Value Decomposition

Nasser M. Abbasi

Applied Mathematics Department, California State University, Fullerton. July 8 2007   Compiled on January 31, 2024 at 3:18am

Contents

1 Similarity transformation
1.1 Derivation of similarity transformation based on algebraic method
1.2 Derivation of similarity transformation based on geometric method
1.2.1 Finding matrix representation of linear transformationT
1.2.2 Finding matrix representation of change of basis
1.2.3 Examples of similarity transformation
1.2.4 How to find the best basis to simplify the representation of T?
1.3 Summary of similarity transformation
2 Singular value decomposition (SVD)
2.1 What is right and left eigenvectors?
2.2 SVD
3 Conclusion
4 References

1 Similarity transformation

A similarity transformation isB=M1AM Where B,A,M are square matrices. The goal of similarity transformation is to find a B matrix which has a simpler form than A so that we can use B in place of A to ease some computational work. Lets set our goal in having B be a diagonal matrix (a general diagonal form is called block diagonal or Jordan form, but here we are just looking at the case of B being a diagonal matrix).

The question becomes: Given A, can we find M such that M1AM is diagonal?

The standard method to show the above is via an algebraic method, which we show first. Next we show a geometric method that explains similarity transformation geometrically.

1.1 Derivation of similarity transformation based on algebraic method

Starting withB=M1AM Our goal is to find a real matrix B such that it is diagonal.  From the above, by pre multiplying each side by M we obtainAM=MB Now, since our goal is to make B diagonal, let us select the eigenvalues of A to be the diagonal of B. Now we write the above in expanded form as follows[a11a1nan1ann][m11m1nmn1mnn]=[m11m1nmn1mnn][λ1000000λn] The above can be written as n separate equations by looking at the column view of matrix multiplication[a11a1nan1ann][m11mn1]=λ1[m11mn1] And[a11a1nan1ann][m12mn2]=λ2[m12mn2] All the way to the nth column of M[a11a1nan1ann][m1nmnn]=λn[m1nmnn] Each of the above n equations is in the formAx=λx and this is the key idea.

The above shows that if we take the diagonal elements of B to be the eigenvalues of A then the M matrix is the (right) eigenvectors of A.

Hence, if we want the B matrix to be diagonal and real, this means the A matrix itself must have some conditions put on it. Specifically, A eigenvalues must be all distinct and real. This happens when A is real and symmetric. Therefore, we have the general result that given a matrix A which has distinct and real eigenvalues, only then can we find a similar matrix to it which is real and diagonal, and these diagonal values are the eigenvalues of A.

1.2 Derivation of similarity transformation based on geometric method

It turns out that this derivation is more complicated than the algebraic approach. It involves a change of basis matrix (which will be our M matrix) and the representation of linear transformation T as a matrix under some basis (which will be our A matrix). Let us start from the beginning.

Given the vector x in Rn, it can have many different representations (or coordinates) depending on which basis are used. There are an infinite number of basis that span Rn, hence there are infinite representations for the same vector. Consider for example R2. The standard basis vectors are {[10],[01]}, but another basis are {[11],[01]}, and yet another are {[11],[01]}, and so on.

In Rn any n linearly independent vectors can be used as basis. Let xv be the vector representation in w.r.t. basis v, and let xv be the vector representation w.r.t. basis v.

An important problem in linear algebra is to obtain xv given xv and the change of basis matrix [M]vv.

This requires finding a matrix representation for the change of basis. Once the [M]vv matrix is found, we can write (1)xv=[M]vvxv Where [M]vv is the change of basis matrix which when applied to xv returns the coordinates of the vector w.r.t. basis v.

From (1) we see that given xv, then to obtain xv we write(1A)xv=[M]vv1xv Another important problem is that of linear transformation T, where now we apply some transformation on the whole space and we want to find what happens to the space coordinates (all the position vectors) due to this transformation.

Consider for example T which is a rotation in R2 by some angle θ. Here, every position vector in the space is affected by this rotation but the basis remain fixed, and we want to find the new coordinates of each point in space.  

Let xv be the position vector before applying the linear transformation, and let yv be the new position vector. Notice that both vectors are written with respect to the same basis v. Similar to change basis, we want a way to find yv from xv, hence we need a way to represent this linear transformation by a matrix, say [T]v with respect to the basis v and so we could write the following(2)yv=[T]vxv

Assume the basis is changed to v. Let the representation of the same linear transformation T w.r.t. basis v be called [T]v, so we write(2A)yv=[T]vxv

Hence when the basis changes from v to v, T representation changes from [T]v to [T]v.

Now assume we are given some linear transformation T and its representation [T]v w.r.t. basis v, how could we find T representation [T]v w.r.t. to new basis v?

From (2) we haveyv=[T]vxv But from (1) xv=[M]vvxv, hence the above becomesyv=[T]v ([M]vvxv) Pre-multiplying from left the above equation by [M]vv1 we obtain[M]vv1yv=[M]vv1[T]v[M]vvxv But since [M]vv1yv=yv, then above reduces toyv=[M]vv1[T]v[M]vvxv But from (2A) yv=[T]vxv, hence the above becomes[T]vxv=[M]vv1[T]v[M]vvxv Therefore(3)[T]v=[M]vv1[T]v[M]vv Notice the difference between change of basis and linear transformation. In change of basis, the vector x remained fixed in space, but the basis changed, and we want to find the coordinates of the vector w.r.t the new basis. With linear transformation, the vector itself is changed from xv to yv, but both vectors are expressed w.r.t. the same basis.

Equation (3) allows us to obtain a new matrix representation of the linear transformation T by expressing the same T w.r.t. to different basis. Hence if we are given a representation of T which is not the most optimal representation, we can, by change of basis, obtain a different representation of the same T by using (3). The most optimal matrix representation for linear transformation is a diagonal matrix.

Equation (3) is called a similarity transformation.  To make it easier to compare (3) above with what we wrote in the previous section when we derived the above using an algebraic approach, we let [T]v=B,[T]v=A, hence (3) is B=M1AM

The matrix [T]v is similar to [T]v. (i.e. B is similar to A). Both matrices represent the same linear transformation applied on the space. We will show below some examples of how to find [T]v given [T]v and [M]. But first we show how to obtain matrix representation of T.

1.2.1 Finding matrix representation of linear transformation T

Given a vector xRn and some linear transformation (or a linear operator) T that acts on the vector x transforming this vector into another vector yRn according to some prescribed manner T:xy. Examples of such linear transformation are rotation, elongation, compression, and reflection, and any combination of these operations, but it can not include the translation of the vector, since translation is not linear.

The question to answer here is how to write down a representation of this linear transformation? It turns out that T can be represented by a matrix of size n×n, and the actual numbers that go into the matrix, or the shape of the matrix, will depend on which basis in Rn we choose to represent x.

We would like to pick some basis so that the final shape of the matrix is the most simple shape.

Let us pick a set of basis v={e1,e2,,en} that span Rn hence xv=a1e1+a2e2++anen Now Txv=T(a1e1+a2e2++anen) And since T is linear we can rewrite the above as(1)Txv=a1Te1+a2Te2++anTen We see from above that the new transformed vector Txv has the same coordinates as xv if we view Tei as the new basis.

Now Tei itself is an application of the linear transformation but now it is being done on each basis vector ei. Hence it will cause each specific basis vector to transform in some manner to a new vector. Whatever this new vector is, we must be able to represent it in terms of the same basis vectors {e1,e2,,en}, therefore, we writeTe1=ξ11e1+ξ21e2++ξn1en Where ξij is the ith coordinate of the vector Tej. And we do the same for Te2Te2=ξ12e1+ξ22e2++ξn2en And so on untilTen=ξ1ne1+ξ2ne2++ξnnen OrTej=ξijei Now plug the above into (1) and obtainTxv=a1(ξ11e1+ξ21e2++ξn1en)+a2(ξ12e1+ξ22e2++ξn2en)++an(ξ1ne1+ξ2ne2++ξnnen)

Hence, if we take the ei as common factors, we haveTx=e1(a1ξ11+a2ξ12++anξ1n)+e2(a1ξ21+a2ξ22++anξ2n)++en(a1ξn1+a2ξn2++anξnn)

Hence, since Txv=a1Te1+a2Te2++anTen from (1), then by comparing coefficients of each basis vector ei we obtaina1T=a1ξ11+a2ξ12++anξ1na2T=a1ξ21+a2ξ22++anξ2nanT=a1ξn1+a2ξn2++anξnn

Or in matrix formT(a1a2an)=(ξ11ξ12ξ1nξ21ξ22ξ2nξn1ξn2ξnn)(a1a2an) Hence we finally obtain thatT[T]v=(ξ11ξ12ξ1nξ21ξ22ξ2nξn1ξn2ξnn) Let us call the matrix that represents T under basis v as [T]v.

We see from the above that the jth column of [T]v contain the coordinates of the vector Tej. This gives us a quick way to construct [T]v: Apply T to each basis vector ej, and take the resulting vector and place it in the jth column of [T]v.

We now see that [T]v will have a different numerical values if the basis used to span Rn are different from the ones used to obtain the above [T]v.

Let use pick some new basis, say v={e1,e2,,en}. Let the new representation of T now be the matrix [T]v, then the jth column of [T]v is found from applying T on the new basis ej Tej=ζijei Where now ζij is the ith coordinates of the the vector Tej which will be different from ξij since in one case we used the basis set v={ei} and in the other case we used the basis set v={ei}. Hence we see that [T]v will numerically be different depending on the basis used to span the space even though the linear transformation T itself did not change.

1.2.2 Finding matrix representation of change of basis

Now we show how to determine [M]vv, the matrix which when applied to a vector xv will result in the vector xv.

Given a vector x, it is represented w.r.t. basis v={e1,e2,,en} as xv=a1e1+a2e2++anen and w.r.t. basis v={e1,e2,,en} asxv=b1e1+b2e2++bnen

But the vector itself is invariant under any change of basis, hence xv=xv(1)a1e1+a2e2++anen=b1e1+b2e2++bnen Now write each basis ei in terms of the basis ej, hence we havee1=c11e1+c12e2++c1nene2=c21e1+c22e2++c2nen(2)en=cn1e1+cn2e2++cnnen

Substitute (2) into RHS of (1) we obtaina1e1+a2e2++anen=b1(c11e1+c12e2++c1nen)+b2(c21e1+c22e2++c2nen)++bn(cn1e1+cn2e2++cnnen)

Factor out the basis ei from the RHS, we obtaina1e1+a2e2++anen=(b1c11e1+b1c12e2++b1c1nen)+(b2c21e1+b2c22e2++b2c2nen)++(bncn1e1+bncn2e2++bncnnen)

Hencea1e1+a2e2++anen=e1(b1c11+b2c21++bncn1)+e2(b1c12+b2c22++bncn2)++en(b1c1n+b2c2n++bncnn)

Now comparing coefficients of each of the basis ei we obtain the following resulta1=b1c11+b2c21++bncn1a2=b1c12+b2c22++bncn2an=b1c1n+b2c2n++bncnn

Or in Matrix form, we write(3)[a1a2an]=[c11c21c31cn1c12c22c32cn2c1nc2nc3ncnn][b1b2bn] The above gives a relation between the coordinates of the vector x w.r.t. basis v (these are the ai coordinates) to the coordinates of the same vector w.r.t. to basis v (these are the coordinates bj). The mapping between these coordinates is the matrix shown above which we call the [M] matrix. Since the above matrix returns the coordinates of the vector w.r.t. v when it is multiplied by the coordinates of the vector w.r.t. basis v, we write it as [M]vv to make it clear from which basis to which basis is the conversion taking place.

Looking at (2) and (3) above, we see that column j in [M]vv is the coordinates of the ej w.r.t. basis v.

Hence the above gives a method to generate the change of basis matrix [M]vv. Simply represent each basis in v w.r.t. to basis v. Take the result of each such representation and write it as a column in [M]vv. We now show few examples to illustrate this.

Example showing how to find change of basis matrix

Given the R2 basis v={e1,e2}={[10],[01]}, and new basis v={e1,e2}={[11],[11]}, find the change of basis matrix [M]vv

Column 1 of [M]vv is the coordinates of e1 w.r.t. basis v. i.e. (4)e1=c11e1+c21e2 and column 2 of [M]vv is the coordinates of e2 w.r.t. basis v. i.e. (5)e2=c12e1+c22e2 But (4) is[10]=c11[11]+c21[11] Hence 1=c11c21 and 0=c11+c21, solving, we obtain c11=12,c21=12 and (5) is[01]=c12[11]+c22[11] Hence 0=c12c22 and 1=c12+c22, solving we obtain c12=12, c22=12, hence[M]vv=[12121212] Now we can use the above change of basis matrix to find coordinates of the vector under v given its coordinates under v. For example, given xv=[105], then xv=[12121212][105]=[7.52.5]

1.2.3 Examples of similarity transformation

Example 1 This example from Strang book (Linear Algebra and its applications, 4th edition), but shown here with little more details.

Consider R2, and let T be the projection onto a line at angle θ=1350. Let the first basis v={[10],[01]} and let the second basis v={[11],[11]}.

The first step is to find [M]vv. The first column of [M]vv is found by writing e1w.r.t. basis v, and the second column of [M]vv is found by writing e2w.r.t. basis v, Hence e1=c11e1+c21e2[11]=c11[10]+c21[01]

Or 1=c11 and c21=1. Ande2=c12e1+c22e2[11]=c12[10]+c22[01]

Hence c12=1 and c22=1. Hence [M]vv=[1111] Now we need to find [T]v the representation of T w.r.t. basis v. The first column of [T]v is the new coordinates of the basis v1 after applying T onto it. but Te1=T[01]=[0.50.5]

and the second column of [T]v is the new coordinates of the basis v2 after applying T onto it. but Te2=T[10]=[0.50.5]

Hence [T]v=[0.50.50.50.5] Therefore[T]v=[M]vv1[T]v[M]vv=[1111]1[0.50.50.50.5][1111][T]v=[1000]

Hence we see that the linear transformation T is represented as [1000] w.r.t. basis v, while it is represented as [0.50.50.50.5]w.r.t. basis v. Therefore, it will be better to perform all calculations involving this linear transformation under basis v instead of basis v

Example 2

Consider R2, and let T be a rotation of space by θ=π4. Let the first basis v={[10],[01]} and let the second basis be v={[11],[11]}.

The first step is to find [M]vv. The first column of [M]vv is found by writing e1w.r.t. basis v, and the second column of [M]vv is found by writing e2w.r.t. basis v, Hence e1=c11e1+c21e2[11]=c11[10]+c21[01]

Or 1=c11 and c21=1 ande2=c12e1+c22e2[11]=c12[10]+c22[01]

Hence c12=1 and c22=1. Hence [M]vv=[1111] Now we need to find [T]v the representation of T w.r.t. basis v. The first column of [T]v is the new coordinates of the basis v1 after applying T onto it. but Te1=T[01]=[cosθsinθ]

and the second column of [T]v is the new coordinates of the basis v2 after applying T onto it. but Te2=T[10]Te2=[sinθcosθ]

Hence [T]v=[cosθsinθsinθcosθ]=[cosπ4sinπ4sinπ4cosπ4][T]v=[12121212]

Therefore[T]v=[M]vv1[T]v[M]vv=[1111]1[12121212][1111]=[12121212][0220]=[12121212]

Hence we see that the linear transformation T is represented as [12121212] w.r.t. basis v, while it is represented as [12121212]w.r.t. basis v. Therefore the change of basis selected above did not result in making the representation of T any simpler (in fact there was no change in the representation).  This means we need to find a more direct method of finding the basis under which T has the simplest representation. Clearly we can’t just keep trying different basis to find if T has simpler representation under the new basis.

1.2.4 How to find the best basis to simplify the representation of T?

Our goal of simpler representation of T is that of a diagonal matrix or as close as possible to being diagonal matrix (i.e. Jordan form). Given [T]v and an infinite number of basis v that we could select to represent T under in the hope we can find a new representation [T]v such that it is simpler than [T]v, we now ask, how does one go about finding such basis?

It turns out the if we select the eigenvectors of [T]v as the columns of [M]vv, this will result in [T]v being diagonal or as close to being diagonal as possible (block diagonal or Jordan form).

Let us apply this to the second example in the previous section. In that example, we had[T]v=[12121212] The eigenvectors of [T]v are [i1] and [i1], [M]vv=[ii11]. Therefore[T]v=[M]vv1[T]v[M]vv=[ii11]1[12121212][ii11][T]v=[(1212i)200(12+12i)2]

Which is diagonal representation. Hence we see that the linear transformation T is represented as [(1212i)200(12+12i)2] w.r.t. basis v

1.3 Summary of similarity transformation

To obtain B=M1AM such that B is real and diagonal requires that A be real and symmetric. The eigenvalues of A goes into the diagonal of B and the eigenvectors of A go into the columns of M. This is an algebraic view.

Geometrically, A is viewed as the matrix representation under some basis v of a linear transformation T. And B is the matrix representation of the same linear transformation T but now under a new basis v and M is the matrix that represents the change of basis from v to v.

The question then immediately arise: If A must be real and symmetric (for B to be real and diagonal), what does this mean in terms of the linear transformation T and change of basis matrix M? This clearly mean that, under some basis v, not every linear transformation represented by A can have a similar matrix B which is real and diagonal. Only those linear transformations which result in real and symmetric representation can have a similar matrix which is real and diagonal. This is shown in the previous examples, where we saw that T defined as rotation by 450 under the standard basis v={[10],[01]} resulted in A=[12121212] and since this is not symmetric, hence we will not be able to factor this matrix using similarity transformation to a diagonal matrix, no matter which change of basis we try to represent T under. The question then, under a given basis v what is the class of linear transformation which leads to a matrix representation that is symmetric? One such example was shown above which is the projection into the line at 1350. This question needs more time to look into.

We now write Λ to represent a diagonal matrix, hence the similarity transformation above can be written asΛ=M1AM OrA=MΛM1

2 Singular value decomposition (SVD)

Using similarity transformation, we found that for a real and symmetric matrix A we are able to decompose it as A=MΛM1 where Λ is diagonal and contains the eigenvalues of A on the diagonal, and M contains the right eigenvectors of A in its columns.

2.1 What is right and left eigenvectors?

Right eigenvectors are the standard eigenvectors we have been talking about all the time. When λ is an eigenvalues of A then x is a right eigenvector when we writeAx=λx However, x is a left eigenvector of A when we havexHA=λxH where xH is the Hermitian of x

2.2 SVD

Given any arbitrary matrix Am×n it can be factored into 3 matrices as follows Am×n=Pm×mDm×nQn×n where P is a unitary matrix (PH=P1 or PHP=I), and Q is also unitary matrix.

These are the steps to do SVD

  1. Find the rank of A, say r
  2. Let B=An×mHAm×n, hence Bn×n is a square matrix, and it is semi positive definite, hence its eigenvalues will all be 0. Find the eigenvalues of B, call these σi2. There will be n such eigenvalues since B is of order n×n. But only r of these will be positive, and nr will be zero. Arrange these eigenvalues such that the first r non-zero eigenvalues come first, followed by the zero eigenvalues: σ12,σ22,,σr2,0,0,,0neigenvalues
  3. Initialize matrix Dm×n to be all zeros. Take the the first r eigenvalues from above (non-zero ones), and take the square root of each, hence we get σ1,σ2,,σrr singular values and write these down the diagonal of D starting at D(1,1), i.e. D(1,1)=σ1,D(2,2)=σ2,,D(r,r)=σr. Notice that the matrix D need not square matrix. Hence we can obtain an arrangement such as the following for r=2D=(σ10000σ2000000) where the matrix A was 3×4for example.
  4. Now find each eigenvalue of AHA. For each eigenvalue, find the corresponding eigenvector. Call these eigenvectors u1,u2,,un.
  5. Normalize the eigenvectors found in the above step. Now u1,u2,,un eigenvector will be an orthonormal set of vectors. Take the Hermitian of each eigenvector u1H,u2H,,unHand make one of these vectors (now in row format instead of column format) go into a row in the matrix Q.i.e. the first row of Q will be u1H, the second row of Q will be u2H, etc... (AHA)n×nfind eigenvectors and normalize{u1,u2,,ur,ur+1,,unortho basis (n-r) for N(A)}Qn×n=[u1Tu2TurTur+1TunT]
  6. Now we need to find a set of m orthonormal vectors, these will be the columns of the matrix P: find a set of r orthonormal eigenvector vi=1σiAui, for i=1r. Notice that here we only use the first r vectors found in step 5. Take each one of these vi vectors and make them into columns of P. But since we need m columns in P not just r, we need to come up with mr more basis vectors such that all the m vectors form an orthonormal set of basis vectors for the row space of A, i.e. Cm. If doing this by hand, it is easy to find the this mr by inspection. In a program, we could use the same process we used with Gram-Schmidt, where we learned how find a new vector which is orthonormal to a an existing set of other vectors. Another way to find the matrix P is to construct the matrix AAH and find its eigenvectors, those go into the columns of the matrix P as follows (AAH)m×mfind eigenvectors and normalize{v1,v2,,vrorthonormal basis for range A,vr+1,,vm}Pm×m=[v1v2vrvr+1vm]
  7. This completes the factorization, now we have A=P D Q 

The following diagram help illustrate the SVD process described above.

3 Conclusion

As a conclusion, the following diagram shows the difference between similarity transformation factorization of a matrix and SVD.

Trying to understand SVD from geometrical point view requires more time, and this is left for future research into this subject.

4 References

  1. Linear Algebra and its applications 4th edition by Gilbert Strang
  2. Course notes, Linear Algebra, Math 307, CSUF mathematics department, spring 2007 by Dr Angel Pineda.
  3. Principles and techniques of applied Mathematics by Bernard Friedman, Spectral theory of operators chapter.
  4. Matrix computation, 3rd edition by Gene Golub and Charles Van Loan.
  5. Numerical analysis: Mathematics of scientific computing, by David Kincaid and Ward Cheney.