The MATLAB Notebook v1.5.2



Section 3: Symmetric Matrices and Quadratic forms.

We recall that a matrix A is called symmetric if A=AT. To every symmetric matrix, there is an associated quadratic form Q, defined by Q(v)=vTAv = v•Av = Av•v. In terms of components, if we write v=[pic], then [pic], and the entries of A can be recovered from the coefficients of Q. Specifically, aii is the coefficient of xi2 and, for i different from j, aij is half the coeficient of xixj. The most important result concerning symmetric matrices is the fact that every symmetric matrix is orthogonally diagonalizable. The rest of this section is devoted to constructing a proof of this fact in several stages.

Proposition 3.1: If A is a symmetric matrix Av=[pic]v, Aw=[pic]w, and [pic], then v•w=0

Proof: Since A is symmetric, Av•w=v•Aw. But Av•w=[pic]v•w=[pic](v•w) and v•Aw=v•[pic]w=[pic](v•w). Since [pic], it follows that v•w=0.

If A is a symmetric matrix with associated quadratic form Q, then the Rayleigh quotient of A is defined by

[pic].

Proposition 3.2: [pic] for every non-zero vector v.

Proof: Since [pic] is a unit vector, [pic]

Proposition 3.3: Every eigenvalue of a symmetric matrix is a value of the Rayleigh quotient.

Proof: If [pic], then [pic] and [pic].

A partial converse to Proposition 3.3 is given by

Proposition 3.4: If R(v) is an extreme value of the Rayleigh quotient of A, then R(v) is an eigenvalue of A and v is an eigenvector belonging to the eigenvalue R(v). Moreover if W=span{v}[pic], then AW [pic] W.

Proof: Let R(v) be an extreme value of the Rayleigh quotient of A, and let us consider R(v+tw), where t is a real parameter and w is any vector. Because R(v) is an extreme value, it follows that R(v+tw), as a function of t, takes an extreme value at t=0, and therefore [pic]. This derivative is easily computed using the product rule (details are left to an exercise), and turns out to be [pic]. It follows that (v•Aw)(v•v)=(v•Av)(v•w) for all vectors w. In particular, if v•w=0, it follows that v•Aw=Av•w=0. If we set W=span{v}[pic], the last equation says both that AW [pic] W and that Av is perpendicular to any vector that is perpendicular to v or, in other words, Av [pic] Span{v}[pic] = Span{v}. But this means that Av is a multiple of v, say [pic]v or, equivalently, v is an eigenvector of A as claimed in the proposition. It is now straightforward from the definition of R(v) that R(v)=[pic].

Proposition 3.5 If A is an nxn symmetric matrix, then Rn has an orthonormal basis consisting entirely of eigenvectors of A.

It follows from Proposition 3.3 that A defines a linear transformation on W = span{v}┴ . We still have the identity w•Au=Aw•u if we restrict u and w to lie in W, and we can also restrict the Rayleigh quotient to W in the form [pic]. It follows that R(w) has an extremum in w, and therefore that A has an eigenvector in W, which is necessarily perpendicular to the eigenvector v we produced in Proposition 3.3. We can now repeat the entire argument with span{v,w}[pic] to produce a third eigenvector perpendicular to the first two. Continuing inductively in this manner, we can produce an orthogonal basis of Rn consisting entirely of eigenvectors of A. Since we can choose each basis vector to have length 1, we have now produced an orthonormal basis of Rn consisting of eigenvectors of A.

Classification of Symmetric Matrices

A symmetric matrix whose eigenvalues are all positive is called positive-definite. The reason for this language is that it follows from Proposition 3.4 that all values of the Rayleigh quotient are positive and so are all values of the associated quadratic form, except at the zero vector. Similarly, a symmetric matrix whose eigenvalues are all negative is called negative-definite. A symmetric matrix whose eigenvalues are both positive and negative is called indefinite. A symmetric matrix whose eigenvalues have only one sign, but may include zero is called semi-definite. It follows that a non-singular semi-definite symmetric matrix is either positive-definite or negative-definite. The same terminology is used for the associated quadratic forms. It is worth recalling that any matrix is singular if and only if it has 0 as an eigenvalue. This is because the determinant of a matrix is the product of its eigenvalues.

Symmetric Matrices and MATLAB

MATLAB has a function called eig that returns the eigenvalues of a matrix. This is sufficient to classify the matrix according to the definitions in the previous paragraph. Actually, eig also computes the eigenvectors of its argument, but it doesn't tell you about them unless you ask specifically. Let us see how this works. We will begin by defining a symmetric matrix A. (Actually, eig does not particularly require that its argument be symmetric, but that is what we are interested in at the moment.

A=[1 2 3;2 3 4;3 4 5]

A =

1 2 3

2 3 4

3 4 5

eig(A)

ans =

-0.0000

-0.6235

9.6235

From this output, we see that A is indefinite (since it has both a positive and a negative eigenvalue) and singular (since it has zero as an eigenvalue). Let us proceed one step further

[P,D]=eig(A)

P =

0.4082 -0.8277 0.3851

-0.8165 -0.1424 0.5595

0.4082 0.5428 0.7339

D =

-0.0000 0 0

0 -0.6235 0

0 0 9.6235

We see that D is a diagonal matrix whose diagonal entries are the eigenvalues we have already computed. P is a matrix whose columns are eigenvectors of A. That being the case, we know that the columns of P are orthogonal. If the are actually orthonormal, then the matrix P is orthogonal and PTAP=D. Let us check this.

P*P'

ans =

1.0000 0.0000 0.0000

0.0000 1.0000 -0.0000

0.0000 -0.0000 1.0000

P'*A*P

ans =

0.0000 0.0000 0.0000

0.0000 -0.6235 -0.0000

0.0000 -0.0000 9.6235

These last two computations verify that P is orthogonal and that A is orthogonally similar to a diagonal matrix whose entries are the eigenvalues already computed. This provides a check on the original computation.

Contours of Quadratic Forms and MATLAB Graphics

A contour of a function of several variables is the set of points for which the function takes some fixed value. We will use the graphics capabilities of MATLAB to look at some contours of quadratic forms in two and three dimensions. We will begin with a couple of two-dimensional examples:

syms x y

f=x^2+2*x*y+3*y^2

f =

x^2+2*x*y+3*y^2

contours2(f,[0,0],2,1)

[pic]

g=x^2+4*x*y+2*y^2

g =

x^2+4*x*y+2*y^2

contours2(g,[0,0],2,1)

[pic]

Now for some explanation. The MATLAB m-file contours2.m plots contours of a given function at and near a given point. For the present, the given point is the origin in each case. The third argument determines the size of the region shown (for simplicity it is always a square around the given point whose side length is twice the third argument). Three contours are plotted, corresponding to three equally spaced values: below, at and above the value at the given point. The last argument determines this spacing.

The quadratic form f is positive definite and its contours for positive values are ellipses, for negative values empty, and the 0-contour consists of a single point, namely the origin.

g is indefinite and non-singular, and all its contours are one-dimensional. The 0-contour, which passes through the origin, consists of two intersecting lines , the contours for both positive and negative values are hyperbolae. See Section 7.2 of Lay's text for further details.

Let us now look at some contours in the three dimensional case.

h=x^2+y^2-z^2

h =

x^2+y^2-z^2

contours3(h,[0,0,0],3,0)

[pic]

contours3(h,[0,0,0],3,-1)

[pic]

contours3(h,[0,0,0],3,1)

[pic]

Since it is not really practical to show several different three dimensional contours on a single plot, the mfile contours3.m plots only one contour at a time. The syntax is analogous to the syntax for contours2, except that the last argument determines the single contour value to be plotted as an offest from the value at the point. An offset of 0 gives the contour through the given point, a positive offset gives a contour corresponding to a higher value, and a negative offset gives a contour corresponding to a lower value.

What we see here is qualitatively typical of a non-singular indefinite quadratic form: the contour through the origin is a double cone. In this case, the negative valued contours are hyperboloids of two sheets and the positive values ones are hyperboloids of one sheet. However these associations can be reversed, for instance by multiplying a quadratic form by –1.

In the case of a positive-definite quadratic form, the positive valued contours are ellipsoids, the contour through the origin consists only of the origin, and the negative valued contours are empty.

Problems

Solve the following problems from Lay's book. You may use eig, but you must check the answers you get every time you do so, following the pattern of the example at the end of this section.

Section 7.1 Problem 38

Section 7.2

Problems 4-5

Use MATLAB to show some contours of the quadratic forms in Problems 4a and 5a.

Problems 9-10

Problem 17

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download