You are on page 1of 5

Describing the World in 3D –Matrices

What is a Matrix?

A matrix is a rectangular array of numbers or variables with 𝑚 rows and 𝑛 columns. For example, a
matrix of order 3 × 2 looks like this:
𝑎11 𝑎12
𝑎
𝐴 = [ 21 𝑎22 ]
𝑎31 𝑎32
When we talk about an individual element in a matrix we denote it by a subscript 𝑎𝑖𝑗 where 𝑖 is its
row and 𝑗 is its column.

Determinant of a Matrix

Determinant of a 2x2 matrix


𝑎11 𝑎12
𝐴 = [𝑎 𝑎22 ]
21
𝑎11 𝑎12
det(𝐴) = |𝑎 𝑎22 | = 𝑎11 𝑎22 − 𝑎21 𝑎12
21

Example:
−2 3
𝐴=[ ]
1 4
|𝐴| = (−2 × 4 − 1 × 3) = −11
Determinant of a 3x3 matrix
𝑎11 𝑎12 𝑎13
𝐴 = [𝑎21 𝑎22 𝑎23 ]
𝑎31 𝑎32 𝑎33

𝑎 𝑎23 𝑎21 𝑎23 𝑎21 𝑎22


|𝐴| = 𝑎11 |𝑎22 𝑎33 | − 𝑎12 |𝑎31 𝑎33 | + 𝑎13 |𝑎31 𝑎32 |
32

|𝐴| = 𝑎11 (𝑎22 𝑎33 − 𝑎32 𝑎23 ) − 𝑎12 (𝑎21 𝑎33 − 𝑎31 𝑎23 ) + 𝑎13 (𝑎21 𝑎32 − 𝑎31 𝑎22 )

Example:
5 2 3
𝐵 = [ 4 5 6]
7 8 9

det(𝐵) = 5(5 × 9 − 8 × 6) − 2(4 × 9 − 7 × 6) + 3(4 × 8 − 7 × 5) = −12

Describing the World in 3D - Page 1


Matrix Multiplication

The shape of matrix may be defined as Rows × Columns.

Where 𝐴 is an 𝑀 × 𝑁 matrix and 𝐵 is an 𝑁 × 𝐿 matrix the product, 𝐶, is an 𝑀 × 𝐿 matrix. For a


matrix multiplication to be possible the matrices must share the same inner dimension, that is the
number of columns in the first must equal the number of rows in the second.
𝑎11 𝑎12
𝑏11 𝑏12 𝑏13
𝐴 = [𝑎21 𝑎22 ] 𝐵=[ ] 𝐴𝐵 = 𝐶
𝑎31 𝑎32 𝑏21 𝑏22 𝑏23

The multiplication goes as follows, element 𝐶𝑖𝑗 of the resultant matrix is the dot product of a row 𝑖
of A with column 𝑗 of B

𝑐11 = [𝑎11 , 𝑎12 ] . [𝑏11 , 𝑏21 ]


𝑐12 = [𝑎11 , 𝑎12 ] . [𝑏12 , 𝑏22 ]
𝑐13 = [𝑎11 , 𝑎12 ] . [𝑏13 , 𝑏23 ]
𝑐21 = [𝑎21 , 𝑎22 ] . [𝑏11 , 𝑏21 ]
𝑐22 = [𝑎21 , 𝑎22 ] . [𝑏12 , 𝑏22 ]
𝑐23 = [𝑎21 , 𝑎22 ] . [𝑏13 , 𝑏23 ]
𝑐31 = [𝑎31 , 𝑎32 ] . [𝑏11 , 𝑏21 ]
𝑐32 = [𝑎31 , 𝑎32 ] . [𝑏12 , 𝑏22 ]
𝑐33 = [𝑎31 , 𝑎32 ] . [𝑏13 , 𝑏23 ]
Example
1 2
1 2 3
𝐴 = [3 4] 𝐵=[ ]
4 5 6
5 6
1×1+2×4 1×2+2×5 1×3+2×6 9 12 15
𝐴𝐵 = [3 × 1 + 4 × 4 3 × 2 + 4 × 5 3 × 3 + 4 × 6] = [19 26 33]
5×1+6×4 5×2+6×5 5×3+6×6 29 40 51

1×1+2×3+3×5 1×2+2×4+3×6 22 28
𝐵𝐴 = [ ]=[ ]
4×1+5×3+6×5 4×2+5×4+6×6 49 64
Another way of thinking about it is each element can be defined as the sum of the multiplication of
elements from matrix 𝐴 and 𝐵.
𝑛

𝑐𝑖𝑗 = ∑ 𝑎𝑖𝑘 𝑏𝑘𝑗


𝑘=1

Describing the World in 3D - Page 2


The Inverse of a Matrix

Instead of dividing square matrices we instead multiply by their inverse. We can find the inverse of a
square matrix using the following formula, as long as the determinant is not equal to 0. To do this
we have to find the determinant of A and find the transpose of the cofactors of A.
1 𝑇
𝐴−1 = 𝐶
|𝐴|
First we have to generate the matrix of cofactors, 𝐶, The cofactor of an element in a matrix is equal
to its corresponding sign from the sign matrix times the minor of that element, where the minor is
the determinant of the matrix comprised of all other elements that do not share a row or column
with the element.

Computing Cofactors, 2x2


+ −
Sign Matrix = [ ]
− +
+|𝑎22 | −|𝑎21 |
Matrix of Cofactors of A= 𝐶 = [ ]
−|𝑎12 | +|𝑎11 |
Now the determinant of a single value is equal to that value so |𝑎11 | = 𝑎11 or |7| = 7.

Computing Cofactors, 3x3


𝑎11 𝑎12 𝑎13
𝐴 = [𝑎21 𝑎22 𝑎23 ]
𝑎31 𝑎32 𝑎33
+ − +
Sign Matrix = [− + −]
+ − +
𝑎22 𝑎23 𝑎21 𝑎23 𝑎21 𝑎22
+ |𝑎 | − | | + | 𝑎32 |
32 𝑎33 𝑎31 𝑎33 𝑎31
𝑎12 𝑎13 𝑎11 𝑎13 𝑎11 𝑎12
Matrix of Cofactors of A= 𝐶 = − |𝑎 | + | | − | 𝑎32 |
32 𝑎33 𝑎31 𝑎33 𝑎31
𝑎12 𝑎13 𝑎11 𝑎13 𝑎11 𝑎12
+ |
[ 𝑎22 𝑎23 | − |𝑎21 𝑎23 | + |𝑎21 𝑎22 |]
Transpose of a Matrix

The transpose of 𝐴, denoted 𝐴𝑇 , is found by writing the rows of 𝐴 as the columns of 𝐴𝑇 .


𝑎 𝑏 𝑎 𝑐 𝑒
So if 𝐴 = [ 𝑐 𝑑] 𝐴𝑇 = [𝑏 𝑑 𝑓]
𝑒 𝑓

2x2 Matrix Inversion Example


−2 3
𝐴=[ ]
1 4
1 𝑇
𝐴−1 = 𝐶
|𝐴|

Describing the World in 3D - Page 3


|𝐴| = 𝑎11 𝑎22 − 𝑎21 𝑎12 = −2 × 4 − 1 × 3 = −11

+|𝑎22 | −|𝑎21 | 4 −1
𝐶=[ ]=[ ]
−|𝑎12 | +|𝑎11 | −3 −2

4 −3
𝐶𝑇 = [ ]
−1 −2

1 4 −3 −0.3636 0.2727
𝐴−1 = − [ ]=[ ]
11 −1 −2 0.0909 0.1818

3x3 Matrix Inversion Example


5 7 6
𝐴 = [9 7 1]
3 4 1
1 𝑇
𝐴−1 = 𝐶
|𝐴|
|𝐴| = 𝑎11 (𝑎22 𝑎33 − 𝑎32 𝑎23 ) − 𝑎12 (𝑎21 𝑎33 − 𝑎31 𝑎23 ) + 𝑎13 (𝑎21 𝑎32 − 𝑎31 𝑎22 )
|𝐴| = 5(7 × 1 − 4 × 1) − 7(9 × 1 − 3 × 1) + 6(9 × 4 − 3 × 7) = 63

𝑎22 𝑎23 𝑎21 𝑎23 𝑎21 𝑎22


+ |𝑎 𝑎33 | − | 𝑎31 𝑎33 | + |𝑎31 𝑎32 |
32
𝑎12 𝑎13 𝑎11 𝑎13 𝑎11 𝑎12
𝐶 = − |𝑎 𝑎33 | + | 𝑎31 𝑎33 | − |𝑎31 𝑎32 |
32
𝑎12 𝑎13 𝑎11 𝑎13 𝑎11 𝑎12
[+ |𝑎22 𝑎23 | − | 𝑎21 𝑎23 | + |𝑎21 𝑎22 |]

7 1 9 1 9 7
+| | −| | +| |
4 1 3 1 3 4
7 6 5 6 5 7
𝐶 = −| | +| | −| |
4 1 3 1 3 4
7 6 5 6 5 7
[+ |7 1
| −|
9 1
| +|
9 7]
|

3 −6 15
𝐶 = [ 17 −13 1 ]
−35 49 −28

Describing the World in 3D - Page 4


3 17 −35
𝐶 𝑇 = [−6 −13 49 ]
15 1 −28

1 3 17 −35 0.0476 0.2698 −0.5556


𝐴−1 = [−6 −13 49 ] = [−0.0952 −0.2063 0.7778 ]
63
15 1 −28 0.2381 0.0159 −0.4444

Describing the World in 3D - Page 5

You might also like