Mathematics Basics - Linear Algebra (Matrix Part 2)

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 A1A=I

where A − 1 A^{-1} A1 is the inverse of matrix A and I is the identity matrix.

To solve a simultaneous equation A ∗ r = s A*r=s Ar=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} ArA1(Ar)r=s=A1s=A1s

Therefore, solution for vector r r r can be obtained by multiplying A − 1 A^{-1} A1 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=adbc1(dcba)(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.

Parallelogram of 2 vectors

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)acbd2bc=adbc

The symbol for determinant is two vertical bars (|), just like the modulus operator for vectors.

Recall that a d − b c ad-bc adbc 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} A1=A1(dcba)(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 1221=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 Ar=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.

Vector in New Basis

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=311(1113)=21(1113)

Therefore, e 1 = 1 2 b 1 − 1 2 b 2 e_1=\frac{1}{2}b_1-\frac{1}{2}b_2 e1=21b121b2 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=21b121b2=21(31)21(11)=(10

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值