Skip to main content

Section 4.1 Determinant in SageMath

After finishing this section, you will learn the following.
  1. How to input a regular matrix
  2. How to input a matrix involving variables

Activity 4.1.1.

Find the determinant of the matrix
\begin{equation*} A = \left[\begin{array}{rrrr} 2 \amp 1 \amp -2 \amp -3 \\ 3 \amp 0 \amp -1 \amp -2 \\ -3 \amp 4 \amp 1 \amp 2\\ 1 \amp 3 \amp 3 \amp -1 \\ \end{array}\right]\text{.} \end{equation*}
In next activity, we perform three elementary row operations to yield matrices, and then find the determinants, respectively.

Activity 4.1.2.

Swap the rows 2 and 3 to yields the matrix \(B=\left[\begin{array}{rrrr} 2 \amp 1 \amp -2 \amp -3 \\ -3 \amp 4 \amp 1 \amp 2\\ 3 \amp 0 \amp -1 \amp -2 \\ 1 \amp 3 \amp 3 \amp -1 \\ \end{array}\right]\text{.}\) \(C= \left[\begin{array}{rrrr} 2 \amp 1 \amp -2 \amp -3 \\ 9 \amp 0 \amp -3 \amp -6 \\ -3 \amp 4 \amp 1 \amp 2\\ 1 \amp 3 \amp 3 \amp -1 \\ \end{array}\right]\) is obtained by scaling row 2 of the matrix \(A\) by 3. Let \(D = \left[\begin{array}{rrrr} 2 \amp 1 \amp -2 \amp -3 \\ 3 \amp 0 \amp -1 \amp -2 \\ -3 \amp 4 \amp 1 \amp 2\\ 7 \amp 3 \amp 1 \amp -5 \\ \end{array}\right]\) is obtained by adding 2 times of row 2 of the matrix \(A\) to row 4.
Find the determinant of \(B\text{,}\) and state what you find.
Find the determinant of \(C\text{,}\) and state what you find.
Find the determinant of \(D\text{,}\) and state what you find.

Activity 4.1.3.

I would like to find a 4 by 4 matrix \(F\) whose determinant is 42 and \(F_{22}=-F_{44}\text{.}\)
I would like to construct the matrix \(F\) from \(A\text{.}\) My answer is
\begin{equation*} \left(\begin{array}{rrrr} 2 \amp 1 \amp -2 \amp -3 \\ 3 \amp -7 \amp -1 \amp -2 \\ -3 \amp 4 \amp 1 \amp 2 \\ 1 \amp 3 \amp 3 \amp 7 \end{array}\right). \end{equation*}