Lecture 6: Matrices
A matrix is an array of elements that follow certain rules:
A=[163−124]We use square brackets to enclose the array.
A matrix has n rows and m columns, and is said to be of order n×m.
Always mention the rows first. Thus, the above example A is 2×3
Examples
A=[100010001]is 3×3
B=[110]is 1×3
C=[1−290]is 4×1
D=[1002010400150001]is 4×4
A matrix is square if the # of rows
== # of columns
.
Some common square matrices:
- zero matrix is all
0
s - identity matrix is all
0
s except along the main diagonal (top left to bottom right) is1
s
In computer graphics, we most commonly use square 2×2, 3×3, and 4×4 matrices.
Operations
Two matrices are equal if
- they have the same
# of rows and columns
- their corresponding elements in each position are equal
If A=B, then x=2 and y=3.
Addition and Subtraction
Addition and subtraction of matrices is defined by addition and subtraction of corresponding elements.
We can only add and subtract matrices of the same order.
[21341−1]+[320010] =[2+31+23+04+01+1−1+0]=[53342−1]