<<

Spring 2004 Math 253/501–503 • vector subtraction / vector difference: Formally, − = + (− ) 11 Three Dimensional Analytic a b a 1 b. Just subtract components slotwise. − = ,..., − ,..., = − ,..., − Geometry and Vectors a b [a1 an] [b1 bn] [a1 b1 an bn] 11.2 Vectors and the • standard vectors:InVn (the set of all n-D vectors), th Tue, 20/Jan c 2004, Art Belmonte these are the vectors e1,...en,whereek hasa1inthek slot and n − 1 zeros in its other slots. In V3,wehavethe { , , } Summary following aliases for e1 e2 e3 ,anorthonormal basis. i = e1 = [1, 0, 0] VECTORS: Terms and concepts j = e2 = [0, 1, 0] • vector: A quantity having magnitude (length) and direction. k = e3 = [0, 0, 1] .

– Geometrically, an equivalence class of directed Note that we may write a given vector in terms of standard (hyper) segments in n-D space having the same basis vectors. For example, magnitude and direction (analogy: 1 and 2 are 2 4 = , , equivalent fractions). A particular member of this a [a1 a2 a3] equivalence class has a point of application—the “tail” = [a1, 0, 0] + [0, a2, 0] + [0, 0, a3] of the vector. = a1 [1, 0, 0] + a2 [0, 1, 0] + a3 [0, 0, 1] – Analytically, an ordered n-tuple of (real) numbers, = a1i + a2j + a3k. called components or elements: a = [a1, a2,...,an]. While Stewart uses brackets h...ito delimit • : A vector whose length is 1. Given a nonzero vectors, most folks (other authors, MATLAB, TI-89) 6= −→ vector a 0, the unit vector in the direction of a is a-“hat.” use square brackets; so shall we! We also write a as a . 1 a aˆ = a = . • position vector: The distinguished member of the kak kak equivalence class that starts at the origin of n-D space. −→ • resultant vector: The vector sum of several vectors. For • AB: Vector from A (a ,...,a )to B (b ,...,b ), realized 1 n 1 n example, the resultant force is the vector sum of several as [b − a ,...,b −a ]; i.e., end−start in each slot. 1 1 n n forces. Again, the resultant velocity is the vector sum of • magnitude: The length of a (real) vector a = [a1,...,an]is several velocities.

n kak=v a2 VECTORS: Properties u k ukX=1 t In the following, c and d are scalars; a and b are vectors. via repeated application of the Pythagorean Theorem. Thus 1. a + b = b + a (commutativity) −→ n = ( − )2. AB v bk ak 2. a + (b + c) = (a + b) + c (associativity) u ukX=1 t 3. a + 0 = a (additive identity: the zero vector) • zero vector: This is the n-D vector all of whose components + (− ) = − are zero: 0 = [0, 0,...,0]. It has length zero and no specific 4. a a 0 (additive inverse of a: a) direction. 5. c (a + b) = ca + cb ( multiplication distributes over • vector addition / vector sum: Add components slotwise. vector addition.) 6. (c + d)a = ca + da (another instance of distributivity) a + b = [a1,...,an]+[b1,...,bn]=[a1 +b1,...,an +bn] 7. (cd)a = c(da) (associativity of scalar multiples) • Triangle Law / Parallelogram Law: The geometric = (head-to-tail) interpretation of vector addition. 8. 1a a • scalar: a real number or symbol [more generally, a complex number or symbol or an element of a field] DOT PRODUCT: Definitions and facts • : Given a scalar c and a vector a,the Let a = [a1,...,an]andb=[b1,...,bn]ben-D vectors. scalar multiple of c with a is obtained by multiplying each component of a by c. n • dot product (math definition): a · b = akbk ca = c [a ,...,an]=[ca ,...,can] 1 1 kX=1

1 • dot product (physics definition): a · b = kakkbkcos θ, Solution where θ is the angle between the vectors a and b; equivalent to math definition Recall the discussion of vectors in the Summary. Rewrite the vectors as a = [6, 0, 1] and b = [1, −2, 7]. (Make − a · b • angle between nonzero vectors: θ = cos 1 certain that you understand this.) We then have kakkbk √ kak = 62 + 02 + 12 = 37 • : Vectors a and b are perpendicular if and a + b = [7p, −2, 8] only if a · b = 0. a − b = [5, 2, −6] · = , , • =a b 2a [12 0 2] of b onto a:compab kak 3a + 4b = [18, 0, 3] + [4, −8, 28] = [22, −8, 31] .

a·b a Compare this with the corresponding MATLAB example. (Also • vector projection of b onto a:proj b= ; i.e., a kak kak remind me to show you on a TI-89.) the scalar projection times the unit vector in the direction of a; also known as the parallel projection 664/14 • = − orthogonal projection of b onto a:orthab b projab, whence b is the vector sum of a vector parallel to a and a Find the unit vector that has the same direction as = − + vector perpendicular to a a 2i 4j 7k.

• = · = k kk k θ work: W F d F d cos ,whereFis the (constant) Solution force vector and d is the displacement vector , − , a Rewrite a as [2 4 7]. Then • direction cosines: the components of aˆ = , the unit kak [2, −4, 7] 2 4 7 vector in the direction of a aˆ = √ = √ , −√ , √ 4 + 16 + 49  69 69 69 • direction : the function cos−1 = arccos mapped onto the direction cosine vector aˆ; gives the angles said vector 664/18 (and hence a itself) makes with the positive axes in Rn Given a = [−1, −2, −3] and b = [2, 8, −6], find the dot product a · b. DOT PRODUCT: Properties Solution Here a, b,andcare vectors and k is a scalar. We have

1. a · a = kak2 a · b = (−1)(2) + (−2)(8) + (−3)(−6) =−2−16 + 18 = 0.

2. a · b = b · a (commutativity) Therefore, a and b are orthogonal (perpendicular to one another)!

3. a · (b + c) = a · b + a · c (The dot product distributes over 664/16 vector addition.) Find a · b, given that kak = 6, kbk = 1 , and the angle between 4. (ka) · b = k(a · b) = a · (kb) (Scalars roam freely across the π 3 a and b is θ = . dot product operation.) 4

5. 0 · a = 0 (The dot product of zero vector with any other Solution vector is zero.) Via the physics definition of dot product we have √ √ · = k kk k θ = ( ) 1 2 = . Hand Examples a b a b cos 6 3 2 2   

664/10 665/34

Let a = 6i + k and b = i − 2j + 7k.Findkak,a+b,a−b,2a, Find the values of x such that the vectors v = [x, x, −1] and and 3a + 4b. w = [1, x, 6] are orthogonal.

2 Solution Solution

For the given vectors to be orthogonal (perpendicular), their dot −→ −→ −→ product must equal zero. We have a = AB = B − A = [4, 4] − [1, 3] = [3, 1]. Here is a diary file and a diagram; arrow is a command Cooper wrote. v · w = 0 (x)(1) + (x)(x) + (−1)(6) = 0 2 x + x − 6 = 0 % % Stewart 53/1 (x − 2)(x + 3) = 0 % =−, origin = [0 0]; A = [1 3]; B = [4 4]; x 32 a=B-A a= 31 arrow(A, a); hold on; axis equal 665/48 arrow(origin, a, ’r’); grid on axis([-1 5 -1 5]) = + − plot(A(1), A(2), ’ms’, ’MarkerSize’, 12); Find the scalar and vector projections of b i 6j 2k onto plot(B(1), B(2), ’gs’, ’MarkerSize’, 12) a = 2i − 3j + k. plot(0, 0, ’ks’, ’MarkerSize’, 12) % echo off; diary off Solution Stewart 53/1 5 • The scalar projection is B 4 a a · b A comp b = 3 a kak − − = √2 18 2 y 2 4 + 9 + 1 √ 1 18 9 14 a =−√ or − . 14 7 0

• −1 The vector projection is −1 0 1 2 3 4 5 x a · b a proj b = a  kak  kak , − , =−√18 [2 √ 3 1] 14 14 s053x05 =−9 , − , 7[2 3 1] 18 27 9 = − , , − . Find the sum of the vectors v = [2, 3] and w = [3, −4], then  7 7 7 illustrate geometrically.

665/54

Find the work done by a force of 20 lb acting in the direction Solution N50◦W in moving an object 4 ft due west.

+ = , − Solution We have v w [5 1]. Here is a diary file followed by a diagram that illustrates vector addition via the Triangle Law—the The angle between the force and displacement vectors is 40◦.The “head-to-tail” interpretation of vector addition. definition of work and our trusty TI-89 give ◦ W = F · d = kFkkdkcos θ = (20)(4) cos 40 ≈ 61.28 ft-lb. %  % Stewart 53/5 % v = [2 3]; w = [3 -4]; MATLAB Examples o = [0 0]; u = v + w u= 5-1 s053x01 arrow(o, v, ’b’); hold on; arrow(v, w, ’r’); arrow(o, u, ’m’) Find a vector a with representation given by the directed line axis equal; grid on −→ −→ axis([-1 6 -2 4]) segment AB connecting points A(1, 3) and B(4, 4).DrawAB % and the equivalent representation that starts at the origin. echo off; diary off

3 Stewart 53/5 37ˆ(1/2) 4 pretty(exact length of a) % ...that’s nicer! 3 1/2 37 2 % v w echo off; diary off

y 1

0 s664x14 [664/14 revisited] u = v + w −1

−2 Find the unit vector that has the same direction as −1 0 1 2 3 4 5 6 = − + x a 2i 4j 7k. s664x10 [664/10 revisited] Solution Let a = 6i + k and b = i − 2j + 7k.Findkak,a+b,a−b,2a, and 3a + 4b. MATLAB makes short work of this one too. Once again, the unitvec command is one that I wrote as part of the MATLAB VecCalc package. For help on any MATLAB command, type Solution “help command” (without the quotes) at the MATLAB command prompt. Here command is the command of interest. To see the MATLAB easily renders the needful; same with the TI-89. actual code (if it is available), type “type command.” (NOTE: The len command is not built into MATLAB. I wrote it for you as part of the effort to convert the VecCalc package to % YAP (Yet Another Platform)—MATLAB. Here is a list of the % Stewart 664/14 versions I’ve written over the years. (The MATLAB port will go % v = [2 -4 7]; % NUMERICAL vector on from week-to-week during the Spring 2004 term.) v hat = unitvec(v) % unit vector as a decimal v hat = 0.2408 -0.4815 0.8427 Maple 1994 % v = sym([2 -4 7]); % SYMBOLIC vector v hat = unitvec(v); % exact unit vector HP 48GX 1995 pretty(v hat)

TI-89 1998 [ 1/2 1/2 1/2] [2/69 69 - 4/69 69 7/69 69 ] HP 49G 1999 % echo off; diary off HP 49g+ 2004 MATLAB 2002, 2004 s664x18 [664/18 revisited] % % Stewart 664/10 % Given a = [−1, −2, −3] and b = [2, 8, −6], find the dot product a = [6 0 1]; b = [1 -2 7]; % NUMERICAL vectors a · b. length of a = len(a) % sqrt(37) as a decimal length of a= 6.0828 vector sum = a + b vector sum = Solution 7-28 vector difference = a - b % vector difference = % Stewart 664/18 52-6 % scalar multiple of a=2*a a = [-1 -2 -3]; b = [2 8 -6]; scalar multiple of a= a dot b = dot(a,b) 1202 a dot b= of a and b=3*a+4*b 0 linear combination of a and b= % 22 -8 31 % echo off; diary off a = sym([6 0 1]) % a SYMBOLIC vector

a=

[6,0,1] s665x28

exact length of a = len(a) % FORTRANesque...

exact length of a= Find, correct to the nearest degree, the three angles of the triangle with vertices P(0, −1, 6), Q(2, 1, −3),andR(5,4,2).

4 Solution s665x48 [665/48 revisited]

Render the sides of the triangles as vectors, then use another Find the scalar and vector projections of b = i + 6j − 2k onto VecCalc command I wrote, angvecdg, which gives the angle a = 2i − 3j + k. between two vectors in decimal degrees. If you look at the code, it ultimately uses a formula from the summary. Solution

% % Stewart 665/28 The double command converts an object to a double precision % P = [0 -1 6]; Q = [2 1 -3]; R = [5 4 2]; floating point decimal. PQ = Q-P, QR = R-Q, RP = P-R PQ = 22-9 % QR = % Stewart 665/48 335 % RP = a = sym([2 -3 1]); b = sym([1 6 -2]); % SYMBOLIC vectors -5 -5 4 c = comp(a,b); pretty(c) % exact scalar projection Alpha = angvecdg(PQ, -RP) Alpha = 1/2 43.0574 - 9/7 14 Beta = angvecdg(QR, -PQ) format short % the default Beta = c floated = double(c) % decimal approximation 57.7619 c floated = Gamma = angvecdg(RP, -QR) -4.8107 Gamma = format long 79.1807 c floated % full floating point precision sum of angles = Alpha + Beta + Gamma c floated = sum of angles = -4.81070235442364 180 p = proj(a,b) % exact vector projection % p= echo off; diary off Stewart 665/28 [ -18/7, 27/7, -9/7] P format short % Restore default Alpha % "Good enough for government work." p floated = double(p) p floated = -2.5714 3.8571 -1.2857 % Gamma R echo off; diary off

s665x59 Beta Find the angle between the diagonal of a cube and a diagonal of Q one of its faces.

Solution s665x40 Place the cube in the first octant with one of its corners at the Find the direction cosines and direction angles (to the nearest origin in R3. Let side length of the cube be a > 0. The endpoint = + − degree) of the vector v 3i 5j 4k. of the diagonal through the cube is A(a, a, a).Letw=[a,a,a] be the position vector from the origin to A. The origin and B(a, a, 0) form a diagonal along one of the faces of the cube. Let Solution z = [a, a, 0] be the position vector from the origin to B.Now simply compute the angle between w and z. Three commands render the needful. Radians-to-degree (r2d)is another VecCalc command. % % Stewart 665/59 % % syms a positive % Symbolic variable assumed to be positive. % Stewart 665/40 w = [a a a]; z = [a a 0]; % our angle = double(angvecdg(w,z)) v = [3 5 -4]; our angle = u = unitvec(v) % direction cosines 35.2644 u= % 0.4243 0.7071 -0.5657 echo off; diary off a = r2d(acos(u)) % direction angles in degrees a= 64.8959 45.0000 124.4499 % Here are two views of a cube with side length 1 together with the echo off; diary off relevant diagonals.

5 Stewart 665/59: View 1

1.5

1

z 0.5

0

−0.5 −0.5 0 −0.5 0.5 0 0.5 1 1 1.5 1.5 y x

Stewart 665/59: View 2

1.5

1

z 0.5

0

−0.5 −0.5 0 1.5 0.5 1 0.5 1 1.5 −0.5 0 x y

6