Linear Algebra 3. Linear transformations and matrices, matrix operations.
Linear transformation (LT) is like a function that transforms (changes) vector: ƒ(x) => L(v⃗)
So linear transformation takes some input vector and produces some output vector.
A transformation is linear if:
A transformation is linear if:
- all lines (of the coordinate system grid) are not become curved after transformation (horizontal, vertical and diagonal lines). In other words grid lines remain parallel and evenly spaced
- the origin remains fixed in place
Example of LT - 90° clockwise rotation about the origin. How we can describe LT numerically? We have input vector with coordinates [xin , yin] and output vector with coordinates [xout , yout] . We know that each vector is just linear combination of the basis/unit vectors, so we can rewrite coordinates like:
- [xin , yin] = xin î + yin ĵ
- linear combination remains the same even after applying LT, so we just use transformed versions of the î and ĵ => LT(î) and LT(ĵ)
- [xout , yout] = xin LT(î) + yin LT(ĵ)
Example of 90° clockwise rotation LT:
- Take squared sheet of paper and draw two unit vectors; for convenience - each with length of 2 squares.
- If we make 90° clockwise rotation LT then:
- we move î 90° clockwise - now î is down y axis and LT(î) coordinates (in terms of old greed - before transformation) are [0, -1].
- we move ĵ 90° clockwise - now ĵ lies on x axis and LT(ĵ) coordinates (in terms of old greed - before transformation) are [1, 0].
- if we have some vector v with coordinates [3,2]:
- LT(v) = 3LT(î) + 2LT(ĵ) = 3[0, -1] + 2[1,0] = [0, -3] + [2,0] = [2, -3] in terms of greed before transformation
We can describe 2D (Cartesian plane) with 4 digits - 2 for î coordinates and 2 for ĵ coordinates. We can package this coordinates in two-by-two grid of numbers - array of numbers, or in terms of LA - matrix. Matrix will have 2 columns and 2 rows:
Above we rewrote our linear combination as matrix-vector multiplication.
- columns - 1st is î coordinates and 2nd is ĵ coordinates
- rows - 1st is x axis coordinates of î and ĵ , and 2nd - y axis coordinates of î and ĵ
⌈ | 0 | 1 | ⌉ | ⋅ | ⌈ | 3 | ⌉ | = | 3 | ⋅ | ⌈ | 0 | ⌉ | + | 2 | ⋅ | ⌈ | 1 | ⌉ | = | ⌈ | 0⋅3 | + 1⋅2 | ⌉ | = | ⌈ | 2 | ⌉ |
⌊ | -1 | 0 | ⌋ | ⌊ | 2 | ⌋ | ⌊ | -1 | ⌋ | ⌊ | 0 | ⌋ | ⌊ | -1⋅3 | + 0⋅2 | ⌋ | ⌊ | -3 | ⌋ |
Above we rewrote our linear combination as matrix-vector multiplication.
By convention we denote matrix in bold upper-case, like A . And we denote elements of a matrix upper-case non-bold, like A.
Amxn is matrix with height of m (rows) and width of n (columns)
A1,1 is element at 1 row and 1 column intersection, using above example of LT matrix, A1,1= 0
To denote real valued matrix Amxn : A∈ℝmxn
Colon symbol ":" represents "all" - all rows or all columns:
- All numbers/elements of matrix on intersection with i column: A:,i
- A:,1 equals to the set {0, -1} - 1st column of A
- All numbers/elements of matrix on intersection with i row: Ai,:
- A2,: equals to the set {-1,0} - 2nd row of A
We can add matrices of the same shape by adding their corresponding elements/numbers:
C = A + B where Ci,j = Ai,j + Bi,j
⌈ | 0 | 1 | ⌉ | + | ⌈ | -3 | 8 | ⌉ | = | ⌈ | 0+(-3) | 1+8 | ⌉ | = | ⌈ | -3 | 9 | ⌉ |
⌊ | -1 | 0 | ⌋ | ⌊ | -1 | -5 | ⌋ | ⌊ | -1+(-1) | 0+(-5) | ⌋ | ⌊ | -2 | -5 | ⌋ |
To add scalar to a matrix or to multiply matrix by a scalar, we must perform addition or multiplication of each element of a matrix:
D = aB + c where Di,j = aBi,j + c
These materials were used while preparing this blog-post:
- https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab
- https://www.deeplearningbook.org/
- NBGtLA by https://minireference.com/
No comments:
Post a Comment