Week 4: The Spectral Theorem#

Exercises – Long Day#

1: Types of Matrices#

Consider the matrices:

\[\begin{equation*} A=\begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}, \quad B=\begin{bmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \\ 2 & 3 & 1 \end{bmatrix}, \quad C=\begin{bmatrix} 1 & 2+i & 3i \\ 2-i & 1 & 2 \\ -3i & 2 & 1 \end{bmatrix}, \quad D=\begin{bmatrix} i & 2 & 3 \\ 2 & i & 2 \\ 3 & 2 & i \end{bmatrix}. \end{equation*}\]

Determine for each matrix whether it is symmetric, Hermitian, and/or normal. You may use SymPy to check if the matrices are normal. For convenience, the matrices are provided here:

A = Matrix.diag(1, 2, 3)
B = Matrix([[1, 2, 3], [3, 1, 2], [2, 3, 1]])
C = Matrix([[1, 2 + I, 3*I], [2 - I, 1, 2], [-3*I, 2, 1]]) 
D = Matrix([[I, 2, 3], [2, I, 2], [3, 2, I]])

2: Hermitian 2-by-2 Matrix. By Hand#

We consider the Hermitian matrix \(A\) given by:

\[\begin{equation*} A=\begin{bmatrix} 0 & i \\ -i & 0 \end{bmatrix}. \end{equation*}\]

This exercise involves computing a spectral decomposition of \(A\), which we know exists due the Spectral Theorem (the complex case). We find this decomposition of \(A\) in three steps:

Question a#

Find all eigenvalues and associated eigenvectors of \(A\). Check your anwer using SymPy’s A.eigenvects().

Question b#

Provide an orthonormal basis consisting of eigenvectors of \(A\).

Question c#

This result holds for general \(n \times n\) matrices. Show that \(A = U \Lambda U^*\) if and only if \(\Lambda = U^* A U\), when \(U\) is unitary.

Question d#

Write down a unitary matrix \(U\) and a diagonal matrix \(\Lambda\) such that \(A = U \Lambda U^*\). This formula is called a spectral decomposition of \(A\). Check your result using the SymPy command:

A = Matrix([[0, I], [-I, 0]])
A.diagonalize(normalize = True)

3: Orthogonality of Eigenvectors of Symmetric Matrices#

Let \(C\) be a \(2 \times 2\) real, symmetric matrix with two different eigenvalues. Show that the eigenvectors \(\pmb{v}_1\) and \(\pmb{v}_2\) corresponding to the two different eigenvalues are orthogonal, i.e., that

\[\begin{equation*} \langle \pmb{v}_1, \pmb{v}_2 \rangle = 0. \end{equation*}\]

4: Symmetric 3-by-3 matrix#

We are given the real and symmetric matrix

\[\begin{equation*} A=\begin{bmatrix} -2 & 1 & 1 \\ 1 & -2 & -1 \\ 1 & -1 & -2 \end{bmatrix}. \end{equation*}\]

Find a spectral decomposition of \(A = Q \Lambda Q^T\). In other words, provide a real orthogonal matrix \(Q\) and a diagonal matrix \(\Lambda\) such that

\[\begin{equation*} A = Q \Lambda Q^T \end{equation*} \]

or, equivalently,

\[\begin{equation*} Q^T \, A\, Q=\Lambda \end{equation*} \]

is fulfilled. As in the previous exercise we know from the Spectral Theorem (the real case) that these matrices exist.

5: Spectral decomposition with SymPy#

We consider the following matrices given in SymPy:

A = Matrix([[1, -1, 0, 0], [0, 1, -1, 0], [0, 0, 1, -1], [-1, 0, 0, 1]])
B = Matrix([[1, 2, 3, 4], [4, 1, 2, 3], [3, 4, 1, 2], [2, 3, 4, 1]])
A, B
\[\begin{split}\displaystyle \left( \left[\begin{matrix}1 & -1 & 0 & 0\\0 & 1 & -1 & 0\\0 & 0 & 1 & -1\\-1 & 0 & 0 & 1\end{matrix}\right], \ \left[\begin{matrix}1 & 2 & 3 & 4\\4 & 1 & 2 & 3\\3 & 4 & 1 & 2\\2 & 3 & 4 & 1\end{matrix}\right]\right)\end{split}\]

We are informed that both matrices are real, normal matrices. This can be checked by:

A.conjugate() == A, B.conjugate() == B, A*A.T == A.T*A, B*B.T == B.T*B
(True, True, True, True)

We are furthermore informed that the eigenvalues are, respectively:

A.eigenvals(multiple=True), B.eigenvals(multiple=True)
../_images/2e86030980a9a970e1936f0c3363564ba2d6653642046b06b2c39fcabd5e38e4.png

Question a#

Will the following SymPy commands give us the matrices involved in the spectral decompositions of \(A\) and \(B\)? The call A.diagonalize(normalize=True) returns \((V, \Lambda)\), where \(A = V \Lambda V^{-1}\), with normalized eigenvectors in \(V\) and the eigenvalues of \(A\) being the diagonal elements in the diagonal matrix \(\Lambda\) (according to the eigenvalue problem studied in Mathematics 1a).

A.diagonalize(normalize = True), B.diagonalize(normalize = True)

Question b#

Does a unitary matrix that diagonalizes both \(A\) and \(B\) exist? Meaning, does one unitary matrix exist such that \(A = U \Lambda_1 U^*\) and \(B = U \Lambda_2 U^*\), where \(\Lambda_1\) is a diagonal matrix consisting of the eigenvalues of \(A\) and where \(\Lambda_2\) is a diagonal matrix consisting of the eigenvalues of \(B\)?

Question c#

You have seen the matrix \(U\), or maybe \(U^*\), before (possibly with its columns in a different order). What kind of matrix is this?

6: Diagonalization and Reduction of Quadratic Forms#

We consider the function \(q : \mathbb{R}^3 \to \mathbb{R}\) given by

\[\begin{equation*} q(x,y,z)=-2x^2-2y^2-2z^2+2xy+2xz-2yz+2x+y+z+5. \end{equation*}\]

Note that \(q\) can be split into two parts: a part containing purely the quadratic terms: \(k(x,y,z)=-2x^2-2y^2-2z^2+2xy+2xz-2yz\), and a part with the remaining terms, which is a linear polynomial: \(2x+y+z+5\).

We are given the symmetric matrix

\[\begin{equation*} A=\begin{bmatrix} -2 & 1 & 1 \\ 1 & -2 & -1 \\ 1 & -1 & -2 \end{bmatrix}. \end{equation*}\]

Question a#

Provide a real, orthogonal matrix \(Q\) and a diagonal matrix \(\Lambda\), such that

\[\begin{equation*} Q^T \, A\, Q=\Lambda. \end{equation*}\]

You must choose \(Q\) such that it has \(\operatorname{det}\,Q=1\). You may use SymPy for this exercise.

Note

Real, orthogonal matrices always have \(\operatorname{det} Q = \pm 1\) (why do you think that is?). If your chosen \(Q\) has \(\operatorname{det} Q = -1\), you can simply change the sign of any column or row. Real orthogonal matrices with \(\operatorname{det} Q = 1\) are sometimes called properly oriented. In \(\mathbb{R}^3\), this simply means that the orthonormal basis which constitutes the columns in \(Q\) forms a right-handed coordinate system. This does not play a significant role for us in this problem.

Question b#

State the functional expression of \(k(x,y,z),\) convert it to matrix form, and reduce it.

Question c#

Find a properly oriented orthonormal basis for \(\mathbb{R}^3\) in which the formula for \(q\) has no mixed terms. Determine the functional expression.

7: The Partial Derivative Increases the most in the Gradient Direction#

This exercise is taken from the textbook, and the goal is to argue why in the gradient method, one moves in the direction of the gradient vector.

Let \(f: \mathbb{R}^{n} \to \mathbb{R}\) be a function for which all directional derivatives exist at \(\pmb{x} \in \mathbb{R}^{n}\). Assume that \(\nabla f(\pmb{x})\) is not the zero vector.

Question a#

Show that \(\pmb{u} := \nabla f(\pmb{x}) / \Vert \nabla f(\pmb{x}) \Vert\) is a unit vector.

Question b#

Show that the scalar \(|\nabla_{\pmb{v}}f(\pmb{x})|\) becomes largest possible when \(\pmb{v} = \pm \pmb{u}\).

8: Standard Equations for the Three Typical Conic Sections#

In the following examples, we consider quadratic forms without mixed terms (since we can eliminate these through diagonalization, as in the previous exercise). Here, it is possible to take it a step further and remove the first-degree terms as well. This technique is called completing the square. In the following, we will use this technique in order to identify so-called conic sections.

Question a#

An ellipse in the \((x, y)\) plane with center \((c_1, c_2)\), semi-axes \(a\) and \(b\), and symmetry axes \(x = c_1\) and \(y = c_2\) has the standard equation

\[\begin{equation*} \frac{(x-c_1)^2}{a^2}+\frac{(y-c_2)^2}{b^2}=1. \end{equation*}\]

An ellipse is given by the equation

\[\begin{equation*} 4x^2+y^2+8x-6y+9=0. \end{equation*}\]

Complete the square, put the equation in standard form, and specify the ellipse’s center, semi-axes and symmetry axes.

Question b#

A hyperbola in the \((x,y)\) plane with center \((c_1,c_2),\) semi-axes \(a\) and \(b\), and symmetry axes \(x=c_1\) and \(y=c_2\) has the standard equation

\[\begin{equation*} \frac{(x-c_1)^2}{a^2}-\frac{(y-c_2)^2}{b^2}=1. \end{equation*}\]

Alternatively (if it isn’t horizontally but vertically oriented):

\[\begin{equation*} \frac{(y-c_2)^2}{a^2}-\frac{(x-c_1)^2}{b^2}=1. \end{equation*}\]

A hyperbola is given by the equation

\[\begin{equation*} x^2-y^2-4x-4y = 4. \end{equation*}\]

Complete the square, put the equation in standard form, and specify the hyperbola’s center, semi-axes and symmetry axes.

Question c#

A parabola in the \((x, y)\) plane with its vertex (stationary point) at \((c_1, c_2)\) and symmetry axis \(x = c_1\) has the standard equation

\[\begin{equation*} y-c_2=a(x-c1)^2. \end{equation*}\]

Alternatively, if the parabola is not vertically but horizontally oriented, in which case the symmetry axis becomes \(y=c_2\):

\[\begin{equation*} x-c_1=a(y-c2)^2. \end{equation*}\]

A parabola is given by the equation

\[\begin{equation*} 2x^2+12x-y+17=0. \end{equation*}\]

Complete the square, put the equation in standard form, and specify the parabola’s vertex and symmetry axis.


Theme Exercise – Short Day#

This week the Short Day will be dedicated to Theme 2: Data Matrices and Dimensional Reduction.