# 08. Other operations

## 08. Other operations

In this video, we'll define some further operations you can do to produce new matrices. The first is matrix addition If we have two $m$ -by-$n$ matrices $A$ and $B$ with entries $A_{ij}$ and $B_{ij}$ , we can form a new matrix $A+B$ with $(A+B)_{ij}=A_{ij}+B_{ij}.$ In other words, you take the $ij$ th entries of both matrices and add them.

$\begin{pmatrix}1&0\\ 1&1\end{pmatrix}+\begin{pmatrix}1&1\\ 0&-1\end{pmatrix}=\begin{pmatrix}2&1\\ 1&0\end{pmatrix}.$

This is most useful when $A$ and $B$ are both column vectors, i.e. $m$ -by-$1$ matrices. Let's see what it means in for vectors in $\mathbf{R}^{2}$ . The formula is $\begin{pmatrix}x\\ y\end{pmatrix}+\begin{pmatrix}a\\ b\end{pmatrix}=\begin{pmatrix}x+a\\ y+b\end{pmatrix}.$

Geometrically, we add two vectors $v=\begin{pmatrix}x\\ y\end{pmatrix}$ and $w=\begin{pmatrix}a\\ b\end{pmatrix}$ by translating $w$ to the tip of $v$ and drawing the arrow from the tail of $v$ to the tip of $w$ . One can see from the picture that the $x$ - (respectively $y$ -) coordinate of this arrow is the sum of the $x$ - (respectively $y$ -) coordinates of $v$ and $w$ .

### Rescaling

Given a number $\lambda$ and a matrix $A$ , you can form the matrix $\lambda A$ whose entries are $\lambda$ times the entries of $A$ .

$2\begin{pmatrix}1&2\\ 3&4\end{pmatrix}=\begin{pmatrix}2&4\\ 6&8\end{pmatrix}$ .

### Matrix exponentiation

The exponential of a number $x$ is defined by the Taylor series of $\exp$ : $\exp(x)=1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\cdots=\sum_{n=0}^{\infty}\frac{% x^{n}}{n!}$ We can use the same definition to define the exponential of a matrix: $\exp(M)=\sum_{n=0}^{\infty}\frac{1}{n!}M^{n}.$ Here, $M^{0}$ is understood to mean the identity matrix $I$ (the analogue for matrices of the number $1$ ).

Consider $M=\begin{pmatrix}0&1\\ 0&0\end{pmatrix}$ . Since $M^{2}=0$ , all the higher powers of $M$ vanish (the name for this is nilpotence: some power of $M$ is zero), so the matrix exponential becomes $\exp(M)=I+M=\begin{pmatrix}1&1\\ 0&1\end{pmatrix}.$ So we get the matrix for a shear as the exponential of a nilpotent matrix.

In fact, $\exp\begin{pmatrix}0&t\\ 0&0\end{pmatrix}=\begin{pmatrix}1&t\\ 0&1\end{pmatrix},$ so we get a whole family of matrices which shear further and further to the right as $t$ varies.

Take $M=\begin{pmatrix}0&-t\\ t&0\end{pmatrix}$ . We have $M=t\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ $M^{2}=\begin{pmatrix}-t^{2}&0\\ 0&-t^{2}\end{pmatrix}=-t^{2}I$ $M^{3}=-t^{3}\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ $M^{4}=t^{4}I$ etc.

and in the end we get $\exp(M)=I+t\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ $-\frac{t^{2}}{2!}I-\frac{t^{3}}{3!}\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ $+\frac{t^{4}}{4!}I+\frac{t^{5}}{5!}\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ etc. The coefficient of $I$ is the Taylor series for $\cos t$ ; the coefficent of $\begin{pmatrix}0&-1\\ 1&0\end{pmatrix}$ is the Taylor series for $\sin t$ , so overall we get $\exp(M)=\begin{pmatrix}\cos t&-\sin t\\ \sin t&\cos t\end{pmatrix}.$ So we get a general rotation matrix in 2-d by exponentiating this very simple matrix.