2IV60 2 Base Math
2IV60 2 Base Math
H&B A-1
nD Space
nD Space: n (typically)
n : number of dimensions
Examples:
• 1D space: time, along a line or curve
• 2D space: plane, sphere
• 3D space: the world we live in
• 4D space: 3D + time
H&B A-2
Coordinates
2D Cartesian coordinates:
x
y (x,y) (x,y)
x
Standard Screen (output, input)
H&B A-1
Polar coordinates
Coordinate transformation
from (r , ) to ( x, y ) space :
y (x,y) x r cos
r y r sin
Angle : in radians
x
H&B A-1
3D coordinates 1
3D Cartesian coordinates:
z (x,y,z) z (x,y,z)
y x
x y
Right-handed Left-handed
H&B A-1
3D coordinates 2
3D Cartesian coordinates:
Right-handed Left-handed
H&B A-1
3D coordinates 3
Cylinder coordinates:
z (x,y,z) x r cos
y r sin
y
z z
x
H&B A-1
3D coordinates 4
Spherical coordinates: x r cos sin
y r sin sin
z r cos
z (x,y,z)
r : azimuth or longitude
y : elevation or latitude
x
Also : / 2
: colatitude H&B A-1
Points
• Point: position in nD space
• Notation: P (H&B), also P, p, p en p
• (x,y,z) (H&B), also (x1, x2, x3), (Px, Py, Pz),
(r, , z), ( r, , ), …
H&B A-2
Vectors 1
• Vector:
– “arrow”
– multiple interpretations (displacement, velocity,
force, …)
– has a magnitude and direction
– has no position
• Notation: V (H&B), also V, v, v en v
• (Vx, Vy, Vz) (H&B), also (x, y, z), (x1, x2, x3)
H&B A-2
Vectors 2
V P2 P1
y
P2 ( x2 x1 , y2 y1 )
y2
(Vx , V y )
P1
y1
V: directed line segment, or
difference between two points
x1 x2 x
H&B A-2
Vectors 3
Length of a vector:
V Vx2 V y2 (2D : Pythagoras)
H&B A-2
Vectors 4
Direction of a vector: Direction angles.
Vx Vy Vz
cos , cos , cos z
V V V
Unit vector V :
V y
V x
|V|
Magnitude info is removed, direction is kept.
H&B A-2
Vector addition
Add components, put vector head to tail
y W y V+W
W
V
V
x x
V W (Vx Wx ,V y W y , Vz Wz )
H&B A-2
Scalar multiplication of vector
Multiplication components with scalar s
y y
2V
V
x x
y V
P t
V V W V W cos
H&B A-2
Vector multiplication 2
Scalar product:
V W V W cos
VxWx V yW y VzWz
Commutative : V W W V
Distributive : V (W Z) V W V Z
n perpendicular to V and W
V W n V W sin
VW (V yWz VzW y ,
W VzWx VxWz ,
VxW y V yWx )
n V
H&B A-2
Vector multiplication 5
Scalar product:
Anticommutative : V W W V
Not associative : V (W Z) (V W ) Z
Distributive : V (W Z) V W V Z
H&B A-2
Vector multiplication 6
Scalar product: Vector product:
• scalar • vector
• Test if vectors are • Get a vector
perpendicular perpendicular to two
given vectors
• cos • sin
• project,… • surface area,…
H&B A-2
Exercise 1
• Given a point P.
• Requested: Reflect a point Q with respect to P.
Q W=P–Q
W P Q’ = Q + 2W
y
W
Q’
= 2P – Q
or: = P + (P – Q )
x We don’t need coordinates!
Exercise 1
• Given a point P.
• Requested: Reflect a point Q with respect to P.
Q Alternative
P P is halfway Q and Q’:
Q’
P = (Q + Q’)/2
2P = Q + Q’
Q’ = 2P – Q
Exercise 2
• Given a line L: L(t) = P + Vt .
• Requested: Reflect a point Q with respect to L.
Q We know:
W Q’ = Q + 2 W
V L(t)
y P W W = L(t) – Q
t Q’
W. V = 0
x
Exercise 2
We know: Substitute to get t:
L(t) = P + Vt (L(t) – Q).V = 0
Q’ = Q + 2 W (P + Vt – Q).V = 0
W = L(t) – Q V .V t + (P – Q).V = 0
W. V = 0 t = ((Q – P).V) / (V .V)
Then:
Q’ = Q + 2 (P + Vt – Q)
= 2P – Q + 2V((Q – P).V / V .V)
Steps to be made
• Write down what you know
• Eliminate, substitute, etc. to get he result
• Check the result
– Does it make sense?
– Is there a simpler derivation?
Exercise 3
• Given a triangle with vertices P, Q en R,
where the angle PQR is perpendicular.
• Requested: Rotate the triangle around the
line PQ over an angle What is the new
position R’ of R? P
Q R’
R
Circle in space
y
C() C()
r
B B
A
P A x P
P
B
Q R’
A
R
Use:
• Scalar product, cross product
• coordinate independent definitions
• vector algebra
Don’t use:
• arccos, arcsin
• y = f(x)
Very short intro to Linear Algebra
System of linear equations:
u 2 x 3 y 4 z
v x 5 y 3z
w 5 x y z
H&B A-5
Very short intro to Linear Algebra
System of linear equations:
Typical questions:
- Given u, v, w, what are x, y, z?
- Can we find a unique solution?
u 2 x 3 y 4 z
v x 5 y 3z
w 5 x y z
H&B A-5
Very short intro to Linear Algebra
System of linear equations:
u 2 x 3 y 4 z
v x 5 y 3z
w 5 x y z
H&B A-5
Example transformation
Transformation P P ':
y
P : ( x, y ) P: (x,y)
P ' xU yV , with x
U (3,2)
y’
V ( 2 ,3)
P’
In coordinates : V
x' 3x 2 y U
y x
y ' 2 x 3 y x’
H&B A-5
What is a matrix?
Matrix:
- Mathematical objects with operations
H&B A-5
Matrix
Matrix: rectangular array of elements
Element: quantity (value, expression, function, …)
Examples:
x
3.60 0.01 2.1 e x
x
5.46 0.00 1.6 , 2 x 2
, a1 a2 a3 , y
e x
z
H&B A-5
Matrix
r c matrix: r rows, c columns
mij : element at row i and column j.
ux vx wx
M U V W u y vy w y
u z vz wz W
H&B A-5
Operations on matrices
• Multiplication with scalar
– simple
• Addition
– simple
• Matrix-matrix multiplication
– More difficult, but the most important
H&B A-5
Scalar Matrix multiplication
Matrix M multiplied with scalar s:
sm11 sm12 sm1c
sm sm2c
21 sm22
A sM , i.e., aij smij
smr1 smr 2 smrc
3 x 12 x 4
example : 3
6 2 y 2 y
H&B A-5
Scalar Matrix addition
a11 a12 a1c b11 b12 b1c
a b b2c
21 a 22 a 2 c 21 b22
M A B
a
r1 a r2 a rc br1 br 2 brc
a11 b11 a12 b12 a1c b1c
a b a b a b
21 21 22 22 2c 2c
, i.e., mij aij bij
a
r 1 r1b a r2 b r2 a rc brc
3 x 12 4 10 3 x 4 2
example :
6 2 y 2 0 8 2 y
H&B A-5
Scalar Matrix addition
a11 a12 a1c b11 b12 b1c
a b b2c
21 a 22 a 2 c 21 b22
M A B
ar1 ar 2 arc br1 br 2 brc
a11 b11 a12 b12 a1c b1c
a b a b a b
21 21 22 22 2c 2c
, i.e., mij aij bij
ar1 br1 ar 2 br 2 arc brc
2 3 2 1 3 3 2 2 3 4 11 16
1 4 1 2 1 1 4 3 1 2 4 4 13 16
3 4
0 5 0 1 5 3 0 2 5 4 15 20
i=3 j=2 i=3, j=2
H&B A-5
Matrix Matrix multiplication
Example:
4
A 1 2 3 , B 5
6
AB
BA
H&B A-5
Matrix Matrix multiplication
Example:
4
A 1 2 3 , B 5
6
4
AB 1 2 3 5 1 4 2 5 3 6 32
6
BA
H&B A-5
Matrix Matrix multiplication
Example:
4
A 1 2 3 , B 5 AB
6 BA
4
AB 1 2 3 5 1 4 2 5 3 6 32
6
4 4 1 4 2 4 3 4 8 12
BA 5 1 2 3 5 1 5 2 5 3 5 10 15
6 6 1 6 2 6 3 6 12 18
H&B A-5
Matrix Matrix multiplication
• AB BA
Matrix matrix multiplication is not commutative!
Order matters!
• A(B+C) = AB+AC
Matrix matrix multiplication is distributive
H&B A-5
Example transformation sequence
(coordinate version)
X ' X : x' px qy, y ' rx sy;
X ' ' X ': x' ' ax'by ' , y ' ' cx'dy '.
x' ' a b p q x ap br aq bs x
y ' ' c d r s y cp dr cq ds y
H&B A-5
Example transformation sequence
(compact matrix vector version)
X ' X : X' AX ; Here some more detail :
X ' ' X ': X'' BX' x x' x' '
X , X' ' , X' ' ,
y y ' y ' '
Then X ' ' X : p q a b
A ; B .
r s c d
X'' BAX
1 4
T x
1 2 3 2 5 ,
examples : [x y z ]T y
4 5 6 H&B A-5
3 6 z
Matrix Inverse
Simple algebra puzzle. Let ax = b. What is x?
ax b Multiply left and right with a 1
a 1ax a 1b Use a 1a equals 1
x a 1b Done
H&B A-5
Matrix Inverse
Inverse of a n n (square) matrix M is denoted M 1 , with
MM 1 M 1M I,
where I is the identity matrix :
1 0 0
0 0
1 1 if i j
I , i.e., I ij .
0 if i j
0 0 1
I is a diagonal matrix, with all 1' s on the diagonal.
M 1 " undoes" the effect of M,
multiplying with I has no effect.
H&B A-5
Matrix Inverse examples
4 1 1 / 4
1
3 2 2 1
5
4 5 / 2 3 / 2
3 2 2 1 3 2 2 5 / 2 3 1 2 3 / 2 1 0
5
4 5 / 2 3 / 2 5 2 4 5 / 2 5 1 4 3 / 2 0 1
H&B A-5
Matrix Inverse examples
1
a b
c d ?
1
a b 1 d b
c d
ad bc c a
a b d b ad bc ab ba 1 0
c d c (ad bc)
a ab ba cb ad 0 1
1
2 1
4 2 ? Does not exist, cannot be inverted.
H&B A-5
Matrix Inverse
- Does not always exist
- In general: if determinant = | M | = 0, matrix
cannot be inverted
- Inverse for n = 1 and n = 2: easy
- Inverse for higher n: use library function
- Important special case: orthonormal matrix.
H&B A-5
Overview
• Coordinates, points, vectors
– definitions, operations, examples
• Matrices
– definitions, operations, examples