C27 † Page 353
Book: Beezer: A First Course in Linear Algebra
Exercise
Doing the computations by hand, find the determinant of the matrix A.
\[A = \begin{pmatrix}1\:&\:0\:&\:1\:&\:1\:\\ \:2\:&\:2\:&\:-1\:&\:1\:\\ \:2\:&\:1\:&\:3\:&\:0\:\\ \:1\:&\:1\:&\:0\:&\:1\end{pmatrix}\]
Solution
First, I will reduce the matrix as follows:
Swap matrix rows: \(R_1\:\leftrightarrow R_2\)
\[=\begin{pmatrix}2&2&-1&1\\ 1&0&1&1\\ 2&1&3&0\\ 1&1&0&1\end{pmatrix}\]
Cancel leading coefficient in row \(R_2\) by performing \(R_2\:\leftarrow \:R_2-\frac{1}{2}\cdot \:R_1\)
\[=\begin{pmatrix}2&2&-1&1\\ 0&-1&\frac{3}{2}&\frac{1}{2}\\ 2&1&3&0\\ 1&1&0&1\end{pmatrix}\]
Cancel leading coefficient in row \(R_3\) by performing \(R_3\:\leftarrow \:R_3-1\cdot \:R_1\)
\[=\begin{pmatrix}2&2&-1&1\\ 0&-1&\frac{3}{2}&\frac{1}{2}\\ 0&-1&4&-1\\ 1&1&0&1\end{pmatrix}\]
Cancel leading coefficient in row \(R_4\) by performing \(R_4\:\leftarrow \:R_4-\frac{1}{2}\cdot \:R_1\)
\[=\begin{pmatrix}2&2&-1&1\\ 0&-1&\frac{3}{2}&\frac{1}{2}\\ 0&-1&4&-1\\ 0&0&\frac{1}{2}&\frac{1}{2}\end{pmatrix}\]
Cancel leading coefficient in row \(R_3\) by performing \(R_3\:\leftarrow \:R_3-1\cdot \:R_2\)
\[=\begin{pmatrix}2&2&-1&1\\ 0&-1&\frac{3}{2}&\frac{1}{2}\\ 0&0&\frac{5}{2}&-\frac{3}{2}\\ 0&0&\frac{1}{2}&\frac{1}{2}\end{pmatrix}\]
Cancel leading coefficient in row \(R_4\) by performing \(R_4\:\leftarrow \:R_4-\frac{1}{5}\cdot \:R_3\)
\[=\begin{pmatrix}2&2&-1&1\\ 0&-1&\frac{3}{2}&\frac{1}{2}\\ 0&0&\frac{5}{2}&-\frac{3}{2}\\ 0&0&0&\frac{4}{5}\end{pmatrix}\]
Since the determinant of the matrix equals the diagonal product of the matrix:
\[det(A)=2\left(-1\right)\frac{5}{2}\cdot \frac{4}{5}\]
\[det(A)=-4\]
Now, since I have interchanged two rows, it negate the determinant, therefore multiply the result by \(\left(-1\right)^1\).
\[det(A)=\left(-1\right)^1\left(-4\right)=4\]
Solving in R
- Defining Matrix
A <- matrix(data = c(1,0,1,1,
2,2,-1,1,
2,1,3,0,
1,1,0,1), ncol=4, byrow=TRUE)
- Finding determinant in R
det(A)
## [1] 4