\documentclass[10pt]{article}

\usepackage{systeme}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
%\usepackage{palatino}
\usepackage{setdeck}

\usepackage{xcolor}
\usepackage{tcolorbox}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
\usetikzlibrary{cd}
\tikzset{
      labr/.style={anchor=north, rotate=90, inner sep=.7mm}
    }
\tikzset{
      labl/.style={anchor=south, rotate=90, inner sep=.7mm}
    }

%\usepackage{pgfplots}
\tikzstyle{ball} = [circle,shading=ball, ball color=black,
    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage[shortlabels]{enumitem}
\setlist[enumerate]{leftmargin=*,label=(\alph*)}

%\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\rspace}{\mathrm{rowspace}}
\DeclareMathOperator{\cspace}{\mathrm{colspace}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}
\DeclareMathOperator{\vol}{\mathrm{vol}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\allowdisplaybreaks

\begin{document}
\centerline{Math 201 lecture for Friday, Week 13}
\bigskip

\centerline{\textbf{The Spectral theorem}}  
\bigskip

\textbf{Theorem} (Spectral theorem). Let $A$ be an $n\times n$ symmetric matrix
over~$\R$.  Then $A$ is diagonalizable over~$\R$, and there exists an
orthonormal basis for~$\R^{n}$ (with respect to the standard inner product) consisting of eigenvectors for~$A$.	
\bigskip

\textbf{Example.} Let
\[
  A =
  \left(\begin{array}{rrr}
  -1 & -1 & -2 \\
-1 & -1 & 2 \\
-2 & 2 & 2
  \end{array}\right).
\]
The characteristic polynomial of~$A$ is
\[
  p_{A}(t)=\det 
  \left(\begin{array}{rrr}
  -1-t & -1 & -2 \\
-1 & -1-t & 2 \\
-2 & 2 & 2-t
  \end{array}\right)
  =-t^{3}+12t+16
  =(4-t)(-2-t)^{2}.
\]
So the eigenvalues are~$4, -2, -2$. We next compute bases for the eigenspaces.
For~$\lambda=4$,
\[
  A-4I_{4}=
  \left(\begin{array}{rrr}
  -5 & -1 & -2 \\
-1 & -5 & 2 \\
-2 & 2 & -2
  \end{array}\right)
  \rightsquigarrow
  \left(\begin{array}{rrr}
  1 & 0 & \frac{1}{2}\\[5pt]
0 & 1 & -\frac{1}{2}\\[5pt]
0 &0 & 0
  \end{array}\right).
\]
So the eigenspace for~$\lambda=4$ is $E_{4}\{(-\frac{1}{2}t,\frac{1}{2}t,t): t\in
\R\}$.  One basis is $\{(-1,1,2)\}$.  Normalizing gives the basis vector
\[
  v_{1}=\frac{1}{\sqrt{6}}(-1,1,2).
\]
For the eigenvalue~$\lambda=-2$, we have
\[
  A+2I_{4}=
  \left(\begin{array}{rrr}
  1 & -1 & -2 \\
-1 & 1 & 2 \\
-2 & 2 & 4
  \end{array}\right)
  \rightsquigarrow
  \left(\begin{array}{rrr}
  1 & -1 & -2\\
0 & 0 & 0\\
0 &0 & 0
  \end{array}\right),
\]
and the eigenspace is~$E_{-2}=\{(s+2t,s,t): s,t\in\R\}$.  A basis
is~$\{(1,1,0),(2,0,1)\}$.  Applying Gram-Schmidt to these two vectors yields an
orthonormal basis for~$E_{-2}$ consisting of
\[
  v_{2}=\frac{1}{\sqrt{2}}(1,1,0),\quad v_{3}=\frac{1}{\sqrt{3}}(1,-1,1).
\]
Now note that something surprising has happened: these vectors are orthogonal
to~$v_{1}$.  We arrive at an orthonormal basis~$\{v_{1},v_{2},v_{3}\}$ for~$\R^{3}$ consisting of
eigenvectors for~$A$.  Letting $P$ be the $3\times 3$ matrix whose columns are
$v_{1},v_{2},v_{3}$, we have
\[
  P^{-1}AP=\diag(4,-2,2).
\]
Since the~$v_{i}$ form an orthonormal set, it turns out that~$P^{-1}=P^t$, the
transpose of~$P$:
\[
 P^{t}P =
  \left(\begin{array}{rrr}
  -\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{6}} & \frac{2}{\sqrt{6}}\\[5pt]
\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0\\[5pt]
\frac{1}{\sqrt{3}} &-\frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}}
  \end{array}\right)
  \left(\begin{array}{rrr}
  -\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{3}}\\[5pt]
\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{3}}\\[5pt]
\frac{2}{\sqrt{6}} &0& \frac{1}{\sqrt{3}}
  \end{array}\right)
  =
  \left(\begin{array}{ccc}
  1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
  \end{array}\right).
\]
\bigskip

\textbf{Definition.} A matrix~$P\in M_{n\times n}(\R)$ is \emph{orthogonal} if
its columns form an orthonormal set in~$\R^{n}$.
\medskip

\textbf{Lemma.} $P\in M_{n\times n}(\R)$ is orthogonal if and only
if~$P^{-1}=P^{t}$.
\bigskip

\begin{proof}
  Note that~$(P^{t}P)_{ij}=v_{i}\cdot v_{j}$.  So~$P^{t}P=I_n$ if and only if
  the columns of $P$ form and orthonormal set.
\end{proof}

\textbf{Restatement of the spectral theorem.} If~$A$ is a real~$n\times n$
symmetric matrix, then there exists a real diagonal matrix~$D$ and an
orthogonal matrix~$P$ such that
\[
  A = PDP^{t}.
\]

\begin{proof}[Proof of the spectral theorem]
 We first prove that the characteristic polynomial of~$A$ splits over~$\R$.  By
 the Fundamental Theorem of Algebra, it splits over~$\C$.
 So~$p_A(t)=\prod_{k=1}^{n}(\lambda_k-t)$ for some~$\lambda_{k}\in \C$.  We must
 show that~$\lambda_{k}\in\R$ for all~$k$.  So
 let~$\lambda=\lambda_{k}$ for some~$k$.  Then there exists a nonzero~$v\in\C^{n}$ such
 that~$Av=\lambda v$.  Recall the standard inner product on~$\C^{n}$:
 for~$y,z\in \C^{n}$, we have $\langle
 y,z\rangle=y\cdot\bar{z}$. Thinking of~$y$ and~$z$ as column vectors, we have
 $\langle y,z\rangle=z^{*}y$ where~$(\ )^{*}$ denotes the conjugate transpose:
\[
  \langle y,z\rangle = y\cdot \bar{z}
  =\sum_{k=1}^{n}y_{i}\bar{z}_{i}
  =
  \left(\begin{array}{lll}
  \bar{z}_{1} & \cdots & \bar{z}_{n}
  \end{array}\right)
  \left(\begin{array}{l}
  y_{1} \\
 \vdots\\
   y_{n}
  \end{array}\right)
  =z^{*}y.
\]
Therefore, for an arbitrary $n\times n$ complex matrix~$B$, we have
\[
  \langle y,B^{*}z\rangle
  = (B^{*}z)^{*}y
  = z^{*}(B^{*})^{*}y
  =z^{*}By
  =\langle By,z\rangle.
\]
Our matrix,~$A$, is real and symmetric; so~$A^{*}=\bar{A}^{t}=A^{t}=A$.
Therefore,
\[
  \langle y,Az\rangle = \langle Ay,z\rangle.
\]
Going back to $Av=\lambda v$, we have
\[
 \lambda\langle v,v\rangle
 = \langle\lambda v, v\rangle
 =\langle Av,v\rangle
 =\langle v, Av\rangle
 =\langle v,\lambda v\rangle
 =\bar{\lambda}\langle v,v\rangle.
\]
Since $v\neq 0$ and inner products are positive-definite, it follows
that~$\lambda=\bar{\lambda}$, and hence~$\lambda\in\R$.

We now prove the theorem by induction on~$n$, the case~$n=1$ being trivial.
Suppose~$n>1$ and let~$\lambda_1\in\R$ and~$v_1\in\R^n$ be an
eigenvalue-eigenvector pair for~$A$. Next, complete and apply Gram-Schmidt to
construct and ordered orthonormal basis~$\langle v_{1},\cdots,v_{n}\rangle$ for~$\R^{n}$.
Let~$Q$ be the~$n\times n$ matrix whose columns are the~$v_{i}$.  Then~$Q$ is
orthogonal.  Define
\[
  \tilde{A}:= Q^{-1}AQ=Q^{t}AQ.
\]
Then~$\tilde{A}$ is symmetric:
\[
  \tilde{A}^{t}=\left(Q^{t}AQ\right)^{t}=Q^{t}A^{t}\left(Q^{t}\right)^{t}
  =Q^{t}A^{t}Q=Q^{t}AQ=\tilde{A}.
\]
We would like to investigate the structure of~$\tilde{A}$ further.  To find its
first column, we use the fact that~$Av_{1}=\lambda_{1}v_{1}$.  Let~$e_{1}$ be
the first standard basis vector of~$\R^{n}$.  Then the first column
of~$\tilde{A}$ is
\[
  \tilde{A}e_1 = Q^{t}AQe_{1} =
  Q^{t}Av_{1}=Q^{t}\lambda_{1}v_{1}=\lambda_{1}Q^{t}v_{1}.
\]
The rows of~$Q^{t}$ are the orthonormal set~$v_{1},\ldots,v_{n}$.  Therefore,
\[
  (Q^{t}v_{1})_i = v_{i}\cdot v_{1} =
  \begin{cases}
    1&\text{if~$i=1$}\\
    0&\text{otherwise}.
  \end{cases}
\]
So the first column of~$\tilde{A}$ is the vector~$(\lambda_{1},0,\cdots,0)$.
Since~$\tilde{A}$ is symmetric, its first column and first row are the same
vector.  Therefore, $\tilde{A}$ has the form
\[
  \left(\begin{array}{c|ccc}
  \lambda_{1} & 0 & \cdots & 0 \\\hline
0 &  &  &  \\
\vdots&  & B  &  \\
0 &  &  & 
  \end{array}\right)
\]
where~$B$ is an $n\times n$ matrix.  Since~$\tilde{A}$ is symmetric, so is~$B$.
So we can apply induction to find an $(n-1)\times (n-1)$ orthogonal matrix~$T$
and a real diagonal matrix~$E$ such that~$B=TET^{t}$.  We then have
\[
\tilde{A} = 
\underbrace{\left(\begin{array}{c|ccc}
	       1 & 0 & \cdots & 0 \\\hline
	     0 &  &  &  \\
	     \vdots&  & T  &  \\
	     0 &  &  & 
	       \end{array}\right)}_{S}
 \underbrace{  \left(\begin{array}{c|ccc}
	       1 & 0 & \cdots & 0 \\\hline
	     0 &  &  &  \\
	     \vdots&  & E  &  \\
	     0 &  &  & 
	       \end{array}\right)}_{D}	
 \underbrace{  \left(\begin{array}{c|ccc}
	       1 & 0 & \cdots & 0 \\\hline
	     0 &  &  &  \\
	     \vdots&  & T^{t}  &  \\
	     0 &  &  & 
	       \end{array}\right)}_{S^t},
\]
where the matrices~$S$ and~$T$ are defined as shown.  Since~$T$ is orthogonal,
so is~$S$.  Finally, define $P=QS$.  Since~$Q$ and~$S$ are orthogonal, so is~$P$
(check: $(QS)^{t}(QS)=S^{t}(Q^{t}Q)S=S^{t}I_nS=I_n$). We have
\[
  A = Q\tilde{A}Q^{t}=Q(SDS^{t})Q^{t}=(QS)D(QS)^{t}=PDP^{t},
\]
as desired.
\end{proof}
\bigskip

We now discuss a more general version of the spectral theorem.
\medskip

\textbf{Definition.} A matrix~$A\in M_{n\times n}(\C)$ is \emph{Hermitian}
if~$A^{*}=A$ (so~$A=\bar{A}^{t}$). A matrix~$U\in M_{n\times n}(\C)$ is
\emph{unitary} if its columns are orthonormal, or equivalently, if~$U$ is
invertible with~$U^{-1}=U^{*}$.
\medskip

\textbf{Theorem} (Spectral theorem)  Let~$A$ be an $n\times n$ Hermitian matrix.
Then $A=UDU^{*}$ where $U$ is unitary and~$D$ is a real diagonal matrix.
\end{document}  
