Week 4: The Spectral Theorem#

Key Terms#

Preparation and Syllabus#


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 determine normality of the matrices. For your convenience the matrices are written in code 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 concerns the computation of a spectral decomposition of \(A\), which we know exists according to the Spectral Theorem (the complex case). We will find this decomposition of \(A\) in three steps.

Question a#

Find all eigenvalues and corresponding eigenvectors of \(A\). Check your answer with SymPy’s A.eigenvects().

Question b#

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

Question c#

This result applies to 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 out a unitary matrix \(U\) and a diagonal matrix \(\Lambda\) such that \(A = U \Lambda U^*\). This formula is called a spectral composition of \(A\). Check your result using the SymPy command:

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

3: 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, state 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*}\]

applies. Like in the previous question we know that it exists due to the Spectral Theorem (the real case).

4: 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 using:

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 their eigenvalues are, respectively:

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

Question a#

Will the below SymPy commands give us the matrices that are 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 eigenvalues of \(A\) in the diagonal matrix \(\Lambda\) (according to the eigenvalue problem from Mathematics 1a).

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

Question b#

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

Question c#

You have seen the matrix \(U^*\) before (possibly with another column order). What kind of matrix is this?

5: Diagonalization and Reduction of Quadratic Form#

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 “clean” part with all second-degree terms, \(k(x,y,z)=-2x^2-2y^2-2z^2+2xy+2xz-2yz\), and a part with all terms of less than second degree, meaning the first-degree 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#

State 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\) so it has \(\mathrm{det}\,Q=1\). You may use SymPy for this exercise.

Note

Real, orthogonal matrices always have \(\mathrm{det}\,Q = \pm 1\) (why though?), so if your choice \(Q\) has \(\mathrm{det}\,Q = - 1\) then you can just change the sign of an arbitrary column or row. Real, orthogonal matrices with \(\mathrm{det}\,Q = 1\) are said to be given a usual orientation. In \(\mathbb{R}^3\) this just means that the orthonormal basis in \(Q\) establishes a right-handed coordinate system. This does not play any big role for us in this exercise.

Question b#

Determine the expression \(k(x,y,z),\) rewrite it to a matrix form, and reduce it.

Question c#

Find an orthonormal basis with usual orientation for \(\mathbb{R}^3\) in which the expression for \(q\) does not have mixed terms. Determine its expression.

6: Standard Equation for the three Typical Conic Sections#

In the following examples we will look at quadratic forms without mixed terms (as learned in the previous exercise we are able to get rid of these via diagonalization). Here it is possible to go one step further and remove the first-degree terms. This technique is called completing the square. In the following we will be using the technique on our journey towards identification of so-called conic sections.

Question a#

An ellipsis in the \((x,y)\) plane centred at \((c_1,c_2)\) with semi-axes \(a\) and \(b\) and with 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 ellipsis is given by the equation

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

Use the technique for completing the square, bring the equations to the standard form, and state the centre, semi-axes, and symmetry axes of the ellipsis.

Question b#

A hyperbola in the \((x,y)\) plane centred at \((c_1,c_2)\) with semi-axes \(a\) and \(b\) and with 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*}\]

Or alternatively (If it is not horizontal but vertical):

\[\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, bring the equation to standard form, and state the centre, semi-axes, and symmetry axes of the hyperbola.

Question c#

A parabola in the \((x,y)\) plane with vertex (stationary point) \((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*}\]

Or alternatively, if the parabola is not vertical but horionzontal, which will give the symmetry axis \(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, bring the equation to standard form, and state the vertex and symmetry axis of the parabola.

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

This exercise is from the Notes, and its purpose is to argue for why one in the gradient method moves in the direction of the gradient.

Let \(f: \mathbb{R}^{n} \to \mathbb{R}\) be a function, for which all directional derivatives exist in \(\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}\).

Hint

Remember that \(\nabla_{\pmb{v}}f(\pmb{x})) = \langle \pmb{v}, \nabla f (\pmb{x}) \rangle\). What do you get if you insert \(\pmb{u} = \nabla f(\pmb{x}) / \Vert \nabla f(\pmb{x}) \Vert\)?

Hint

Use Cauchy/Schwarz’ inequality theorem to argue that \(|\nabla_{\pmb{v}}f(\pmb{x})|\) cannot become any larger.

8: General Symmetric 2-by-2 Matrix#

We consider an arbitrary \(2 \times 2\) matrix. Such a matrix can be written as:

\[\begin{equation*} A=\begin{bmatrix} a & c \\ c & b \end{bmatrix} \end{equation*}\]

where \(a,b,\) and \(c\) are real numbers. (Why is this the case?)

Question a#

Show that the eigenvalues of \(A\) are real.

Question b#

Show that if \(A\) is not a diagonal matrix, then it has two different (real) eigenvalues.


Thematic Exercise – Short Day#

Today we will carry out Theme Exercise 2.