Lay Chapter 7,

Symmetric Matrices and Quadratic Forms

Diagonalize a Matrix

In[1]:=

Calculate the eigenvalues of a.

In[3]:=

Out[5]//MatrixForm=

Calculate the eigenvectors of a.

In[6]:=

Out[8]//MatrixForm=

Normalize the columns of v

In[9]:=

Out[12]//MatrixForm=

Check.

In[13]:=

Out[14]=

Diagonalize a Matrix

In[15]:=

Calculate the eigenvalues of a.

In[17]:=

Out[19]//MatrixForm=

Calculate the eigenvectors of a.

In[20]:=

Out[22]//MatrixForm=

Normalize the columns of v

In[23]:=

Out[28]//MatrixForm=

Check.

In[29]:=

Out[29]=

Out[30]=

Matrix Representation of a Quadratic Form

Symmetric matrices represent quadratic forms in the following way.

In[31]:=

Out[34]=

Here is the quadratic form generated by a diagonal matrix

In[35]:=

Out[38]=

... and another generated by a symmetric matrix which is not a diagonal matrix.

In[39]:=

Out[42]=

The difference is the "mixed" term.

Matrix Representation of Quadratic Forms

Write the matrix representing a particular quadratic form.

In[43]:=

Out[46]=

Value of a Quadratic Form at a Point

Evaluate a particular quadratic form at distinct points.

In[47]:=

In[51]:=

Out[51]=

Out[52]=

Out[53]=

Change of Variable in a Quadratic Form

If x is a variable in , thena change of variable in a quadratic form is an equation of the form.

In[54]:=

where y is a variable in and p is an invertible n x n matrix.

Diagonalize the following quadratic form.

In[55]:=

First, calculate the corresponding diagonal matrix.

In[59]:=

Out[61]//MatrixForm=

Then the columns of the matrix p are the orthonormal eigenvectors of a, in the proper order.

In[62]:=

Out[66]//MatrixForm=

Check the diagonalization.

In[67]:=

Out[67]=

Check that the two quadratic forms agree for x = {2,-2}.

First, here is qx applied to x = {2,-2}.

In[68]:=

Out[68]=

Now x = p.y implies that y = Inverse[p].x

Here is qy applied to y = Inverse[p].x

In[69]:=

Out[70]=

Colorful Vectors and Curves

Contains Mathematica Code Only -- No Solved Exercises

Principal Axes

Let's recast a quadratic form generated by a symmetric 2 x 2 matrix as a function of two variables.

We use the matrix a from the previous example.

In[97]:=

In[100]:=

Now do the same thing for the matrix d.

In[101]:=

In[103]:=

The second surface s obtained from the first by a rotation.

The y1- and y2-axes in the second figure correspond to the principal axes in the first.

The principal axes are the directions indicated by the columns of the matrix p used in describing the change of variables: x = p y.

In[104]:=

Out[105]=

Out[106]=

Let's see those two vectors. We will exaggerate their lengths in order to see them better.

Note the orientation of the standard coordinate axes.

In[107]:=

In this image as well, the lengths of the vectors indicating the principal axes are exagerated in order to see them better.

One of the vectors is mostly underneath the surface.

In[108]:=

Using Contour Plots to Investigate Quadratic Forms and their Principal Axes

Let's see a contour plot of the quadratic form qa.

In[110]:=

... and a contour plot of the quadratic form qd.

It seems clear that the second is obtained by a rotation of the first.

In[114]:=

Now let's see those principal axes superimposed on the contour plot of qa.

In[117]:=

Classification of Quadratic Forms

Positive definite

In[122]:=

Negative definite

In[126]:=

Indefinite

In[130]:=

Positive Semidefinite

In[134]:=

Diagonalization a Quadratic Form

Diagonalize the following quadratic form.

In[138]:=

Out[141]=

First, calculate the corresponding diagonal matrix.

In[142]:=

Out[144]//MatrixForm=

Use d to construct the equivalent (diagonal) quadratic form.

This quadratic form is Lay 7.2.17.

In[145]:=

Out[145]=

Now relate the two quadratic forms by calculating the change of basis matrix p such that x = p y.

The columns of the matrix p are the orthonormal eigenvectors of a, in the proper order.

In[146]:=

Out[152]//MatrixForm=

Check the diagonalization.

In[153]:=

Out[153]=

Constrained Optimization

Consider the following quadratic form:

In[154]:=

Out[157]=

Calculate the corresponding diagonal matrix.

In[158]:=

Out[160]//MatrixForm=

The columns of the matrix p are the orthonormal eigenvectors of a, taken in the proper order.

In[161]:=

Out[166]//MatrixForm=

Check the diagonalization.

In[167]:=

Out[167]=

Constrained Optimization

Consider the following quadratic form.

In[168]:=

Out[171]=

Calculate the corresponding diagonal matrix.

In[172]:=

Out[174]//MatrixForm=

Then the columns of the matrix p are the orthonormal eigenvectors of a, taken in the proper order.

In[175]:=

Out[179]//MatrixForm=

Check the diagonalization.

In[180]:=

Out[180]=

We can graph this surface.

Stretch out the graph for a better view.

In[181]:=

Created by Mathematica (December 11, 2004) |