Thanks to theidioms.com

Learn Linear Algebra for Data Science (Mini-Course)

Learn Linear Algebra for Data Science (Mini-Course)

Matrix Transpose, Determinants and Inverse

In this lesson we will learn about some matrix transformation techniques such as the matrix transpose, determinants and the inverse.

Matrix Transpose

The transpose of a matrix is used to produce a matrix whose row and column indices have been swapped, i.e., the element a_{i,j} of the matrix is swapped with the element a_{j, i} of the matrix. The transpose of a matrix A with dimensions m \times n returns a matrix with dimensions n \times m and is denoted by A^T.

For example, consider a matrix A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}. We can find its transpose by swapping the column and row elements as follows.

    \[A^T = \begin{bmatrix} 1 &  4 &  7 \\  2 & 5 &  8 \\  3 &  6 & 9 \end{bmatrix}\]

Also note that for a square matrix, i.e., a matrix with an equal number of rows and columns, the diagonal elements remain unchanged for the original matrix and its transpose.

Determinant of a matrix

The determinant of a matrix can be computed only if the matrix is a square matrix. For a n \times n matrix A, the determinant is denoted as det (A).

The formula for calculating the determinant of a matrix depends upon the dimension of the matrix.

For a first order matrix, i.e., 1 \times 1 matrix, A = \begin{bmatrix} a \end{bmatrix}, the determinant is the element itself and is given as,

    \[det(A) = |A| = |a| = a\]

For a 2 \times 2 matrix A = \begin{bmatrix} a & b \\ c & d \\ \end{bmatrix}, the determinant is given as,

    \[det(A) = |A| = \begin{vmatrix} a & b \\ c & d \\ \end{vmatrix} = ad -bc\]

For a higher order matrix such as 3 \times 3 matrix A = \begin{bmatrix} a_1 & a_2 & a_3  \\ b_1 & b_2 & b_3 \\ c_1 & c_2 & c_3 \end{bmatrix}, the determinant is given as,

    \[det(A) = |A| = \begin{vmatrix} a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \\ c_1 & c_2 & c_3 \end{vmatrix} = a_1 \begin{vmatrix}b_2 & b_3 \\ c_2 & c_3\end{vmatrix} - a_2 \begin{vmatrix}b_1 & b_3 \\ c_1 & c_3\end{vmatrix} + a_3 \begin{vmatrix}b_1 & b_2 \\ c_1 & c_2\end{vmatrix}\]

The determinant of a matrix is used in finding the inverse of the matrix, which we will discuss in the next section.

Inverse of a Matrix

The inverse of a matrix is denoted as A^{-1} and is given by a matrix such that the equation A\times A^{-1} = \mathds{1}_n is satisfied. Here \mathds{1}_n, also denoted by I_n is known as the identity matrix; a matrix whose entries are zero, with the exception of the diagonal entries which are populated by ones.

For example, \mathds{1}_2 = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} is an Identity matrix of dimension 2.

For an arbitrary 2\times2 matrix A = \begin{bmatrix} a & b \\ c & d \\ \end{bmatrix}, the inverse A^{-1} can be calculated from the equation,

    \[A^{-1} = \frac{1}{det(A)} \begin{bmatrix} d & - b \\ -c & a \\ \end{bmatrix}\]

where det(A) is known as the determinant of A. Also note that a matrix is invertible if and only if the determinant of the matrix is non-zero., i.e., det(A) \neq 0.

For example, suppose a matrix A = \begin{bmatrix}  1 & 2 \\ 3 & 4 \\\end{bmatrix}. Its inverse can be obtained as,

    \[A^{-1} = \frac{1}{det(A)}\begin{bmatrix} 4 & - 2 \\ - 3 & 1 \\ \end{bmatrix} = \frac{1}{4\times1 - 3\times2}\begin{bmatrix} 4 & - 2 \\ - 3 & 1 \\ \end{bmatrix} = \begin{bmatrix} -2 & 1 \\  \frac{3}{2} & -\frac{1}{2} \\ \end{bmatrix}\]

Hence, the inverse of the matrix A is A^{-1} = \begin{bmatrix} -2 & 1 \\ \frac{3}{2} & -\frac{1}{2} \\ \end{bmatrix}.

Now, let us check if this works with the definition we gave for the inverse of a matrix that it satisfies the equation A\times A^{-1} = \mathds{1}_n.

We can compute the value of L.H.S of the equation as,

    \[A\times A^{-1} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix} \begin{bmatrix} -2 & 1 \\ \frac{3}{2} & -\frac{1}{2} \\ \end{bmatrix} = \begin{bmatrix} -2 + 3 & 1 - 1 \\ -6 + 6 & 3 -2 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} = \mathds{1}_2\]

Thus, the L.H.S of the equation is identical to the R.H.S and the equation is satisfied.

In this lesson, we discussed some of the essential processes such as finding the transpose, determinant, and inverse of a matrix. With this, we have developed an understanding of some of the important concepts in Linear Algebra. Head on to the next lesson to attempt some practice questions to evaluate your learning so far.

Leave your thought here

Your email address will not be published. Required fields are marked *

Close Bitnami banner
Bitnami