Announcements & Reminders
Quizzes
All grading is done for Quiz 1
Quiz 2 is next Monday, March 25 8:00 to 23:59, same setup
The midterm is scheduled at 18:30 to 19:45 (1 hour + 15 min reading time) on Monday, April 15 in Melville Hall
π Matrices and matrix arithmetic#
β± | words
Today we continue to get comfortable with the multidimensional space of real numbers \(\mathbb{R}^N\)
Main goal: learn and practice multidimensional differentiation
But first:
Refresh matrix operations (linear algebra)
Refresh definition of derivative and differentiability
Matrix#
Definition
A matrix is an array of numbers or variables which are organised into rows and columns
An \((n \times m)\) matrix takes the following form:
\(n\) and \(m\) are dimensions of the matrix A
An \((n \times m)\) matrix has \(n\) rows and \(m\) columns
Note that, while it is possible that \(n=m\), it is also possible that \(n \neq m\)
Definition
Matrix with has the same number of column as rows, \(n=m\), is called a square matrix.
Scalars and vectors#
Definition
A scalar is a real number \((a \in \mathbb{R})\)
Definition
A column vector is an \((n \times 1)\) matrix of the form
A row vector is a \((1 \times m)\) matrix of the form
Vectors can be thought of as matrixes with one dimension equal to \(1\)
Scalars can be thought of as \(1 \times 1\) matrixes
Matrix arithmetic#
Scalar multiplication of a matrix
Matrix addition
Matrix subtraction
Matrix multiplication: The inner, or dot, product
The transpose of a matrix and matrix symmetry
The additive inverse of a matrix and the null matrix
The multiplicative inverse of a matrix and the identity matrix
Note
Many binary operations with matrices are not commutative! (order of operands is important)
Let \(A\) is an \((n \times m)\) matrix takes the following form:
We will assume that \(a_{i j} \in \mathbb{R}\) for all
Scalar multiplication#
Suppose that \(c \in \mathbb{R}\). The scalar pre-product and post-product of this constant with this matrix is given by
Note that \(c A=A c\). As such, we can just talk about the scalar product of a constant with a matrix, without specifying the order in which the multiplication takes place.
Examples
Matrix addition#
The sum of two matrices is only defined if the two matrices have exactly the same dimensions.
Definition
Two matrixes are called conformable for a given operation if their dimensions are such that the operation is well defined.
Suppose that \(B\) is an \((n \times m)\) matrix that takes the following form:
The matrix sum \((A+B)\) is an \((n \times m)\) matrix that takes the following form:
Note matrix summation is also commutative, \(A+B=B+A\).
Exercise: Convince yourself in this fact.
Examples
Matrix subtraction#
Matrix subtraction involves a combination of (i) scalar multiplication of a matrix, and (ii) matrix addition.
As with matrix addition, the difference of two matrices is only defined if the two matrices have exactly the same dimensions.
Suppose that \(A\) and \(B\) are both \((n \times m)\) matrices. The difference between \(A\) and \(B\) is defined to be
In general, \(A-B \neq B-A\)
Example
Under what circumstances will \(A-B=B-A\) ?
Solution
We can work with matrices as variables in the equation!
Matrix multiplication#
The standard matrix product is the dot, or inner, product of two matrices.
The dot product of two matrices is only defined for cases in which the number of columns of the first listed matrix is identical to the number of rows of the second listed matrix.
If the dot product is defined, the solution matrix will have the same number of rows as the first listed matrix and the same number of columns as the second listed matrix.
Let \(B\) be an \((m \times p)\) matrix that takes the following form:
The matrix product \(A B\) is defined and will be an \((n \times p)\) matrix. The solution matrix is given by
Definition
A dot product of two vectors \(x = (x_1,\dots,x_N) \in \mathbb{R}^N\) and \(y = (y_1,\dots,y_N) \in \mathbb{R}^N\) is given by
Fact
Matrix multiplication is not commutative in general
Example
Note that \(A C \neq C A\).
Note
Do not confuse various names for the two types of matrix/vector multiplication:
Dot/scalar/inner product denoted with a dot \(\cdot\) is the sum of products of the vector coordinates, outputs a scalar
Vector/cross product denoted with a cross \(\times\) is a vector that is orthogonal to the two input vectors with a length equal to the area of the parallelogram spanned by the two input vectors (not covered in this course)
Matrix transposition#
Suppose that \(A\) is an \((n \times m)\) matrix. The transpose of the matrix \(A\), which is denoted by \(A^{T}\), is the \((m \times n)\) matrix that is formed by taking the rows of \(A\) and turning them into columns, without changing their order. In other words, the \(i\) th column of \(A^{T}\) is the ith row of \(A\). This also means that the jth row of \(A^{T}\) is the \(j\) th column of \(A\).
The transpose of the matrix \(A\) is the \((m \times n)\) matrix that takes the following form:
Examples
If \( x=\left(\begin{array}{l} 1 \\ 3 \\ 5 \end{array}\right) \) then \(X^{T}=(1,3,5)\).
If \( Y=\left(\begin{array}{ll} 2 & 3 \\ 5 & 9 \\ 7 & 6 \end{array}\right) \) then \( Y^{T}=\left(\begin{array}{lll} 2 & 5 & 7 \\ 3 & 9 & 6 \end{array}\right) \).
If \( Z=\left(\begin{array}{ccc} 1 & 3 & 7 \\ 4 & 5 & 11 \\ 6 & 8 & 10 \end{array}\right) \) then \( Z^{T}=\left(\begin{array}{ccc} 1 & 4 & 6 \\ 3 & 5 & 8 \\ 7 & 11 & 10 \end{array}\right) \).
In general, \(A^{T} \neq A\).
Definition
If matrix \(A\) is such that \(A^{T}=A\), we say that \(A\) is a symmetric matrix.
Example
\( A=\left(\begin{array}{ll} 0 & 0 \\ 0 & 0 \end{array}\right)=A^{T} \)
\( B=\left(\begin{array}{ll} 1 & 0 \\ 0 & 1 \end{array}\right)=B^{T} \)
\( C=\left(\begin{array}{ll} 0 & 1 \\ 1 & 0 \end{array}\right)=C^{T} \)
\( D=\left(\begin{array}{ll} 1 & 0 \\ 0 & 0 \end{array}\right)=D^{T} \)
Fact
If \(A\) and \(B\) are conformable for matrix multiplication, then
Null matrices#
Definition
A null matrix (or vector) is a matrix that consists solely of zeroes.
Example
For example, the \((3 \times 3)\) null matrix is
Fact
For an \((n \times m)\) null matrix and an \((n \times m)\) matrix \(A\), it holds \(A+0=0+A=A\).
Definition
Suppose that \(A\) is an \((n \times m)\) matrix and \(\mathbb{0}\) is the \((n \times m)\) null matrix. The \((n \times m)\) matrix \(B\) is called the additive inverse of \(A\) if and only if \(A+B=B+A=0\).
The additive inverse of \(A\) is
Fact
Identity matrices#
Definition
An identity matrix is a square matrix that has ones on the main (north-west to south-east) diagonal and zeros everywhere else.
Example
For example, the \((2 \times 2)\) identity matrix is
Fact
For an \((n \times n)\) identity matrix \(I\) it holds:
If \(A\) is an \((n \times n)\) matrix, then \(A I=I A=A\).
If \(A\) is an \((m \times n)\) matrix, then \(A I=A\).
If \(A\) is an \((n \times m)\) matrix, then \(I A=A\).
Definition
Let \(A\) be an \((n \times n)\) matrix and \(I\) be the \((n \times n)\) identity matrix. The \((n \times n)\) matrix \(B\) is the multiplicative inverse (usually just referred to as the inverse) of \(A\) if and only if \(A B=B A=I\).
Only square matrices have any chance of having a multiplicative inverse
Some, but not all, square matrices will have a multiplicative inverse
Definition
A square matrix that has an inverse is said to be non-singular.
A square matrix that does not have an inverse is said to be singular.
We will talk about methods for determining whether or not a matrix is non-singular later in this course
Fact
The transpose of the inverse is equal to the inverse of the transpose
If \(A\) is a non-singular square matrix whose multiplicative inverse is \(A^{-1}\), then we have
Example
Note that
Note that
Since \(A B=B A=I\), we can conclude that \(A^{-1}=B\).
[HaeusslerΒ Jr and Paul, 1987] (p. 278, Example 1)
References and further reading#
References
[Simon and Blume, 1994]: Chapter 8