-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMatrixInversion3x3StepbyStep.txt
More file actions
96 lines (69 loc) · 4.2 KB
/
MatrixInversion3x3StepbyStep.txt
File metadata and controls
96 lines (69 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
We're working on a general linear algebra problem such as AX = B,
which is the same as AX = IB,
where A is an nxn matrix and X and B are nx1 vectors, and I is the identity matrix,
and we'd like to be able to solve for X by finding the "inverse of A",
which we'll call Ainv, and then determine X using X = AinvB,
Remember, we want to use row operations on A that change it into an identify matrix
and perform those same row operations on I, so that it becomes Ainv.
We'll use A and I below as are our starting matrices.
Starting Matrices are:
AM Matrix IM Matrix
[' +5.000', ' +3.000', ' +1.000'] [' +1.000', ' +0.000', ' +0.000']
[' +3.000', ' +9.000', ' +4.000'] [' +0.000', ' +1.000', ' +0.000']
[' +1.000', ' +3.000', ' +5.000'] [' +0.000', ' +0.000', ' +1.000']
Using the matrices above, Scale row-1 of AM and IM by diagonal element 1 of AM, which is 1/+5.000.
AM Matrix IM Matrix
[' +1.000', ' +0.600', ' +0.200'] [' +0.200', ' +0.000', ' +0.000']
[' +3.000', ' +9.000', ' +4.000'] [' +0.000', ' +1.000', ' +0.000']
[' +1.000', ' +3.000', ' +5.000'] [' +0.000', ' +0.000', ' +1.000']
Using the matrices above, subtract +3.000 * row-1 of AM from row-2 of AM, and
subtract +3.000 * row-1 of IM from row-2 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.600', ' +0.200'] [' +0.200', ' +0.000', ' +0.000']
[' +0.000', ' +7.200', ' +3.400'] [' -0.600', ' +1.000', ' +0.000']
[' +1.000', ' +3.000', ' +5.000'] [' +0.000', ' +0.000', ' +1.000']
Using the matrices above, subtract +1.000 * row-1 of AM from row-3 of AM, and
subtract +1.000 * row-1 of IM from row-3 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.600', ' +0.200'] [' +0.200', ' +0.000', ' +0.000']
[' +0.000', ' +7.200', ' +3.400'] [' -0.600', ' +1.000', ' +0.000']
[' +0.000', ' +2.400', ' +4.800'] [' -0.200', ' +0.000', ' +1.000']
Using the matrices above, Scale row-2 of AM and IM by diagonal element 2 of AM, which is 1/+7.200.
AM Matrix IM Matrix
[' +1.000', ' +0.600', ' +0.200'] [' +0.200', ' +0.000', ' +0.000']
[' +0.000', ' +1.000', ' +0.472'] [' -0.083', ' +0.139', ' +0.000']
[' +0.000', ' +2.400', ' +4.800'] [' -0.200', ' +0.000', ' +1.000']
Using the matrices above, subtract +0.600 * row-2 of AM from row-1 of AM, and
subtract +0.600 * row-2 of IM from row-1 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.000', ' -0.083'] [' +0.250', ' -0.083', ' +0.000']
[' +0.000', ' +1.000', ' +0.472'] [' -0.083', ' +0.139', ' +0.000']
[' +0.000', ' +2.400', ' +4.800'] [' -0.200', ' +0.000', ' +1.000']
Using the matrices above, subtract +2.400 * row-2 of AM from row-3 of AM, and
subtract +2.400 * row-2 of IM from row-3 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.000', ' -0.083'] [' +0.250', ' -0.083', ' +0.000']
[' +0.000', ' +1.000', ' +0.472'] [' -0.083', ' +0.139', ' +0.000']
[' +0.000', ' +0.000', ' +3.667'] [' +0.000', ' -0.333', ' +1.000']
Using the matrices above, Scale row-3 of AM and IM by diagonal element 3 of AM, which is 1/+3.667.
AM Matrix IM Matrix
[' +1.000', ' +0.000', ' -0.083'] [' +0.250', ' -0.083', ' +0.000']
[' +0.000', ' +1.000', ' +0.472'] [' -0.083', ' +0.139', ' +0.000']
[' +0.000', ' +0.000', ' +1.000'] [' +0.000', ' -0.091', ' +0.273']
Using the matrices above, subtract -0.083 * row-3 of AM from row-1 of AM, and
subtract -0.083 * row-3 of IM from row-1 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.000', ' +0.000'] [' +0.250', ' -0.091', ' +0.023']
[' +0.000', ' +1.000', ' +0.472'] [' -0.083', ' +0.139', ' +0.000']
[' +0.000', ' +0.000', ' +1.000'] [' +0.000', ' -0.091', ' +0.273']
Using the matrices above, subtract +0.472 * row-3 of AM from row-2 of AM, and
subtract +0.472 * row-3 of IM from row-2 of IM
AM Matrix IM Matrix
[' +1.000', ' +0.000', ' +0.000'] [' +0.250', ' -0.091', ' +0.023']
[' +0.000', ' +1.000', ' +0.000'] [' -0.083', ' +0.182', ' -0.129']
[' +0.000', ' +0.000', ' +1.000'] [' +0.000', ' -0.091', ' +0.273']
Now we multiply the original A matrix times our inverse of A, which is IM.
If we get an identify matrix, our inversion is proved.
[1.0, 0.0, 0.0]
[0.0, 1.0, 0.0]
[0.0, 0.0, 1.0]