6.4 Basic matrix arthimetic

Some basic rules, for suitably-sized matrices \(A\) and \(B\):

  • \(A + B = B + A\).
  • \(c A\) for some constant \(c\) multiplies every element of matrix \(A\) by \(c\).
  • \(A B \ne B A\) in general.
  • \((A B)^T = B^T A^T\).
  • \((A B)^{-1} = B^{-1} A^{-1}\).
  • \(I A = A I = A\) for a suitably-sized identity matrix \(I\).
  • If \(A\) is symmetric, then \(A^{-1}\) (if it exists) is also symmetric.

Two specific cases sometimes come in handy. Consider a vector \(\textbf{y}\) of length \(n\) (a matrix of size \(n\times 1\)): \[ \textbf{y} = \left[ \begin{array}{c} y_1\\ y_2\\ y_3\\ \vdots\\ y_n \end{array} \right]. \] Then multiplying \(\textbf{y}^T\) by \(\textbf{y}\) produces a \(1\times 1\) vector (a scalar): \[ \begin{aligned} \textbf{y}^T\textbf{y} &= \left[ \begin{array}{ccccc} y_1\quad& y_2\quad& y_3\quad& \cdots\quad& y_n \end{array} \right] \times \left[ \begin{array}{c} y_1\\ y_2\\ y_3\\ \vdots\\ y_n \end{array} \right]\\ &= y_1^2 + y_2^2 + \cdots + y_n^2 = \sum_{i=1}^n y_i. \end{aligned} \] Also, \[ \begin{aligned} \textbf{y}\textbf{y}^T &= \left[ \begin{array}{c} y_1\\ y_2\\ y_3\\ \vdots\\ y_n \end{array} \right] \times \left[ \begin{array}{ccccc} y_1\quad& y_2\quad& y_3\quad& \cdots\quad& y_n \end{array} \right]\\ &= \left[ \begin{array}{cccc} y_1^2 & y_1 y_2 & \dots & y_1 y_n \\ y_2 y_1 & y_2^2 & \dots & y_2 y_n\\ \vdots & \vdots & \ddots & \vdots\\ y_n y_1 & y_n y_2 & \dots & y_n^2 \end{array} \right]. \end{aligned} \]