Recap of linear algebra: vectors, matrics, transformations, …
description
Transcript of Recap of linear algebra: vectors, matrics, transformations, …
![Page 1: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/1.jpg)
Recap of linear algebra: vectors, matrics, transformations, …
Background knowledge for 3DM
Marc van Kreveld
1
![Page 2: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/2.jpg)
Vectors, points
• A vector is an ordered pair, triple, … of (real) numbers, often written as a column
• A vector (3, 4) can be interpreted as the point with x-coordinate 3 and y-coordinate 4, so (3, 4) as well
• A vector like (2, 1, –4) can be interpreted as a point in 3-dimensional space
Three times the vector (3, 2), and the point (3, 2)
2
![Page 3: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/3.jpg)
Vectors, length
3
![Page 4: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/4.jpg)
Vector addition
• Two vectors of the same dimensionality can be added; just add the corresponding components:
(a,b) + (c,d) = (a+c, b+d)• The result is a vector of the same dimensionality• Geometric interpretation: place one arrow’s start at
the end of the other, and take the resulting arrow
purple + purple = blue
4
![Page 5: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/5.jpg)
Scalars, vectors, multiplication
• A value is also called a scalar• We can multiply a scalar k with a vector (a, b); this is
defined to be the vector (ka, kb)• Geometric interpretation where a vector is an arrow:– k = – 1 : reverse the direction of an arrow– k = 2 : double the length of an arrow; same as adding
a vector to itself
5
![Page 6: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/6.jpg)
Vector multiplication
• One type of vector multiplication is called the dot product, it yields a scalar (a value)
• Example: (a, b, c) (d, e, f) = ad + be + ef• It works in all dimensions• The dot product rule/equality for vectors u and v:
u v = |u||v| cos • Perpendicular vectors have a dot product 0
6
![Page 7: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/7.jpg)
Vector multiplication
• Another type of multiplication is the cross product, denoted by
• It applies only to two vectors in 3D and yields a vector in 3D– the result is normal to the input vectors– if the input vectors are parallel, we get
the null vector (0, 0, 0)
7
![Page 8: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/8.jpg)
Vector multiplication
• The length of the result vector of the cross product is related to the lengths of the input vectors and their angle
|a b| = |a||b| sin
In words: the length of the result a b is the area of the parallelogram with a and bas sides
8
![Page 9: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/9.jpg)
Vectors
• Other terms of importance:– linear independence– spanning a (sub)space– basis– orthogonal basis– orthonormal basis
9
![Page 10: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/10.jpg)
Matrices
• Matrices are grids of values; an m-by-n (m n) matrix consists of m rows and n columns
• An m n matrix represents a linear transformation from m-space to n-space, but it could represent many other things
10
![Page 11: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/11.jpg)
Matrices
• A linear transformation:– maps any point/vector to exactly one point/vector– maps the origin/null vector to the origin/null vector– preserves straightness: mapping a line segment (its points)
yields a line segment (its points), which can degenerate to a single point
Example:
point or vector11
![Page 12: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/12.jpg)
Matrices
mirror in y-axis
shear the x-coordinate
12
![Page 13: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/13.jpg)
Matrices
scale x and y by 1.5
rotate by = /6 radians
13
![Page 14: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/14.jpg)
Matrices
• Matrix addition: entry-wise• Multiplication with scalar: entry-wise• Multiplication of two matrices A and B:– #columns of A must match #rows of B– not commutative– AB represents the linear
transformation whereB is applied first and Ais applied second
14
![Page 15: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/15.jpg)
Matrices
• Other terms of importance:– identity matrix– rank of a matrix– determinant: converts a square matrix to a scalar
Geometric interpretation: tells something about the area/volume enlargement (2D/3D) of a matrixDet = 2 (in 2D): a transformed triangle has twice the areaDet = 0: the transformation is a projection
– matrix inversion: represents the transformation that is the reverse of what the matrix did
– Gaussian elimination: process (algorithm) that allows us to invert a matrix, or solve a set of linear equations
15
![Page 16: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/16.jpg)
Translations and matrices
• A 3x3 matrix can represent any linear transformation from 3-space to 3-space, but no other transformation
• The most important missing transformation is translation (which never maps the origin to the origin so it cannot be a linear transformation)
16
![Page 17: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/17.jpg)
Homogeneous coordinates
• Combinations of linear transformations and translations (one applied after the other) are called affine transformations
• Using homogeneous coordinates, we can use a 4x4 matrix to represent all 3-dim affine transformations (generally: (d+1)x(d+1) matrix for d-dim affine tr.)
the homogeneous coordinates of the point (a, b, c) are simply (a, b, c, 1)
17
![Page 18: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/18.jpg)
Homogeneous coordinates
• The matrix for translation by the vector (a, b, c) using homogeneous coordinates is:
Just apply this matrix to the origin = (0, 0, 0, 1) and see where it ends up: (a, b, c, 1)
18
![Page 19: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/19.jpg)
Vectors of points
• It is possible to define and use vectors of points:( (a, b), (c, d), (e,f) ) instead of vectors of scalars
• We can add two of these because vector addition is naturally defined
• We can also multiply such a thing by a scalar
( (a, b), (c, d), (e,f) ) + ( (g, h), (i, j), (k,l) ) = ( (a, b)+(g, h), (c, d)+(i, j), (e,f)+(k,l) ) =( (a+g, b+h), (c+i, d+j), (e+k, f+l) )
3 ( (a, b), (c, d), (e,f) ) = ( 3(a, b), 3(c, d), 3(e,f) ) = ( (3a, 3b), (3c, 3d), (3e, 3f) )
19
![Page 20: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/20.jpg)
Vectors of points
• We can not add such a thing and a normal 3D vector because we cannot add a scalar and a vector/point
( (a, b), (c, d), (e,f) ) + ( g, h, i ) = undefined
20
![Page 21: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/21.jpg)
Vectors of points
• We can even apply (scalar) matrices to these things:
This works be cause we know how to add points and multiply scalars and points
21
![Page 22: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/22.jpg)
Questions
22
![Page 23: Recap of linear algebra: vectors, matrics, transformations, …](https://reader035.fdocuments.net/reader035/viewer/2022062217/56815009550346895dbde01b/html5/thumbnails/23.jpg)
Questions
5. Let S be the collection of all strings. Define– addition of two strings as their concatenation– multiplication of a string with a nonnegative integer by repeating the
string as often as the value of the integer
Compute:
23