The \(m\times n\) matrices \(A\) and \(B\) are equal, written \(A=B\) provided \(\matrixentry{A}{ij}=\matrixentry{B}{ij}\) for all \(1\leq i\leq m\text{,}\)\(1\leq j\leq n\text{.}\)
So equality of matrices translates to the equality of complex numbers, on an entry-by-entry basis. Notice that we now have yet another definition that uses the symbol “=” for shorthand. Whenever a theorem has a conclusion saying two matrices are equal (think about your objects), we will consider appealing to this definition as a way of formulating the top-level structure of the proof.
We will now define two operations on the set \(M_{mn}\text{.}\) Again, we will overload a symbol (‘+’) and a convention (juxtaposition for scalar multiplication).
Given the \(m\times n\) matrices \(A\) and \(B\text{,}\) define the sum of \(A\) and \(B\) as an \(m\times n\) matrix, written \(A+B\text{,}\) by \(\matrixentry{A+B}{ij}=\matrixentry{A}{ij}+\matrixentry{B}{ij}\text{,}\) for \(1\leq i\leq m,\,1\leq j\leq n\text{.}\)
So matrix addition takes two matrices of the same size and combines them (in a natural way!) to create a new matrix of the same size. Perhaps this is the “obvious” thing to do, but it does not relieve us from the obligation to state it carefully.
Our second operation takes two objects of different types, specifically a number and a matrix, and combines them to create another matrix. As with vectors, in this context we call a number a scalar in order to emphasize that it is not a matrix.
Given the \(m\times n\) matrix \(A\) and the scalar \(\alpha\in\complexes\text{,}\) the scalar multiple of \(A\) is the \(m\times n\) matrix, written \(\alpha A\text{,}\) and defined by \(\matrixentry{\alpha A}{ij}=\alpha\matrixentry{A}{ij}\text{,}\) for \(1\leq i\leq m,\,1\leq j\leq n\text{.}\)
Notice again that we have yet another kind of multiplication, and it is again written putting two symbols side-by-side. Computationally, scalar matrix multiplication is very easy.
Sage defines our set \(M_{mn}\) as a “matrix space” with the command MatrixSpace(R, m, n) where R is a number system and m and n are the number of rows and number of columns, respectively. This object does not have much functionality defined in Sage. Its main purposes are to provide a parent for matrices, and to provide another way to create matrices. The two matrix operations just defined (addition and scalar multiplication) are implemented as you would expect. In the example below, we create two matrices in \(M_{23}\) from just a list of 6 entries, by coercing the list into a matrix by using the relevant matrix space as if it were a function. Then we can perform the basic operations of matrix addition (Definition MA) and matrix scalar multiplication (Definition MSM).
Coercion can make some interesting conveniences possible. Notice how the scalar 37 in the following expression is coerced to \(37\) times an identity matrix of the proper size.
This coercion only applies to sums with square matrices. You might try this again, but with a rectangular matrix, just to see what the error message says.
With definitions of matrix addition and scalar multiplication we can now state, and prove, several properties of each operation, and some properties that involve their interplay. We now collect ten of them here for later reference.
Suppose that \(M_{mn}\) is the set of all \(m\times n\) matrices (Definition VSM) with addition and scalar multiplication as defined in Definition MA and Definition MSM. Then
While some of these properties seem very obvious, they all require proof. However, the proofs are not very interesting, and border on tedious. We will prove one version of distributivity very carefully, and you can test your proof-building skills on some of the others. We will give our new notation for matrix entries a workout here. Compare the style of the proofs here with those given for vectors in Theorem VSPCV — while the objects here are more complicated, our notation makes the proofs cleaner.
To prove Property DSAM, \((\alpha+\beta)A=\alpha A+\beta A\text{,}\) we need to establish the equality of two matrices (see Proof Technique GS). Definition ME says we need to establish the equality of their entries, one-by-one. How do we do this, when we do not even know how many entries the two matrices might have? This is where the notation for matrix entries, given in Definition M, comes into play. Ready? Here we go.
There are several things to notice here. (1) Each equals sign is an equality of scalars (numbers). (2) The two ends of the equation, being true for any \(i\) and \(j\text{,}\) allow us to conclude the equality of the matrices by Definition ME. (3) There are several plus signs, and several instances of juxtaposition. Identify each one, and state exactly what operation is being represented by each.
The \(m\times n\) zero matrix is written as \(\zeromatrix=\zeromatrix_{m\times n}\) and defined by \(\matrixentry{\zeromatrix}{ij}=0\text{,}\) for all \(1\leq i\leq m\text{,}\)\(1\leq j\leq n\text{.}\)
We describe one more common operation we can perform on matrices. Informally, to transpose a matrix is to build a new matrix by swapping its rows and columns.
Given an \(m\times n\) matrix \(A\text{,}\) its transpose is the \(n\times m\) matrix \(\transpose{A}\) given by \(\matrixentry{\transpose{A}}{ij}=\matrixentry{A}{ji}\text{,}\) for \(1\leq i\leq n,\,1\leq j\leq m\text{.}\)
We could formulate the transpose, entry-by-entry, using the definition. But it is easier to just systematically rewrite rows as columns (or vice-versa). The form of the definition given will be more useful in proofs. So for the \(3\times 4\) matrix \(D\) we have
It will sometimes happen that a matrix is equal to its transpose. In this case, we will call a matrix symmetric. These matrices occur naturally in certain situations, and also have some nice properties, so it is worth stating the definition carefully. Informally a matrix is symmetric if we can “flip” it about the main diagonal (upper-left corner, running down to the lower-right corner) and have it look unchanged.
You might have noticed that Definition SYM did not specify the size of the matrix \(A\text{,}\) as has been our custom. That is because it was not necessary. An alternative would have been to state the definition just for square matrices, but this is the substance of the next proof.
Before reading the next proof, we want to offer you some advice about how to become more proficient at constructing proofs. Perhaps you can apply this advice to the next theorem. Have a peek at Proof Technique P now.
We start by specifying \(A\)’s size, without assuming it is square, since we are trying to prove that, so we cannot also assume it. Suppose \(A\) is an \(m\times n\) matrix. Because \(A\) is symmetric, we know by Definition SYM that \(A=\transpose{A}\text{.}\) So, in particular, Definition ME requires that \(A\) and \(\transpose{A}\) must have the same size. The size of \(\transpose{A}\) is \(n\times m\text{.}\) Because \(A\) has \(m\) rows and \(\transpose{A}\) has \(n\) rows, we conclude that \(m=n\text{,}\) and hence \(A\) must be square by Definition SQM.
We finish this section with three easy theorems, but they illustrate the interplay of our three new operations, our new notation, and the techniques used to prove matrix equalities.
The statement to be proved is an equality of matrices, so we work entry-by-entry and use Definition ME. Think carefully about the objects involved here, and the many uses of the plus sign. Realize too that while \(A\) and \(B\) are \(m\times n\) matrices, the conclusion is a statement about the equality of two \(n\times m\) matrices! So we begin with a preparation for Definition ME. For \(1\leq i\leq n\text{,}\)\(1\leq j\leq m\text{,}\)
The statement to be proved is an equality of matrices, so we work entry-by-entry and use Definition ME. Notice that the desired equality is of \(n\times m\) matrices, and think carefully about the objects involved here, plus the many uses of juxtaposition. For \(1\leq i\leq m\text{,}\)\(1\leq j\leq n\text{,}\)
We again want to prove an equality of matrices, so we work entry-by-entry and use Definition ME. For \(1\leq i\leq m\text{,}\)\(1\leq j\leq n\text{,}\)
So an upper triangular matrix has all its entries “below” the diagonal equal to zero, and a lower triangular matrix has all its entries “above” the diagonal equal to zero.
For each column, its entry on the diagonal is nonzero, so we can form its reciprocal (Property MICN) and use this as the multiple for a row operation of the second type (Definition RO) to form a row-equivalent matrix that replaces the entry by a \(1\text{.}\) The entry, along with repeated row operations of the third type, will form a row-equivalent matrix where the column is a pivot column. So the matrix is row-equivalent to a square matrix where every column is a pivot column; in other words, the identity matrix (Definition IM). By Theorem NMRRI we see that \(A\) is nonsingular.
We will establish the contrapositive (Proof Technique CP): if there is a zero diagonal entry then the matrix is singular. Suppose that the entry in row \(k\) and column \(k\) is zero. Then the first \(k\) columns of \(A\) are each vectors with \(k-1\) arbitrary entries, followed by \(n-k+1\) zeros. These \(k\) column vectors are a linearly independent set, which can be established with a nontrivial relation of linear dependence obtained by an argument entirely similar to the proof of Theorem MVSLD. The one change is that the relevant coefficient matrix would be a \(k-1\times k\) matrix formed from the first \(k\) columns and first \(k-1\) rows of \(A\text{.}\) With linearly dependent columns, Theorem NMLIC says \(A\) is singular.
ExampleNSTM.Nonsingular and singular triangular matrices.
We can now see immediately with Theorem NTM that the matrix \(U\) of Example ULTM is singular, and the matrix \(L\) of Example ULTM is nonsingular. Indeed, these two matrices could be very helpful as you study the proof of Theorem NTM.
Suppose \(A\) is an \(m\times n\) matrix. Then the conjugate of \(A\text{,}\) written \(\conjugate{A}\) is an \(m\times n\) matrix defined by \(\matrixentry{\conjugate{A}}{ij}=\conjugate{\matrixentry{A}{ij}}\) for \(1\leq i\leq m\text{,}\)\(1\leq j\leq n\text{.}\)
Since the matrices \(\conjugate{A+B}\) and \(\conjugate{A}+\conjugate{B}\) are equal in each entry, Definition ME says that \(\conjugate{A+B}=\conjugate{A}+\conjugate{B}\text{.}\)
Since the matrices \(\conjugate{\alpha A}\) and \(\conjugate{\alpha}\conjugate{A}\) are equal in each entry, Definition ME says that \(\conjugate{\alpha A}=\conjugate{\alpha}\conjugate{A}\text{.}\)
Since the matrices \(\conjugate{\left(\conjugate{A}\right)}\) and \(A\) are equal in each entry, Definition ME says that \(\conjugate{\left(\conjugate{A}\right)}=A\text{.}\)
Since the matrices \(\conjugate{\left(\transpose{A}\right)}\) and \(\transpose{\left(\conjugate{A}\right)}\) are equal in each entry, Definition ME says that \(\conjugate{\left(\transpose{A}\right)}=\transpose{\left(\conjugate{A}\right)}\text{.}\)
The combination of transposing and conjugating a matrix will be important in subsequent sections, such as Subsection MINM.UM and Section OD. We make a key definition here and prove some basic results in the same spirit as those above.
You will see the adjoint written elsewhere variously as \(A^H\text{,}\)\(A^\ast\) or \(A^\dagger\text{.}\) Notice that Theorem MCT says it does not really matter if we conjugate and then transpose, or transpose and then conjugate.
Take note of how the theorems in this section, while simple, build on earlier theorems and definitions and never descend to the level of entry-by-entry proofs based on Definition ME. In other words, the equal signs that appear in the previous proofs are equalities of matrices, not scalars (which is the opposite of a proof like that of Theorem TMA).
Every operation in this section is implemented in Sage. The only real subtlety is determining if certain matrices are symmetric, which we will discuss below. In linear algebra, the term “adjoint” has two unrelated meanings, so you need to be careful when you see this term. In particular, in Sage it is used to mean something different. So our version of the adjoint is implemented as the matrix method .conjugate_transpose(). Here are some straightforward examples.
With these constructions, we can test, or demonstrate, some of the theorems above. Of course, this does not make the theorems true, but is satisfying nonetheless. This can be an effective technique when you are learning new Sage commands or new linear algebra — if your computations are not consistent with theorems, then your understanding of the linear algebra may be flawed, or your understanding of Sage may be flawed, or Sage may have a bug! Note in the following how we use comparison (==) between matrices as the implementation of matrix equality (Definition ME).
Here is the subtlety. With approximate numbers, such as in RDF and CDF, it can be tricky to decide if two numbers are equal, or if a very small number is zero or not. In these situations Sage allows us to specify a “tolerance” — the largest number that can be effectively considered zero. Consider the following:
Clearly the last result is not correct. This is because \(0.000000000001 = 1.0\times 10^{-12}\) is “small enough” to be confused as equal to the zero in the other corner of the matrix. However, Sage will let us set our own idea of when two numbers are equal, by setting a tolerance on the difference between two numbers that will allow them to be considered equal. The default tolerance is set at \(1.0\times 10^{-12}\text{.}\) Here we use Sage’s syntax for scientific notation to specify the tolerance.
This is not a course in numerical linear algebra, even if that is a fascinating field of study. To concentrate on the main ideas of introductory linear algebra, whenever possible we will concentrate on number systems like the rational numbers or algebraic numbers where we can rely on exact results. If you are ever unsure if a number system is exact or not, just ask.
Solving each of these equations, we see that the first three and the fifth all lead to the solution \(\alpha = 2\text{,}\) the fourth equation is true no matter what the value of \(\alpha\text{,}\) but the last equation is only solved by \(\alpha = 7/4\text{.}\) Thus, the system has no solution, and the original matrix equation also has no solution.
In Chapter V we defined the operations of vector addition and vector scalar multiplication in Definition CVA and Definition CVSM. These two operations formed the underpinnings of the remainder of the chapter. We have now defined similar operations for matrices in Definition MA and Definition MSM. You will have noticed the resulting similarities between Theorem VSPCV and Theorem VSPM.
In Exercises M20–M25, you will be asked to extend these similarities to other fundamental definitions and concepts we first saw in Chapter V. This sequence of problems was suggested by Martin Jackson.
Suppose \(S=\set{B_1,\,B_2,\,B_3,\,\ldots,\,B_p}\) is a set of matrices from \(M_{mn}\text{.}\) Formulate appropriate definitions for the following terms and give an example of the use of each.
The only solution is then \(\alpha = 0\text{,}\)\(\beta = 0\text{,}\)\(\gamma = 0\text{,}\) and \(\delta = 0\text{,}\) so that the set \(S\) is a linearly independent set of matrices.
By row-reducing the associated \(6\times 5\) homogeneous system, we see that the only solution is \(a_1 = a_2 = a_3 = a_4 = a_5 = 0\text{,}\) so these matrices are a linearly independent subset of \(M_{23}\text{.}\)
Determine if the matrix \(A\) is in the span of \(S\text{.}\) In other words, is \(A\in\spn{S}\text{?}\) If so write \(A\) as a linear combination of the elements of \(S\text{.}\)
Note that if we were to write a complete linear combination of all of the matrices in \(S\text{,}\) then the fourth matrix would have a zero coefficient.
Suppose \(Y\) is the set of all \(3\times 3\) symmetric matrices (Definition SYM). Find a set \(T\) so that \(T\) is linearly independent and \(\spn{T}=Y\text{.}\)
Prove that a skew-symmetric matrix must have zeros for its diagonal elements. In other words, if \(A\) is skew-symmetric of size \(n\text{,}\) then \(\matrixentry{A}{ii}=0\) for \(1\leq i\leq n\text{.}\) (Hint: carefully construct an example of a \(3\times 3\) skew-symmetric matrix before attempting a proof.)
Prove that a matrix \(A\) is both skew-symmetric and symmetric if and only if \(A\) is the zero matrix. (Hint: one half of this proof is very easy, the other half takes a little more work.)
Suppose \(A\) and \(B\) are both skew-symmetric matrices of the same size and \(\alpha,\,\beta\in\complexes\text{.}\) Prove that \(\alpha A + \beta B\) is a skew-symmetric matrix.
Suppose \(A\) is a square matrix. Prove that there is a symmetric matrix \(B\) and a skew-symmetric matrix \(C\) such that \(A=B+C\text{.}\) In other words, any square matrix can be decomposed into a symmetric matrix and a skew-symmetric matrix (Proof Technique DC). (Hint: consider building a proof on Exercise MO.T34 and Exercise MO.T35.)