Vectors MM1 module 4 Poul Nielsen Vectors module 4 objectives • After this module you should have a clear understanding of: • Coordinate systems; • The properties of vectors; • Vector length, scalar multiplication, addition, and subtraction; • The dot product and its properties; • Resolving vector components; • The cross product and its properties; • How to find equations of lines; • How to find equations of planes. Slide number 1 Coordinate systems • A coordinate system is a system for specifying points in n–dimensional space using coordinates. • A coordinate is a set of n variables which fix a geometric object. • The simplest coordinate system consists of n coordinate axes oriented perpendicularly to each other, known as Cartesian coordinates (René Descartes 1637). • In this module we will focus our attention on 2– dimensional and 3–dimensional Cartesian coordinate systems. Slide number 2 Coordinate systems in 3D • Right handed coordinate systems are usually chosen by convention. z Right x Slide number 3 y • Left handed coordinate systems are occasionally encountered. Coordinate planes in 3D • The 3–dimensional Cartesian coordinate system defines 3 natural coordinate planes by taking coordinate axes in pairs. • Illustrated below are the xy–, yz–, and zx– coordinate planes, respectively. z y x Slide number 4 z z y x y x Points in 3D • A point in a 3–dimensional coordinate system can be characterised by a set of 3 real numbers, representing the distances along the x–, y–, and z–coordinate axes. • e.g. the point p at x = 4, y = –6, and z = 5. Note: the order of movement is not important –6 z z 5 p 4 4 y p y p 5 –6 x Slide number 5 –6 x z 5 4 x y Coordinate systems in 2D • In 2 dimensions right handed coordinate systems are usually chosen by convention (constructed like a 3–dimensional coordinate system with the z–coordinate axis pointing towards the viewer). • A point in a 2–dimensional coordinate system can be characterised by a set of 2 real numbers, representing the y distances along the x– and y–coordinate axes. x • e.g. the point p at x = 4, y = –6 p Slide number 6 Vector • A vector is essentially a directed arrow. • A vector has the properties of length and direction, but not position. • Two vectors are equal if they have the same length and the same direction. • A vector from point p to point q has its tail at p and its head at q. q head v p tail • A vector with its tail at the coordinate origin is sometimes called a position vector. Slide number 7 What are vectors used for? • Computer graphics; • CAD/CAM; • Characterisation of force and/or flow fields in analysis of solid and fluid systems; • Representation of state variables to describe complex systems. Slide number 8 Vector component notation • Vectors can be described in component notation as n 1 matrices where the elements represent the components of the vector along each coordinate axis. • The number of components is its dimension. • e.g. the 2–dimensional vector, v, illustrated below has components 4 and 3 units along the x– and y–axes, respectively. y It can be represented in 3 v component notation as x 4 v 3 4 Slide number 9 Specifying vectors and components • Vectors are generally denoted by lowercase, non-italicised, bold characters e.g. u, v, w will be commonly used. • Components of vectors are usually denoted by lowercase, italicised, non-bold characters with an index as a subscript e.g. u3 refers to the 3rd component of vector u. • More generally, an n–dimensional vector, v, can be written as v1 v2 v vn Slide number 10 Length of a vector • The length of a vector v, denoted |v|, can be readily calculated from its components, vi v1 v2 v if vn then v v12 v22 • e.g. for v 43 v 42 32 5 Slide number 11 vn2 y 3 v 4 x Zero vector • A zero vector, denoted 0, is a vector of length zero. • All the components of a zero vector are zero. • The zero vector is the additive identity i.e. v + 0 = v • Listed below are zero vectors for 1–, 2–, 3–, and n–dimensions 0 0 0 00 0 0 0 0 0 0 0 0 Slide number 12 Unit vector • A unit vector is a vector of length 1, sometimes called a direction vector. • An arbitrary vector, v, can be converted to a unit vector, vˆ, by dividing each of its components by its length v1 v v v2 v vˆ v vn v 4 5 • e.g. is a vector of unit length with the 3 5 same direction as the vector 4 3 Slide number 13 Base vectors… • A coordinate system provides a natural set of base vectors of unit length with direction in each of the coordinate axes. • In a 2–dimensional coordinate system with coordinate axes x and y, the base vectors are denoted xˆ and yˆ , respectively. • In a 3–dimensional coordinate system with coordinate axes y z x, y, and z, the yˆ ˆ zˆ y x x base vectors are denoted xˆ yˆ xˆ , yˆ , and zˆ x Slide number 14 …Base vectors • Any vector can be expressed in terms of its coordinate base vectors 4 ˆ ˆ 4 x 3 y 3 4 6 4 xˆ 6 yˆ 5 zˆ 5 • For an n–dimensional coordinate system with coordinates x1, x2, … xn, and base vectors xˆ 1, xˆ 2 , xˆ n v1 v2 v v1xˆ 1 v2 xˆ 2 vn xˆ n v n Slide number 15 Vector scalar multiplication • Multiplying an n–dimensional vector by a scalar results in an n–dimensional vector with each of its elements multiplied by the scalar. • e.g. 4 8 26 12 5 10 v1 cv1 v2 cv2 2v cv c v –0.5v vn cvn • Note: the length scales by c but the direction remains the same (or is reversed if c < 0). Slide number 16 Vector negation • Multiplying an n–dimensional vector by –1 results in a vector of the same length but reversed direction. v Slide number 17 –v Vector addition… • Vector addition is the operation of adding two or more vectors together into a vector sum. • For vectors u and v, the vector sum u + v is obtained by placing them head to tail and drawing the vector from the free tail to the free head. • Note that u + v = v + u • Vectors being added must have the same dimension v v u u u+v v+u u+v u Slide number 18 v u v …Vector addition • In Cartesian coordinates, vector addition can be performed simply by adding the corresponding components of the vectors u1 v1 u1 v1 u2 v2 u2 v2 u v un vn un vn • e.g. 4 4 8 3 1 4 4 xˆ 4 yˆ 4 xˆ 3yˆ 8xˆ yˆ Slide number 19 Vector subtraction… • A vector difference is the result of subtracting one vector from another. • A vector difference is denoted using the normal minus sign, i.e., the vector difference of vectors u and v is written u – v. • A vector difference is equivalent to a vector sum with the orientation of the second vector reversed, i.e. u – v = v + (–u) u v u–v –v Slide number 20 …Vector subtraction • In Cartesian coordinates, vector subtraction can be performed simply by subtracting the corresponding components of the vectors u1 v1 u1 v1 u2 v2 u2 v2 u v un vn un vn • e.g. Slide number 21 4 4 0 3 7 4 4 xˆ 4 yˆ 4 xˆ 3yˆ 0 xˆ 7 yˆ Vector between two points • If p and q are two points with position vectors p and q, respectively, then the vector joining p to q is q – p. • The finite line segment starting at p and terminating at q is denoted pq • Remember as final – initial. y x q q q–p Slide number 22 p p –p q–p q Dot product… • The dot product can be defined for two n– dimensional vectors u and v by u•v = |u| |v| cos() where is the angle between the vectors and |u| and |v| are the lengths of u and v, respectively. • Note that the dot product of two vectors results in a scalar. Slide number 23 …Dot product… • In Cartesian coordinates, the dot product can be performed by summing the products of the corresponding components of the vectors u1 v1 u2 v2 u v u1v1 u2 v2 un vn un vn • e.g. 4 4 3 4 4 4 3 4 4 4 3 6 2 4 3 6 2 5 1 5 5 1 Slide number 24 …Dot product • The dot product, u•v, has the geometric interpretation as the length of v times the length of the projection of u onto v when the two vectors are placed so that their tails coincide. projection of u on v u Slide number 25 v Dot product properties • The dot product is commutative, u•v = v•u. This follows from the definitions: u•v = |u| |v| cos() = |v| |u| cos() = v•u u•v = u1v1 + u2v2 + …unvn = v•u • The dot product is distributive, u•(v + w) = u•v + u•w • The associative property, (u•v)•w = v•(u•w), is meaningless as (u•v)•w is not defined since (u•v) is a scalar and cannot be dot multiplied. • From u•u = u12 + u22 + …un2 and u u12 u22 un2 it follows that |u|2 = u•u Slide number 26 Perpendicular vectors… • Two vectors are perpendicular if the angle between them is a right angle (i.e. /2 radians or 90°). • Since u•v = |u| |v| cos() and cos(/2) = 0, it follows that two non–zero vectors u and v are perpendicular if, and only if, u•v = 0. • e.g. 2 1 u 1 , v 2 2 1 u v 1 2 2 1 1 2 0 So u and v are perpendicular. Slide number 27 Dot product of base vectors • Recall that in a Cartesian coordinate system the base vectors are mutually perpendicular and of unit length. • Thus in 2–dimensions: xˆ xˆ 1 xˆ yˆ 0 yˆ xˆ 0 yˆ yˆ 1 in 3–dimensions: xˆ xˆ 1 xˆ yˆ 0 xˆ zˆ 0 yˆ xˆ 0 yˆ yˆ 1 yˆ zˆ 0 zˆ xˆ 0 zˆ yˆ 0 zˆ zˆ 1 in n–dimensions: xˆ 1 xˆ 1 1 xˆ 1 xˆ 2 0 xˆ 1 xˆ n 0 xˆ 2 xˆ 1 0 xˆ 2 xˆ 2 1 xˆ 2 xˆ n 0 xˆ n xˆ 1 0 xˆ n xˆ 2 0 Slide number 28 xˆ n xˆ n 1 Finding angles between vectors… • Since u•v = |u| |v| cos() and u•v = u1v1 + u2v2 + …unvn the dot product can be used to find the angle, , between vectors u and v u v u1v1 u2 v2 un vn cos uv uv 4 4 , v • e.g. u 4 3 u 4 2 4 32, v 4 2 32 5 2 Slide number 29 4 4 u v 4 3 4 4 4 3 4 uv 4 cos 0.14142 81.87 uv 32 5 …Finding angles between vectors • e.g. 4 3 u 6, v 2 5 1 u 4 2 6 5 2 75 2 v 32 2 2 1 14 2 4 3 u v 6 2 4 3 6 2 5 1 5 5 1 uv 5 cos 0.15430 98.88 uv 75 14 Slide number 30 Projection of vector on vector… • Given a vector u, find its projection p in the direction of vector v. p u cos u vˆ cos , since vˆ 1 u vˆ v v u v p p vˆ u vˆ vˆ u v 2 v v v u v 2 v p v, since v v v p v v u Slide number 31 …Projection of vector on vector • e.g. find the projection of u on v, where 3 1 u 2, v 1 4 1 u v 31 2 1 4 1 3 v v 11 11 1 1 3 u v 3 1 1 p v 1 1 v v 3 1 1 Slide number 32 Resolving vector components… • The projection formula can be used to resolve a vector, u, parallel, u||, and perpendicular, u, to a direction, v. v u v u u|| v v v u u u u|| u • e.g. resolve u into vectors parallel and perpendicular to v, where 0 1 u , v 4 1 u v 4 1 2 u|| 2 v 1 v v 2 2 2 u u u|| 0 2 2 4 Slide number 33 …Resolving vector components • e.g. resolve the vector, u, parallel, u||, and perpendicular, u, to the vector, v, where 2 1 u 6, v 1 2 1 u v 6 1 2 u|| v 1 2 v v 3 1 2 2 2 0 u u u|| 6 2 4 2 2 4 Slide number 34 Cross product… • For 3–dimensional vectors u and v, the cross product is defined as uv = |u| |v| sin() nˆ where is the angle between the vectors, |u| and |v| are the lengths of u and v, and nˆ is the unit vector normal to the plane containing u and v. • The cross product uses the uv right hand rule to determine the direction of the result. Right v i.e. u, v, and uv form a right handed system. u Slide number 35 …Cross product • Ensure that you understand how to orient uv relative to u and v using the right hand rule. uv u v u uv v v Slide number 36 uv uv u u uv v u v u uv v Cross product properties • The cross product is anti–commutative, uv = –vu. This is a consequence of the right hand rule. • The cross product is distributive, u(v + w) = uv + uw • For a scalar c, (cu)v = c(uv) • Note that the cross product operates on two 3–dimensional vectors to produce a 3– dimensional vector perpendicular to the first two. • Question: What do you get when you cross a mountain-climber with a mosquito? Answer: Nothing: you can't cross a scaler with a vector. Slide number 37 Aside: determinant of 33 matrix… • Determinants are very useful in the analysis and solution of systems of linear equations. A nonhomogeneous system of linear equations has a unique solution iff the determinant of the system's matrix is nonzero (i.e., the matrix is nonsingular) • Recall that if A is a 2 2 matrix, then the determinant of A is denoted by det(A) = |A| = a11 a22 – a21 a12 • e.g. 2 5 5 2 3 1 5 11 det 1 3 2 1 3 Slide number 38 …Aside: determinant of 33 matrix… • If A is a 3 3 matrix, then the determinant of A may be calculated using the formula a11 a12 a13 A deta21 a22 a23 a a a 31 33 32 a21 a23 a22 a23 a11 det a12 det a a a a 31 32 33 33 a21 a22 a13 det a31 a32 a11a22 a33 a11a23 a32 a12 a21a33 a12 a23 a31 a13 a21a32 a21a22 a31 Slide number 39 …Aside: determinant of 33 matrix… • Remember using the following pattern a11 a12 a13 A deta21 a22 a23 a31 a32 a33 a a a23 a11 det 22 a12 det 21 a32 a33 a31 a a23 a13 det 21 a33 a31 a22 a32 a11 a12 a13 A deta21 a22 a23 a31 a32 a33 a a a23 a11 det 22 a12 det 21 a32 a33 a31 a a23 a13 det 21 a33 a31 a22 a32 a11 a12 a13 A deta21 a22 a23 a31 a32 a33 a a a23 a11 det 22 a12 det 21 a32 a33 a31 a a23 a13 det 21 a33 a31 a22 a32 Slide number 40 …Aside: determinant of 33 matrix… • e.g. 3 2 9 A 1 4 2 2 8 4 3 2 9 A det 1 4 2 2 8 4 4 2 2 det 1 2 9det 1 4 3det8 4 2 4 2 8 316 16 24 4 98 8 9616 0 112 Slide number 41 …Aside: determinant of 33 matrix • e.g. 1 2 1 A 3 4 3 1 2 1 1 2 1 A det 3 4 3 1 2 1 3 2 det 3 3 1det 3 4 1det4 2 1 1 1 1 2 14 6 23 3 16 4 10 0 10 20 Slide number 42 Cross product calculation… • In Cartesian coordinates, the cross product can be calculated using the following method u1 v1 u u2 , v v2 u3 v3 xˆ yˆ zˆ u v detu1 u2 u3 v1 v2 v3 xˆ u2 v3 u3v2 yˆ u1v3 u3v1 zˆ u1v2 u2 v1 u2 v3 u3v2 u3v1 u1v3 u1v2 u2 v1 Slide number 43 …Cross product calculation… • Remember using the following pattern xˆ yˆ zˆ u v detu1 u2 u3 v v v 1 2 3 xˆ u2 v3 u3v2 yˆ u1v3 u3v1 zˆ u1v2 u2 v1 xˆ yˆ zˆ u v detu1 u2 u3 v v v 1 2 3 xˆ u2 v3 u3v2 yˆ u1v3 u3v1 zˆ u1v2 u2 v1 xˆ yˆ zˆ u v detu1 u2 u3 v v v 1 2 3 xˆ u2 v3 u3v2 yˆ u1v3 u3v1 zˆ u1v2 u2 v1 Slide number 44 …Cross product calculation… • e.g. 3 1 u 2 , v 3 3 2 xˆ yˆ zˆ u v det3 2 3 1 3 2 xˆ 4 9 yˆ 6 3 zˆ 9 2 13xˆ 9 yˆ 7 zˆ 13 9 7 Slide number 45 …Cross product calculation • e.g. 1 2 u 2 , v 1 1 1 xˆ yˆ zˆ u v det1 2 1 2 1 1 xˆ 2 1 yˆ 1 2 zˆ 1 4 3xˆ 3yˆ 3zˆ 3 3 3 Slide number 46 Area of a parallelogram • If a parallelogram is defined by the vectors u and v then the area of the parallelogram is given by |u v| • i.e. area base height u v sin uv v u Slide number 47 |u|sin() Lines • A line is a straight one-dimensional figure having no thickness and extending infinitely in both directions. A line is sometimes called a straight line. • A line is uniquely determined by either: • two points; or • a point and a direction vector. Slide number 48 Line defined by two points… • The line passing through points p and q is denoted pq • Recall that if p and q are two points with position vectors p and q, respectively, then the vector joining p to q is q – p. • We can thus define the line that passes through points p and q parametrically as x = p + (q – p)t where t is a parameter that defines the position on the line (i.e. x = p at t = 0, and x = q at t = 1). p q Slide number 49 …Line defined by two points • e.g. find an equation that defines the line that passes through points p and q where 1 2 p 3, q 5 4 9 x p q pt 1 2 1 3 t 5 3 4 9 4 1 3 3 2 t 4 5 x 1 3t, y 3 2t, z 4 5t p q Slide number 50 Line defined by a point and vector… • We can also define the line that passes through a point p in the direction of a vector u parametrically as x = p + ut where t is a parameter that defines the position on the line (i.e. x = p at t = 0, and x = p + u at t = 1). • Note that this is the same equation as that obtained for the line defined by two points, p and q, where u = q – p. p u Slide number 51 …Line defined by a point and vector • e.g. find an equation that defines the line that passes through the point p in the direction of a vector u where 1 3 p 3, u 2 4 5 x p ut 1 3 3 2 t 4 5 x 1 3t, y 3 2t, z 4 5t p u Slide number 52 Planes… • A plane is a 2–dimensional surface in a 3– dimensional space. • More generally, a hyperplane is an (n–1)– dimensional vector subspace in an n– dimensional vector space. • In this module we will be dealing only with planes in 3D. • A plane is uniquely determined by either: • • • • Slide number 53 Three points; or Two points and a direction vector; or One point and two direction vectors; or One point and a normal vector. …Planes… • One way to think of a plane is as a flat surface with a handle perpendicular to the surface. • The handle, or normal vector, determines the orientation of the plane. • The magnitude of the (non–zero) normal vector does not affect the orientation of the plane. Slide number 54 …Planes • Specifying the normal vector does not uniquely determine the plane. • We need to choose a point to fix an individual plane. Slide number 55 Plane defined by one point and a normal vector… • The equation of a plane passing through the point p with a non–zero normal vector n can be defined by n • (x – p) = 0 or, equivalently, n • x = n • p where x is any point in the plane. • Note that this equation states that any vector starting from the point p and ending on a point in the plane must be perpendicular to the n normal vector n. x p Slide number 56 …Plane defined by one point and a normal vector… • e.g. find the equation of the plane passing through the point p with normal vector n, where 1 1 p 3, n 3 2 4 nx np 1 x 1 1 3 y 3 3 4 z 4 2 x 3y 4z 1 9 8 16 Slide number 57 …Plane defined by one point and a normal vector… • e.g. find the equation of the plane passing through the point p with normal vector n, where 4 5 p 5 , n 4 2 1 nx np 5 x 5 4 4 y 4 5 1 z 1 2 5x 4y z 20 20 2 2 Slide number 58 …Plane defined by one point and a normal vector • Note that the coefficients of x, y, and z in the equation for a plane are simply the components of the normal vector • i.e. a normal vector to the plane defined by ax + by + cz = d is a n b c • e.g. a normal vector to the plane defined by –5x – 4y + z = –2 is 5 n 4 1 Slide number 59 Plane intercepts coordinate axes… • The plane defined by the equation ax + by + cz = d crosses the x–, y–, and z–axes at the points x = d/a, y = d/b, and z = d/c, respectively. • This plane lies at a distance from the origin of d D a2 b2 c2 • A plane crossing the x–, y–, and z–axes at the points x = a’, y = b’, and z = c’, respectively, can be defined by the equation x y z 1 a b c Slide number 60 …Plane intercepts coordinate axes • e.g. a plane defined by the equation 3x – 2y + z = 6 crosses the x–, y–, and z–axes at the points 2 0 0 0, 3, and 0 0 0 6 lies at a distance 6 6 D 2 2 2 14 3 2 1 from the origin, and can be described also by the equation x y z 1 2 3 6 Slide number 61 Plane defined by three points… • Consider a plane passing through three points p, q, and r. • First, choose point p and calculate the vectors joining p to q, (q – p), and p to r, (r – p). • Next find the normal to the plane by taking the cross product n = (q – p) (r – p). • Finally, use the formula for defining a plane from a point, p, and normal vector, n. n x r p q Slide number 62 …Plane defined by three points… • e.g. find the plane that passes through the points 2 5 3 p 1, q 2, and r 1 6 2 8 • First, choose point p and calculate the vectors joining p to q, (q – p), and p to r, (r – p) 5 2 3 3 2 1 q p 2 1 3 , r p 1 1 2 2 6 4 8 6 2 n x p r q Slide number 63 …Plane defined by three points… • Next find the normal to the plane by taking the cross product n = (q – p) (r – p) n q p r p xˆ yˆ zˆ det3 3 4 1 2 2 xˆ 6 8 yˆ 6 4 zˆ 6 3 14 10 3 n x p r q Slide number 64 …Plane defined by three points • Finally, use the formula for defining a plane from a point, p, and normal vector, n. 2 14 p 1, n 10 6 3 nx np 14 x 14 2 10 y 10 1 3 z 3 6 14x 10y 3z 281018 n 56 x p r q Slide number 65 Vectors module 4 objectives • After this module you should have a clear understanding of: • Coordinate systems; • The properties of vectors; • Vector length, scalar multiplication, addition, and subtraction; • The dot product and its properties; • Resolving vector components; • The cross product and its properties; • How to find equations of lines; • How to find equations of planes. Slide number 66