Matrix Inverse and Determinant
Matrix Inverse
We will now turn our attention to solving simultaneous equations. Elimination and substitution are the typical methods we employ to solve simultaneous equations. It turns out matrix multiplication offers another approach we can obtain a solution.
This relies on one property of matrix called matrix inverse. Multiplying a matrix by its inverse will result in an identity matrix.
A − 1 ∗ A = I A^{-1}*A = I A−1∗A=I
where A − 1 A^{-1} A−1 is the inverse of matrix A and I is the identity matrix.
To solve a simultaneous equation A ∗ r = s A*r=s A∗r=s for vector r r r, we can rearrange the equation as follows
A ∗ r = s A − 1 ∗ ( A ∗ r ) = A − 1 ∗ s r = A − 1 ∗ s \begin{aligned} A*r &= s \\ A^{-1}*(A*r)&=A^{-1}*s \\ r&=A^{-1}*s \end{aligned} A∗rA−1∗(A∗r)r=s=A−1∗s=A−1∗s
Therefore, solution for vector r r r can be obtained by multiplying A − 1 A^{-1} A−1 with s s s.
However, finding matrix inverse is a non-trivial task. There exists one shortcut to calculate matrix inverse if it is a 2 by 2 square matrix.
( a b c d ) − 1 = 1 a d − b c ( d − b − c a ) (1) \begin{pmatrix}a&b\\c&d\end{pmatrix}^{-1}=\frac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix} \tag{1} (acbd)−1=ad−bc1(d−c−ba)(1)
To find inverse of matrix in higher dimensions, QR decomposition could be one approach. But this is out of scope for our discussion here.
Matrix Determinant
One concept closely related to matrix inverse is matrix determinant. For a matrix A = ( a b c d ) A=\begin{pmatrix}a&b\\c&d\end{pmatrix} A=(acbd), we can draw a parallelogram with vectors ( a c ) \begin{pmatrix}a\\c\end{pmatrix} (ac) and ( b d ) \begin{pmatrix}b\\d\end{pmatrix} (bd). The determinant of this matrix is then defined as the area of this parallelogram.
This area is calculated by formula below.
∣ A ∣ = ( a + b ) ∗ ( c + d ) − a c − b d − 2 b c = a d − b c \begin{aligned} |A| &= (a+b)*(c+d)-ac-bd-2bc\\ &=ad-bc \end{aligned} ∣A∣=(a+b)∗(c+d)−ac−bd−2bc=ad−bc
The symbol for determinant is two vertical bars (|), just like the modulus operator for vectors.
Recall that a d − b c ad-bc ad−bc is also the term we used in matrix inverse calculation for a 2 by 2 matrix (equation 1). Therefore our matrix inverse formula can be simplified as
A − 1 = 1 ∣ A ∣ ∗ ( d − b − c a ) (2) A^{-1}=\frac{1}{|A|}*\begin{pmatrix}d&-b\\-c&a\end{pmatrix} \tag{2} A−1=∣A∣1∗(d−c−ba)(2)
We can also see that not all matrices are invertible. In order to find the inverse of a matrix, we have to compute its determinant first. However, for a matrix like ( 1 2 1 2 ) \begin{pmatrix}1&2\\1&2\end{pmatrix} (1122), the determinant is 1 ∗ 2 − 2 ∗ 1 = 0 1*2-2*1=0 1∗2−2∗1=0. It will result in a division by 0 when we substitute the determinant value to equation (2). This is because for a matrix to have non-zero determinant, the basis vectors of that matrix must be linearly independent. In our example 2 by 2 matrix A A A, ( a c ) \begin{pmatrix}a\\c\end{pmatrix} (ac) and ( b d ) \begin{pmatrix}b\\d\end{pmatrix} (bd) must not lie on the same line to have a valid matrix inverse. In the simultaneous equation A ∗ r = s A*r=s A∗r=s, there exists an infinite number of solutions for vector r r r if matrix A A A has no inverse.
Matrices Changing Basis
Changing Basis in General
We are going to revisit the topic of changing basis here after we have grasped the concept of matrix transformation on vectors.
First, let’s define 2 new basis vectors b 1 b_1 b1 and b 2 b_2 b2 where b 1 = ( 3 1 ) b_1=\begin{pmatrix}3\\1\end{pmatrix} b1=(31) and b 2 = ( 1 1 ) b_2=\begin{pmatrix}1\\1\end{pmatrix} b2=(11). Recall from our matrix transformation. The new basis vectors b 1 b_1 b1 and b 2 b_2 b2 are in fact the transformation of basis vectors e 1 = ( 1 0 ) e_1=\begin{pmatrix}1\\0\end{pmatrix} e1=(10) and e 2 = ( 0 1 ) e_2=\begin{pmatrix}0\\1\end{pmatrix} e2=(01) by matrix ( 3 1 1 1 ) \begin{pmatrix}3&1\\1&1\end{pmatrix} (3111). Note b 1 b_1 b1 and b 2 b_2 b2 can also be expressed in the basis of e 1 e_1 e1 and e 2 e_2 e2.
b 1 = ( 3 1 1 1 ) ∗ ( 1 0 ) = ( 3 1 ) = 3 e 1 + 1 e 2 b 2 = ( 3 1 1 1 ) ∗ ( 0 1 ) = ( 1 1 ) = 1 e 1 + 1 e 2 b_1=\begin{pmatrix}3&1\\1&1\end{pmatrix}*\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}3\\1\end{pmatrix}=3e_1+1e_2\\ b_2=\begin{pmatrix}3&1\\1&1\end{pmatrix}*\begin{pmatrix}0\\1\end{pmatrix}=\begin{pmatrix}1\\1\end{pmatrix}=1e_1+1e_2 b1=(3111)∗(10)=(31)=3e1+1e2b2=(3111)∗(01)=(11)=1e1+1e2
Now we have a vector r r r that is defined in b 1 b_1 b1 and b 2 b_2 b2 basis as r = 3 2 b 1 + 1 2 b 2 r=\frac{3}{2}b_1+\frac{1}{2}b_2 r=23b1+21b2. How do we get the same vector r r r expressed in e 1 e_1 e1 and e 2 e_2 e2 basis? We can substitute in vectors b 1 b_1 b1 and b 2 b_2 b2 in e 1 e_1 e1 and e 2 e_2 e2 basis.
r E = 3 2 b 1 + 1 2 b 2 = 3 2 ( 3 1 ) + 1 2 ( 1 1 ) = ( 5 2 ) \begin{aligned} r_E&=\frac{3}{2}b_1+\frac{1}{2}b_2\\ &=\frac{3}{2}\begin{pmatrix}3\\1\end{pmatrix}+\frac{1}{2}\begin{pmatrix}1\\1\end{pmatrix}\\ &=\begin{pmatrix}5\\2\end{pmatrix} \end{aligned} rE=23b1+21b2=23(31)+21(11)=(52)
Alternatively, we can convert the vector r = 3 2 b 1 + 1 2 b 2 r=\frac{3}{2}b_1+\frac{1}{2}b_2 r=23b1+21b2 from b 1 b_1 b1 and b 2 b_2 b2 basis to e 1 e_1 e1 and e 2 e_2 e2 basis by multiplying the transformation matrix ( 3 1 1 1 ) \begin{pmatrix}3&1\\1&1\end{pmatrix} (3111).
r E = ( 3 1 1 1 ) ∗ ( 3 2 1 2 ) = ( 5 2 ) \begin{aligned} r_E&=\begin{pmatrix}3&1\\1&1\end{pmatrix}*\begin{pmatrix}\frac{3}{2}\\\frac{1}{2}\end{pmatrix}\\ &=\begin{pmatrix}5\\2\end{pmatrix} \end{aligned} rE=(3111)∗(2321)=(52)
This is illustrated in graph below. Note the expression for vectors in e 1 e_1 e1 and e 2 e_2 e2 basis is colored black while that for vectors in b 1 b_1 b1 and b 2 b_2 b2 basis is colored orange.
That is how we convert a vector from b 1 b_1 b1 and b 2 b_2 b2 basis to e 1 e_1 e1 and e 2 e_2 e2 basis. But what is more interesting is to convert a vector from e 1 e_1 e1 and e 2 e_2 e2 basis to b 1 b_1 b1 and b 2 b_2 b2 basis. This should somehow “reverse” our previous process.
We first need to find out where e 1 e_1 e1 and e 2 e_2 e2 are in b 1 b_1 b1 and b 2 b_2 b2 basis. This is where matrix inverse comes into play.
( 3 1 1 1 ) − 1 = 1 3 − 1 ( 1 − 1 − 1 3 ) = 1 2 ( 1 − 1 − 1 3 ) \begin{pmatrix}3&1\\1&1\end{pmatrix}^{-1}=\frac{1}{3-1}\begin{pmatrix}1&-1\\-1&3\end{pmatrix}=\frac{1}{2}\begin{pmatrix}1&-1\\-1&3\end{pmatrix} (3111)−1=3−11(1−1−13)=21(1−1−13)
Therefore, e 1 = 1 2 b 1 − 1 2 b 2 e_1=\frac{1}{2}b_1-\frac{1}{2}b_2 e1=21b1−21b2 and e 2 = − 1 2 b 1 + 3 2 b 2 e_2=-\frac{1}{2}b_1+\frac{3}{2}b_2 e2=−21b1+23b2 in b 1 b_1 b1 and b 2 b_2 b2 basis. We can verify this by substituting the values of b 1 b_1 b1 and b 2 b_2 b2 back to get the original e 1 e_1 e1 and e 2 e_2 e2.
e 1 = 1 2 b 1 − 1 2 b 2 = 1 2 ( 3 1 ) − 1 2 ( 1 1 ) = ( 1 0 ) e 2 = − 1 2 b 1 + 3 2 b 2 = − 1 2 ( 3 1 ) + 3 2 ( 1 1 ) = ( 0 1 ) e_1=\frac{1}{2}b_1-\frac{1}{2}b_2 =\frac{1}{2}\begin{pmatrix}3\\1\end{pmatrix}-\frac{1}{2}\begin{pmatrix}1\\1\end{pmatrix} =\begin{pmatrix}1\\0\end{pmatrix}\\ e_2=-\frac{1}{2}b_1+\frac{3}{2}b_2 =-\frac{1}{2}\begin{pmatrix}3\\1\end{pmatrix}+\frac{3}{2}\begin{pmatrix}1\\1\end{pmatrix} =\begin{pmatrix}0\\1\end{pmatrix} e1=21b1−21b2=21(31)−21(11)=(10