Skip to main content
Mathematics LibreTexts

17.1: Introduction to Determinants

  • Page ID
    67876
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    from urllib.request import urlretrieve
    
    urlretrieve('https://raw.githubusercontent.com/colbrydi/jupytercheck/master/answercheck.py', 
                'answercheck.py');

    For a detailed overview of determinants I would recommend reviewing Chapter D pg 340-366 of the Beezer text.

    The determinant is a function that takes a (\(n \times n\)) square matrix as an input and produces a scalar as an output. Determinants have been studied quite extensively and have many interesting properties. However, determinants are “computationally expensive” as the size of your matrix (\(n\)) gets bigger. This limitation makes them impractical for many real world problems.

    The determinant of a \(2 \times 2\) matrix can be calculated as follows:

    \[\begin{split}
    det \left(
    \left[
    \begin{matrix}
    a_{11} & a_{12} \\
    a_{21} & a_{22}
    \end{matrix}
    \right]
    \right)
    = a_{11}a_{22} - a_{12}a_{21}
    \end{split} \nonumber \]

    Question

    Calculate the determinant of the following matrix by hand:

    \[\begin{split}
    \left[
    \begin{matrix}
    3 & -2 \\
    1 & 2
    \end{matrix}
    \right]
    \end{split} \nonumber \]

    Calculating the determinant of a larger matrix is a “recursive” problem which involves combining the determinants of smaller and smaller sub-matrices until you have a \(2 \times 2\) matrix which is then calculated using the above formula. Here is some Pseudocode to calculate a determinant. To simplify the example the code assumes there is a matrix function deleterow which will remove the \(x\)th row from a matrix (always the first row in this example) and deletecol will remove the \(x\)th column from a matrix. When used together (as shown below) they will take an \(n \times n\) matrix and turn it into a \((n−1) \times (n−1)\) matrix.

    function determinant(A, n)
       det = 0
       if (n == 1)
          det = matrix[1,1]
       else if (n == 2)
          det = matrix[1,1] * matrix[2,2] - matrix[1,2] * matrix[2,1]
       else 
          for x from 1 to n
              submatrix = deleterow(matrix, 1)
              submatrix = deletecol(submatrix, x)
              det = det + (x+1)**(-1) * matrix[1,x] * determinant(submatrix, n-1)
          next x
       endif
       
       return det
    

    Notice that the combination of the determinants of the submatrixes is not a simple sum. The combination is adding the submatrices corresponding to the odd columns (1,3,5, etc) and subtracting the submatrices corresponding to the even columns (2,4,6, etc.). This may become clearer if we look at a simple \(3 \times 3\) example (Let \(\left| A \right|\) be a simplified syntax for writing the determinant of \(A\)):

    \[\begin{split}
    A = \left[
    \begin{matrix}
    a_{11} & a_{12} & a_{13} \\
    a_{21} & a_{22} & a_{23} \\
    a_{31} & a_{32} & a_{33}
    \end{matrix}
    \right] \end{split} \nonumber \]

    \[\begin{split}
    |A|=
    a_{11} \left|
    \begin{matrix}
    \square & \square & \square \\
    \square & a_{22} & a_{23} \\
    \square & a_{32} & a_{33}
    \end{matrix}
    \right|
    -
    a_{12}\left|
    \begin{matrix}
    \square & \square & \square \\
    a_{21} & \square & a_{23} \\
    a_{31} & \square & a_{33}
    \end{matrix}
    \right|
    +
    a_{13} \left|
    \begin{matrix}
    \square & \square & \square \\
    a_{21} & a_{22} & \square \\
    a_{31} & a_{32} & \square
    \end{matrix}
    \right|
    \end{split} \nonumber \]

    \[\begin{split}
    |A|
    =
    a_{11}\left|
    \begin{matrix}
    a_{22} & a_{23} \\
    a_{32} & a_{33}
    \end{matrix}
    \right|
    -
    a_{12}\left|
    \begin{matrix}
    a_{21} & a_{23} \\
    a_{31} & a_{33}
    \end{matrix}
    \right|
    +
    a_{13}
    \left|
    \begin{matrix}
    a_{21} & a_{22} \\
    a_{31} & a_{32}
    \end{matrix}
    \right|
    \end{split} \nonumber \]

    \[
    |A| =
    a_{11}(a_{22}a_{33} - a_{23}a_{32})
    -
    a_{12}(a_{21}a_{33} - a_{23}a_{31})
    +
    a_{13}(a_{21}a_{32} - a_{22}a_{31}) \nonumber \]

    Question

    Calculate the determinant of the following matrix by hand:

    \[\begin{split}
    \left[
    \begin{matrix}
    1 & 2 & -3 \\
    5 & 0 & 6 \\
    7 & 1 & -4
    \end{matrix}
    \right]
    \end{split} \nonumber \]

    Question

    Use the numpy.linalg library to calculate the determinant of the following matrix and stor the value in a variable called det

    \[\begin{split}
    \left[
    \begin{matrix}
    2 & 0 & 1 & -5 \\
    8 & -1 & 2 & 1 \\
    4 & -3 & -5 & 0 \\
    1 & 4 & 8 & 2
    \end{matrix}
    \right]
    \end{split} \nonumber \]

    #Put your answer here
    from answercheck import checkanswer
    
    checkanswer.float(det,'49afb719e0cd46f74578ebf335290f81');

    This page titled 17.1: Introduction to Determinants is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Dirk Colbry via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?