Notes on Matrices and Matrix Transformations

Comp.145  October 1996  Dr. A.J. Mestel

(1) A matrix is a rectangular array of numbers (called elements) arranged in rows and columns.

A = ( \begin{matrix}a_{11} & a_{12} & … & a_{1n} \\ a_{21} & a_{22} & … & a_{2n} \\ ⋮ & ⋮ & ... & ⋮ \\ a_{m1} & a_{m2} & … & a_{mn} \end{matrix} ) (A)_{ij} = a_{ij}

Two matrices are equal if and only if all their elements are equal.

(2) The dimensions or order of a matrix are specified by the numbers of rows and columns.

m × n − as above: m rows and n columns
n × n − square matrix
1 × n − row vector
n × 1 − column vector.

(3) The Transpose A^{T} of a matrix A is defined by interchanging the rows and columns, i.e.

(A^{T})_{ij} = a_{ji}

A (square) matrix is symmetric if A = A^{T}, or anti-symmetric if A = −A^{T}. The transpose of a column vector is a row vector and vice versa. For any matrix, (A^{T})^{T} = A.

(4) Two matrices may be added or subtracted provided they are both of the same dimensions.

E = A + B  e_{ij} = a_{ij} + b_{ij}  for all i and j .

Subtraction is similar. A − A = O, the zero matrix, all of whose elements are zero. To multiply a matrix by a scalar, multiply each element a_{ij} by it in turn. So (λA)_{ij} = λa_{ij}.

(5) Two matrices can be multiplied if and only if the number of columns of the first matrix is equal to the number of rows of the second matrix. If A is m × n and B is n × p then

F = AB  where  f_{ij} = ∑_{k=1}^{n} a_{ik}b_{kj} .

The (ij)th element of F is the dot product of the vectors consisting of the (i)th row of A and the (j)th column of B. The product matrix F has dimensions m × p.

(6) The order of writing the matrices to be multiplied can not be changed in general. However, the order in which two or more multiplications are performed can be. Thus

AB ≠ BA,  but  A(BC) = (AB)C .

The jargon for this: Matrix multiplication is associative but not commutative.

(7) The transpose of a matrix product is the product of the transposes in reverse order.

(ABC …)^{T} = … C^{T} B^{T} A^{T} .

Thus post-multiplying a row vector \underline{p}^{T} by a matrix A has the same effect as premultiplying the column vector \underline{p} by the matrix A^{T}, as (A^{T} \underline{p})^{T} = \underline{p}^{T} (A^{T})^{T} = \underline{p}^{T} A.

(8) An n × n matrix can be thought of as transforming an n-vector into another nvector. We can classify 3 × 3 matrices according to their effects on a position row vector \underline{p}^{T} = (x, y, z) according to the transformation \underline{q}^{T} = \underline{p}^{T} A .

(9) The identity matrix, I, leaves the vector \underline{p}^{T} unchanged,

\underline{q}^{T} = \underline{p}^{T} I = \underline{p}^{T}  where  I = ( \begin{matrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix} ) .

(10) A scaling matrix stretches the components of the vector by various factors in the different directions. Thus, for example, when a > 0 the x-component alone is scaled by

S_{x}(a) = ( \begin{matrix}a & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{matrix} )  so that  \underline{q}^{T} = \underline{p}^{T} S_{x} = (ax, y, z) .

If a = 0, S_{x}(0) is a projection onto the y-z plane. S_{x}(−1) is a reflection in that plane.

(11) A rotation matrix leaves the modulus of \underline{p}^{T} unchanged, but alters its direction. For example, the matrix

R_{z}(θ) = ( \begin{matrix}cos θ & sin θ & 0 \\ − sin θ & cos θ & 0 \\ 0 & 0 & 1 \end{matrix} )

corresponds to a rotation about the z-axis through an angle θ. Matrices R_{x}, R_{y} for rotations about the x and y axes can be found by symmetry. Rotation through θ about a general axis with unit vector k̂ = (k_{1}, k_{2}, k_{3}) is performed by the (horrible) matrix

( \begin{matrix}k_{1}^{2}(1 − cos θ) + cos θ & k_{1}k_{2}(1 − cos θ) + k_{3} sin θ & k_{1}k_{3}(1 − cos θ) − k_{2} sin θ \\ k_{1}k_{2}(1 − cos θ) − k_{3} sin θ & k_{2}^{2}(1 − cos θ) + cos θ & k_{2}k_{3}(1 − cos θ) + k_{1} sin θ \\ k_{1}k_{3}(1 − cos θ) + k_{2} sin θ & k_{2}k_{3}(1 − cos θ) − k_{1} sin θ & k_{3}^{2}(1 − cos θ) + cos θ \end{matrix} ) .

Rather than deal with such matrices directly, it is usually easier to regard a general rotation as a sequence of rotations about the x, y and z axes, so that the associated matrix is a suitable product of R_{x}, R_{y}, R_{z}. Any rotation can be so represented.

(12) The product of any two rotation matrices is another rotation matrix. The order in which the rotations is performed must not be changed.

R_{x}(θ)R_{y}(ϕ) ≠ R_{y}(ϕ)R_{x}(θ) although R_{x}(θ)R_{x}(ϕ) = R_{x}(ϕ)R_{x}(θ) = R_{x}(θ + ϕ) .

We note that R_{z}(θ)R_{z}(−θ) = R_{z}(0) = I, the inverse rotation cancelling the effect of the first. All combinations of rotations, scalings and reflections are invertible, but projections are not.