$\newcommand{\eps}{\varepsilon} \newcommand{\kron}{\otimes} \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\trace}{trace} \DeclareMathOperator{\rank}{rank} \DeclareMathOperator*{\minimize}{minimize} \DeclareMathOperator*{\maximize}{maximize} \DeclareMathOperator{\subjectto}{subject to} \newcommand{\mat}[1]{\boldsymbol{#1}} \renewcommand{\vec}[1]{\boldsymbol{\mathrm{#1}}} \newcommand{\vecalt}[1]{\boldsymbol{#1}} \newcommand{\conj}[1]{\overline{#1}} \newcommand{\normof}[1]{\|#1\|} \newcommand{\onormof}[2]{\|#1\|_{#2}} \newcommand{\MIN}[2]{\begin{array}{ll} \minimize_{#1} & {#2} \end{array}} \newcommand{\MINone}[3]{\begin{array}{ll} \minimize_{#1} & {#2} \\ \subjectto & {#3} \end{array}} \newcommand{\MINthree}[5]{\begin{array}{ll} \minimize_{#1} & {#2} \\ \subjectto & {#3} \\ & {#4} \\ & {#5} \end{array}} \newcommand{\MAX}[2]{\begin{array}{ll} \maximize_{#1} & {#2} \end{array}} \newcommand{\MAXone}[3]{\begin{array}{ll} \maximize_{#1} & {#2} \\ \subjectto & {#3} \end{array}} \newcommand{\itr}[2]{#1^{(#2)}} \newcommand{\itn}[1]{^{(#1)}} \newcommand{\prob}{\mathbb{P}} \newcommand{\probof}[1]{\prob\left\{ #1 \right\}} \newcommand{\pmat}[1]{\begin{pmatrix} #1 \end{pmatrix}} \newcommand{\bmat}[1]{\begin{bmatrix} #1 \end{bmatrix}} \newcommand{\spmat}[1]{\left(\begin{smallmatrix} #1 \end{smallmatrix}\right)} \newcommand{\sbmat}[1]{\left[\begin{smallmatrix} #1 \end{smallmatrix}\right]} \newcommand{\RR}{\mathbb{R}} \newcommand{\CC}{\mathbb{C}} \newcommand{\eye}{\mat{I}} \newcommand{\mA}{\mat{A}} \newcommand{\mB}{\mat{B}} \newcommand{\mC}{\mat{C}} \newcommand{\mD}{\mat{D}} \newcommand{\mE}{\mat{E}} \newcommand{\mF}{\mat{F}} \newcommand{\mG}{\mat{G}} \newcommand{\mH}{\mat{H}} \newcommand{\mI}{\mat{I}} \newcommand{\mJ}{\mat{J}} \newcommand{\mK}{\mat{K}} \newcommand{\mL}{\mat{L}} \newcommand{\mM}{\mat{M}} \newcommand{\mN}{\mat{N}} \newcommand{\mO}{\mat{O}} \newcommand{\mP}{\mat{P}} \newcommand{\mQ}{\mat{Q}} \newcommand{\mR}{\mat{R}} \newcommand{\mS}{\mat{S}} \newcommand{\mT}{\mat{T}} \newcommand{\mU}{\mat{U}} \newcommand{\mV}{\mat{V}} \newcommand{\mW}{\mat{W}} \newcommand{\mX}{\mat{X}} \newcommand{\mY}{\mat{Y}} \newcommand{\mZ}{\mat{Z}} \newcommand{\mLambda}{\mat{\Lambda}} \newcommand{\mSigma}{\ensuremath{\mat{\Sigma}}} \newcommand{\mPbar}{\bar{\mP}} \newcommand{\ones}{\vec{e}} \newcommand{\va}{\vec{a}} \newcommand{\vb}{\vec{b}} \newcommand{\vc}{\vec{c}} \newcommand{\vd}{\vec{d}} \newcommand{\ve}{\vec{e}} \newcommand{\vf}{\vec{f}} \newcommand{\vg}{\vec{g}} \newcommand{\vh}{\vec{h}} \newcommand{\vi}{\vec{i}} \newcommand{\vj}{\vec{j}} \newcommand{\vk}{\vec{k}} \newcommand{\vl}{\vec{l}} \newcommand{\vm}{\vec{l}} \newcommand{\vn}{\vec{n}} \newcommand{\vo}{\vec{o}} \newcommand{\vp}{\vec{p}} \newcommand{\vq}{\vec{q}} \newcommand{\vr}{\vec{r}} \newcommand{\vs}{\vec{s}} \newcommand{\vt}{\vec{t}} \newcommand{\vu}{\vec{u}} \newcommand{\vv}{\vec{v}} \newcommand{\vw}{\vec{w}} \newcommand{\vx}{\vec{x}} \newcommand{\vy}{\vec{y}} \newcommand{\vz}{\vec{z}} \newcommand{\vpi}{\vecalt{\pi}} \newcommand{\vlambda}{\vecalt{\lambda}}$

# Common matrix structures

There are many common types of matrix and vector structure.

# Specific matrices and vectors

The $n \times n$ identity matrix is written: This matrix is rarely written with it's explicit dimension as that can almost always be inferred by context. That is to say, the dimension of the identity matrix is whatever it needs to be such that the matrix equation makes sense. For clarity, we might sometimes write: to denote the $n \times n$ matrix explicitly. Thus,

The identity matrix has the property that $\mA \mI = \mA$ for any matrix $\mA$. It's like multiplying by 1.

We denote the $i$th column of the identity matrix by $\ve_i$: th position }} \\ 0 \\ \vdots \\ 0}. For instance,

Using these vectors, we can write the $i$th column of any matrix as

It is, perhaps, alarming that $\ve_i$ is frequently used without specifying its dimension. However, just like the identity matrix above, it is almost always possible to work out the dimension. If we believe it is helpful to specify it, we'll use $\ve_i\itn{n}$.

Finally, the vector $\ve$ will be used to denote the vector of all ones: Except sometimes it will be used as an error vector for a problem.

Some people use the matrix $\mJ$ to represent the matrix of all ones: I don't think we'll need that in this class, however.

# Elemental structures

Throughout these examples, the matrix is $\mA$, and it's elements are $A_{i,j}$.

Diagonal We call a matrix diagonal if all of the non-zero entries are those $A_{i,j}$ where $i=j$, that is, on the "diagonal" of the matrix.

Examples $\mA = \bmat{1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & -1}.$ The identity matrix is another diagonal matrix.

Operationally We use the operator $\diag$ to extract the diagonal from a matrix. For instance, $\ve = \diag(\mI)$. This can also be used to "create" a matrix: $\mD = \diag(\vd)$ has $D_{i,i} = d_i$. So the diag operation gets a bit overloaded.

Triangular We call a matrix upper triangular if all of the non-zero entries are those $A_{i,j}$ where $j \ge i$. That is, if it looks like an upper triangle. A matrix is lower triangular if all of the non-zero entries are those $A_{i,j}$ where $i \ge j$. A matrix is triangular if it's either upper or lower triangular.

Examples $\mA = \bmat{1 & 2 & 3 \\ 0 & -2 & -3 \\ 0 & 0 & 1}$ is upper triangular. $\mA = \bmat{1 & 0 & 0 \\ -1 & 2 & 0 \\ 1 & 0 & 1}$ is lower triangular.

Operationally The operators triu and tril are sometimes used to denote the upper and lower triangular part of a matrix. They are implemented in Matlab, which is useful!

Symmetric We call a matrix symmetric if $A_{i,j} = A_{j,i}$ or equivalently, $\mA = \mA^T$.

Examples $\mA = \bmat{1 & 2 \\ 2 & 1}$.

Notes

• The generalization of symmetric to complex-valued matrices is called Hermitian. A matrix is Hermitian if $\mA = \mA^*$ for the complex adjoint or Hermitian operator, that is, $A_{i,j} = \conj{A_{j,i}}$ for the complex conjugate "bar".

• Any real-valued matrix $\mA$ can be written as: $\mA = \mS + \mK$ where $\mS$ is symmetric and $\mK$ is skew-symmetric. A matrix is skew-symmetric if $\mK = -\mK^T$. In this case, $\mS = (\mA + \mA^T)/2$ and $\mK = (\mA - \mA^T)/2$. If $\mA$ is symmetric, then $\mS = \mA$ and $\mK = 0$.

Orthogonal A matrix is orthogonal if $\mA^T \mA = \mI$. We'll get into why orthogonal matrices are special soon.

Examples The identity matrix $\mI$ is orthogonal. We'll see more about orthogonal matrices soon -- it's a very special structure!

Permutation A permutation matrix "shuffles" elements of a vector. Each column of a permutation matrix is a vector $\ve_i$ and a permutation matrix must also be orthogonal.

Examples $\mA = \bmat{0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0}$. This matrix expresses the permutation $2 \to 1, 3 \to 2, 1 \to 3$. We can see this by: $\mA \bmat{0.5 \\ -0.5 \\ 1} = \bmat{-0.5 \\ 1 \\ 0.5}$.

# Sparse matrices

Sparse matrices are those where the vast majority of the elements in the matrix are zero. For instance: Of the $9$ entries in the matrix, there are only two non-zeros. Later in the class, we'll see how to take advantage of this structure.