Exercises and Problems¶
Solution of a Linear System by the Gauss-Jordan Elimination¶
Exercise 0. \(\\\) The coefficient matrix \(\boldsymbol{A}\,\) and the vector of constants \(\,\boldsymbol{b}\,\) determine a linear system of four equations in four variables with a unique solution over the rational field.
- \(\,\) Construct the augmented matrix \(\,\boldsymbol{B}\,\) and solve the system\(\,\) by transforming \(\,\boldsymbol{B}\,\) into the reduced row echelon form.
- \(\,\) To confirm the result make sure that the product of the matrix \(\boldsymbol{A}\,\)\(\,\) by the solution column \(\,\boldsymbol{x}\,\) equals the column of constants \(\,\boldsymbol{b}\).
Hint. The solution column \(\,\boldsymbol{x}\,\)
is the last column of the augmented matrix in the reduced row echelon form
(it may be detached by slicing).
The method column()
may be used to convert a vector
into the one-column matrix.
Elementary Operations on Matrices by the Sage Commands¶
Exercise 1. \(\\\) Uncomment one of the three hashed lines to demonstrate that the corresponding command operates directly upon the original matrix:
The row version:
The column version:
Exercise 2. \(\\\) Uncomment one of the three hashed lines to demonstrate that the corresponding command returns a transformed matrix while leaving the original one unchanged:
The row version:
The column version:
Exercise 3. \(\\\)
Note that whereas echelonize()
acts directly on the original matrix,
echelon_form()
and rref()
return the modified matrix without
changing the original: \(\\\)
Matrix Inverse¶
Exercise 4. \(\\\) Assuming the matrices to be over the rational field, solve for the matrix \(\boldsymbol{X}:\)
Exercise 5. \(\\\) Find the inverse of each of the two matrices over the rational field:
Write down the code generating a matrix \(\ L_n\ \) and its inverse \(\ L_n^{-1}\ \) for an arbitrary natural \(\,n.\)
Note. \(\,L_5\,\) is a lower triangular Pascal matrix: it is composed of binomial coefficients and complementary zeroes.
Exercise 6. \(\\\) Calculate the inverse of the matrix \(\,\boldsymbol{A}\,\) over the rational field:
Experiment to obtain a general form of the inverse of such a matrix for an arbitrary size \(\,n.\)
This “upper triangular alternating” matrix of a given size \(\,n\,\) is generated by the Sage code:
Exercise 7. \(\\\)
Apply the Sage method \(\,\) inverse()
\(\,\)
to the symbolic matrix
Notice that \(\,\boldsymbol{A}\,\) is invertible if and only if \(\ \det{\boldsymbol{A}} \equiv ad-bc \neq 0.\)
Hint. \(\,\) To show a readable output apply the method
\(\,\) factor()
to the raw result.
Matrix Inverse by the Elimination Method¶
The inverse of a given matrix \(\,\boldsymbol{A}\in M_n(K)\,\) can be obtained by appropriate elementary row operations on the 2-block composed of \(\,\boldsymbol{A}\,\) and the identity matrix \(\,\boldsymbol{I}_n.\ \)
In a previous section a 2-block has been built by the method augment()
,
and the matrix \(\,\boldsymbol{A}^{-1}\,\) was selected
by slicing. In the present alternative way the framework of block matrices
is applied. The association of matrices \(\,\boldsymbol{A}\,\) and
\(\,\boldsymbol{I}_n\ \) is performed by the method block_matrix()
,
whereas the resulting inverse matrix \(\,\boldsymbol{A}^{-1}\,\)
is extracted using the method subdivision()
. 5
In both cases the row-reducing is executed by rref()
.
The following program generates an invertible matrix \(\,\boldsymbol{A}\,\) of a given size \(\,n\,\) over the rational field \(\,Q,\ \) and calculates its inverse by means of the above-mentioned procedures.
Exercise 8. \(\,\)
For \(\,n = 2,\,3\ \) perform by hand elementary operations which transform a matrix \(\ [\,\boldsymbol{A}\,|\,\boldsymbol{I}\,]\ \) \(\\\) to the form \(\ [\,\boldsymbol{I}\,|\,\boldsymbol{A}^{-1}\,].\ \) Compare your result with that given by the program.
Experiment with greater \(\,n\,\) and compare the result of the present
elimination method with that given by the standard method inverse()
of matrix inversion.
\(\ \)
Permutation Matrices¶
Problem 0.
Pre-multiplying a column vector \(\,\boldsymbol{x}\,=\,[x_i]_m\in K^m\ \) by a permutation matrix \(\,\boldsymbol{P}_\sigma\in M_m(K)\ \) rearranges the entries of \(\,\boldsymbol{x}\ \) according to the permutation \(\,\sigma:\)
(here \(\,\boldsymbol{e}_i\ \) is a \(\,\) row \(\,\) vector with unity in the \(\,i\)-th position, zeroes elsewhere, \(\ i=1,2,\dots,m.\)).
Validate the result of action of \(\,\boldsymbol{P}_\sigma\ \) upon the \(\,\) column vector \(\,\boldsymbol{e}_k^T :\)
Exercise 9.
Set an integer \(\,n=2,3,...,\ \) and display a randomly selected permutation \(\,\sigma\in S_n\,\) together with its matrix \(\,\boldsymbol{P}_\sigma.\)
Column Version of Permutation Matrices¶
In this approach a permutation refers to columns rather than to rows of a matrix.
Namely, for a rectangular matrix \(\ \boldsymbol{A}\,=\,[a_{ij}]_{m\times n}\in M_{m\times n}(K)\ \) given in the column form
and a permutation \(\ \sigma\in S_n\,,\ \) the operation \(\,O^t_\sigma\,\) is defined by
(the superscript ‘t’ distinguishes the column operation from its row counterpart).
By analogy with the row case, the permutation matrix \(\ \boldsymbol{Q}_\sigma\ \) is defined as \(\\\) the result of application of \(\,O^t_\sigma\,\) to the identity matrix \(\ \boldsymbol{I}_n = [\;\boldsymbol{e}_1\,|\;\boldsymbol{e}_2\,|\;\dots\,|\,\boldsymbol{e}_n\,]\,:\)
Problem 1. \(\,\) Prove that:
- \(\,\) A permutation of columns of a product \(\boldsymbol{A}\boldsymbol{B}\ \) of two matrices can be achieved\(\,\) by the same permutation of columns of the second factor \(\boldsymbol{B}\ \) only.
- \(\,\) A permutation of columns of a rectangular matrix \(\boldsymbol{A}\ \) is equivalent\(\,\) to post-multiplying \(\boldsymbol{A}\ \) by the matrix of that permutation.
This may be written down in detail as
Theorem.
Given a permutation \(\ \sigma\in S_n\,,\ \) the following statements hold true:
\(\,\) If \(\,\boldsymbol{A}\in M_{m\times p}(K),\ \boldsymbol{B}\in M_{p\times n}(K),\ \) then \(\ O^t_\sigma\,(\boldsymbol{A}\boldsymbol{B})\ =\ \boldsymbol{A}\,(O^t_\sigma\boldsymbol{B})\,.\)
\(\,\) If \(\,\boldsymbol{A}\in M_{m\times n}(K),\ \) then \(\ O^t_\sigma\,\boldsymbol{A}\ =\ \boldsymbol{A}\,\boldsymbol{Q}_\sigma\,,\ \ \text{where}\ \ \boldsymbol{Q}_\sigma = O^t_\sigma\,\boldsymbol{I}_n\in M_n(K)\,.\)
Hints.
\(\,\) Apply the Column Rule of Matrix Multiplication.
\(\,\) Note that \(\ \boldsymbol{A} = \boldsymbol{A}\,\boldsymbol{I}_n\ \) and take advantage of statement 1.
Problem 2. \(\,\) Prove that a product of two permutation matrices is also a permutation matrix:
Hint. \(\,\) Recall the multiplication rule for the row permutation matrices:
and remark that the row and column matrices of a permutation are interrelated by the transpose:
Equations \(\,\) (1), \(\,\) (2) \(\,\) and \(\,\) (3) \(\,\) suggest the
Corollary. \(\\\)
The map \(\,F\,\) of a permutation group \(\,S_n\,\) to an algebra \(\,M_n(K)\) \(\\\) of square matrices of size \(\,n\,\) over a field \(\,K:\)
is homomorphic: \(\quad F(\rho\circ\sigma) = F(\rho) \cdot\ F(\sigma),\quad \rho,\,\sigma\in S_n\,.\)
Therefore \(\,F\,\) is a \(\,\) representation \(\,\) of the group \(\,S_n\ \) on the vector space \(\ K^n.\)