latex.matrix_delimiters(left='[', right=']')
latex.matrix_column_alignment('r')
$\newcommand{\la}{\langle}$ $\newcommand{\ra}{\rangle}$ $\newcommand{\vu}{\mathbf{u}}$ $\newcommand{\vv}{\mathbf{v}}$ $\newcommand{\vw}{\mathbf{w}}$ $\newcommand{\vzz}{\mathbf{z}}$ $\newcommand{\nc}{\newcommand}$ $\nc{\Cc}{\mathbb{C}}$ $\nc{\Rr}{\mathbb{R}}$ $\nc{\Qq}{\mathbb{Q}}$ $\nc{\Nn}{\mathbb{N}}$ $\nc{\cB}{\mathcal{B}}$ $\nc{\cE}{\mathcal{E}}$ $\nc{\cC}{\mathcal{C}}$ $\nc{\cD}{\mathcal{D}}$ $\nc{\mi}{\mathbf{i}}$ $\nc{\span}[1]{\langle #1 \rangle}$ $\nc{\ol}[1]{\overline{#1} }$ $\nc{\norm}[1]{\left\| #1 \right\|}$ $\nc{\abs}[1]{\left| #1 \right|}$ $\nc{\vz}{\mathbf{0}}$ $\nc{\vo}{\mathbf{1}}$ $\nc{\DMO}{\DeclareMathOperator}$ $\DMO{\tr}{tr}$ $\DMO{\nullsp}{nullsp}$ $\nc{\va}{\mathbf{a}}$ $\nc{\vb}{\mathbf{b}}$ $\nc{\vx}{\mathbf{x}}$ $\nc{\ve}{\mathbf{e}}$ $\nc{\vd}{\mathbf{d}}$ $\nc{\ds}{\displaystyle}$ $\nc{\bm}[1]{\begin{bmatrix} #1 \end{bmatrix}}$ $\nc{\gm}[2]{\bm{\mid & \cdots & \mid \\ #1 & \cdots & #2 \\ \mid & \cdots & \mid}}$ $\nc{\MN}{M_{m \times n}(K)}$ $\nc{\NM}{M_{n \times m}(K)}$ $\nc{\NP}{M_{n \times p}(K)}$ $\nc{\MP}{M_{m \times p}{K}}$ $\nc{\im}{\mathrm{Im\ }}$ $\nc{\ev}{\mathrm{ev}}$ $\nc{\Hom}{\mathrm{Hom}}$ $\nc{\com}[1]{[\phantom{a}]^{#1}}$ $\nc{\rBD}[1]{ [#1]_{\cB}^{\cD}}$ $\DMO{\id}{id}$ $\DMO{\rk}{rk}$ $\DMO{\nullity}{nullity}$ $\DMO{\End}{End}$ $\DMO{\proj}{proj}$ $\nc{\GL}{\mathrm{GL}}$
Matrices¶
Throughout this set of notes, $K$ denotes a field. The real numbers $\Rr$, the complex numbers $\Cc$ with their usual addition and multiplication are example of fields. There are times that properties other than those of a field are required. In those cases, we will specify them.
An matrix over $K$ is an array of the form $$ A = \begin{bmatrix} a_{11} &\cdots &a_{1n} \\ \vdots &\vdots &\vdots \\ a_{m1} &\cdots &a_{mn} \end{bmatrix} $$
with $m,n\ge 1$ and $a_{ij} \in K$ ($1 \le i \le m, 1 \le j \le n$)
Let $[n]$ denotes the set $\{1, \dots, n\}$.
More formally, for integer $m,n \ge 1$ an $m \times n$ matrix $A$ over $K$ is a function $A$ from $[m] \times [n]$ to $K$.
The value of $A$ at $(i,j)$ is its $(i,j)$-entry denoted by $a_{ij}$ or $(A)_{ij}$.
The $i$-th row of $A$, denoted by $(A)^i_*$ (or $\va^i$), is $\bm{a_{i1} & \cdots & a_{in}}$.
The $j$-th column of $A$, denoted by $(A)^*_j$ (or $\va_j$) is $\bm{a_{1j} \\ \vdots \\ a_{mj}}$.
The shape of $A$ is its index set, i.e. $[m] \times [n]$.
The set of all $m \times n$ matrix over $K$ is denoted by $\MN$.
Example $A = \left[\begin{array}{rrrr} 1 & 0 & 3 & 1 \\ -1 & 1 & -1 & 0 \\ -1 & 1 & 2 & 0 \end{array}\right]$ is a $3 \times 4$ matrix over $\Qq$ (or any field that contains $\Qq$). $a_{21} = -1$ and $a_{33} = 2$.
$B = \left[\begin{array}{cc} -2 & 0 \\ 1 & \mi-1 \\ 1+2\mi & -1 \\ 3 & 1 \end{array}\right]$ is a $4 \times 2$ matrix over $\Cc$.
Checkpoint What are $b_{31}$ and $b_{12}$?
%display latex
LA = [ (1,0,3,1), (-1,1,-1,0), (-1, 1, 2, 0)]
LB = [ (-2,0),(1,i-1),(1+2*i,-1),(3,1)]
A = matrix(LA); B = matrix(LB);
(A,B)
Note that in SAGE (or Python) the indices start with 0. So,
A[1,0], A[2,2], B[2,0], B[0,1] #these are the entries that we mentioned.
A column matrix (resp, a row matrix) is a matrix with only one column (resp, one row). We often identify $K^n$ with $M_{n \times 1}(K)$ via
$$ (v_1, \ldots, v_n) \leftrightarrow \bm{v_1 \\ \vdots \\ v_n} $$
or with $M_{1\times n}(K)$ via
$$ (v_1, \ldots, v_n) \leftrightarrow \bm{v_1 & \cdots & v_n} $$ We refer to the elements of $K^n$ as column vectors in the first case and as row vectors in the second case. And called the elements of $K^1 =K$ scalars.
Transpose¶
Taking the transpose of a matrix is perhaps that most fundamental operation on matrices:
The transpose of $A \in \MN$ is the $n \times m$ matrix $A^T \in \NM$ so that $(A^T)_{ij} = A_{ji}$.
Intuitively, $A^T$ is the matrix obtained from $A$ by swapping its rows and columns. Certainly, $(A^T)^T = A$.
Example The transpose of $A$ in the previous example is
A, A.transpose() #compare them side by side
Later on we will see that $A^T$ represents the dual of the operator that $A$ represents.
Right now, we can simply take it as an equalizer between rows and columns: anything that we do with the columns has a dual version with the rows.
Checkpoint Find the transpose of the matrix $B$ from the previous example.