-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchapter2.tex
More file actions
3340 lines (2985 loc) · 128 KB
/
Copy pathchapter2.tex
File metadata and controls
3340 lines (2985 loc) · 128 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{Vectors and Geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Chapter Introduction}
This chapter contains an introduction to vectors, which correspond to
points in two, three and higher dimensional spaces. In this chapter,
you will become familiar with basic vector operations such as
addition, scalar multiplication, length, the dot product, and the
cross product (for three dimensional vectors). Vector representation
of lines in 2D and 3D and planes in 3D are presented. Criteria for when
such objects intersect at unique points is given in terms of
determinants. This geometric presentation motivates our study of these
kind of problems in higher dimensional settings in later
chapters. Throughout this chapter, MATLAB commands are introduced that
perform the operations described in the text. For 2D and 3D problems,
using MATLAB is only a convenience. For higher dimensions, doing the
computations by hand (even with a calculator) is impractical, and a
computational framework like MATLAB is essential to be able to solve
these problems.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Vectors}
Vectors are used to describe quantities that have both a magnitude and
a direction. You are probably familiar with vector quantities in two
and three dimensions, such as forces and velocities.
Later in this course we will see that vectors can also describe the
configuration of a mechanical system of weights and springs, or the
collections of voltages and currents in an electrical circuit. These
more abstract vector quantities are not so easily visualized since
they take values in higher dimensional spaces.
We begin this course by discussing the geometry of vectors in two and
three dimensions. In two and three dimensions, vectors can be
visualized as arrows. Before we can draw a vector, we have to decide
where to place the tail of the vector. If we are drawing forces, we
usually put the tail of the vector at the place where the force is
applied. For example, in Figure~\ref{fig_pend} (left)
the forces acting on a pendulum
bob are gravity and the restraining force along the shaft.
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_pend}
\includegraphics[height=1.5in]{2_velocity}}
\caption{Forces acting on a pendulum (left) and
position and velocity of a particle (right) \label{fig_pend}}
\end{figure}
If we are drawing the velocity of a particle at a given time, we would
place the tail of the velocity vector ${\bf v}(t)$ at the position of
the particle at that time as shown in Figure~\ref{fig_pend} (right).
Once we have chosen a starting point for the tails of our vectors
(i.e., an origin for space), every point in space corresponds to
exactly one vector, namely the vector whose tail is at the origin and
whose head is at the given point. For example, in Figure~\ref{fig_pend}
(right)
we have chosen an arbitrary point as the origin (marked with a circle)
and identified the position of the particle with the vector ${\bf
r}(t)$.
\subsection{Multiplication by a number and vector addition}
There are two basic operations defined for vectors. One is
multiplication of a vector by a number (also called scalar
multiplication). The other is addition of two vectors.
A vector $\aa$ can be multiplied by a number (or scalar) $s$ to
produce a new vector $s\aa$. If $s$ is positive then $s\aa$ points in
the same direction as $\aa$ and has length $s$ times the length of
$\aa$. This is shown in Figure~\ref{fig_scalarmult}.
If $s$ is negative then $s\aa$ points in the direction opposite
to $\aa$ and has length $|s|$ times the length of $\aa$.
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_scalarmult}}
\caption{Scalar multiplication. \label{fig_scalarmult}}
\end{figure}
To add two vectors $\aa$ and $\bb$ and we draw the parallelogram that
has $\aa$ and $\bb$ as two of its sides as shown in Figure~\ref{fig_add}.
The vector $\aa + \bb$ has
its tail at the origin and its head at the vertex of the parallelogram
opposite the origin. Alternatively we can imagine sliding (or
translating) one of the vectors, without changing its direction, so
that its tail sits on the head of the other vector. (In the diagram we
translated the vector $\aa$.) The sum $\aa + \bb$ is then the vector
whose tail is at the origin and whose head coincides with the vector
we moved.
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_add}}
\caption{Vector Addition. \label{fig_add}}
\end{figure}
\begin{example}
\label{2009_a1_3}
Describe and sketch the following set of points $\{ s {\bf a} :
s \in \mathbb{R} \}$ (that is, the set of all scalar multiples of $\bf a$) where
$\bf a$ is a non-zero vector in $\mathbb{R}^2$. {\rm The set is a straight line
going through the origin with direction $\bf a$ as shown in
Figure~\ref{ch2exnew1}.}
\end{example}
\begin{figure}[htb]
\centerline{\includegraphics[height=3in]{2_2009_a1_3}}
\caption{Figure for Example \ref{2009_a1_3}. \label{ch2exnew1}}
\end{figure}
\subsection{Co-ordinates}
In order to do calculations with vectors, we have to introduce
co-ordinate axes. Once we have chosen in what directions the
co-ordinate axes will lie, we can specify a vector by giving its
components in the co-ordinate directions.
\begin{figure}
\centerline{\includegraphics[height=2in]{2_coords}}
\caption{Two choices of co-ordinate axes. \label{fig_coords}}
\end{figure}
In the Figure~\ref{fig_coords}
we see two choices of $x$ and $y$ axes. For the first
choice of axes, the vector $\aa$ has co-ordinates $[5,3]$ and for the
second choice of axes the co-ordinates are $[\sqrt{34},0]$. In a given
problem, it makes sense to choose the axes so that at least some of
the vectors have a simple representation. For example, in analyzing
the forces acting on a pendulum, we would either choose the $y$ axis
either to be vertical, or to lie along the shaft of the pendulum.
We can choose to write the co-ordinates of a vector in a row, as
above, or in a column, like
\[
\left[ \begin{array}{c}
5 \\ 3 \end{array}
\right]
\]
Later on, we will almost always write vectors as columns. But in this
chapter we will write vectors as rows. Writing vectors as rows saves
space on the page but we will learn later how to write vectors in row
form even when we want them to be column vectors for other reasons.
{\bf Note:} When writing vector coordinates by hand or in this text, either
square or round brackets can be used. However, when using MATLAB,
vectors must be created with square brackets (round brackets are used
for other purposes). Other packages such as the online homework system,
WeBWorK, may require different syntax.
A convenient way to choose the co-ordinate axes is to specify unit
vectors (that is, vectors of length one) that lie along each of the
axes. These vectors are called standard basis vectors and are denoted
${\bf i}$ and ${\bf j}$ (in two dimensions) and ${\bf i}$, ${\bf j}$
and ${\bf k}$ (in three dimensions). These vectors are shown in
Figure~\ref{fig_unitvecs}. Sometimes they are also denoted
${\bf e}_1$ and ${\bf e}_2$ or $\hat{\imath}$ and $\hat{\jmath}$
(in two dimensions) and ${\bf e}_1$,
${\bf e}_2$ and ${\bf e}_3$ or $\hat{\imath}$, $\hat{\jmath}$ and $\hat{k}$ (in three dimensions).
Different application areas have different conventions.
\begin{figure}
\centerline{\includegraphics[height=2in]{2_unitvecs}}
\caption{Unit vectors in 2D (left) and 3D (right). \label{fig_unitvecs}}
\end{figure}
The unit vectors have co-ordinates
\begin{eqnarray*}
{\bf i} &=& {\bf e}_1=[1,0] \\
{\bf j} &=& {\bf e}_2=[0,1]
\end{eqnarray*}
in two dimensions, and
\begin{eqnarray*}
{\bf i}&=&{\bf e}_1=[1,0,0] \\
{\bf j}&=&{\bf e}_2=[0,1,0] \\
{\bf k}&=&{\bf e}_3=[0,0,1]
\end{eqnarray*}
in three dimensions.
Often, we make no distinction between a vector and its co-ordinate
representation. In other words, we regard the co-ordinate axes as
being fixed once and for all. Then a vector in two dimensions is
simply a list of two numbers (the components) $[a_1,a_2]$, and a
vector in three dimensions is a list of three numbers
$[a_1,a_2,a_3]$. Vectors in higher dimensions are now easy to
define. A vector in $n$ dimensions is a list of $n$ numbers
$[a_1,a_2,\ldots,a_n]$.
When a vector is multiplied by a number, each component is scaled by
the same amount. Thus if $\aa = [a_1,a_2]$, then
\begin{eqnarray*}
s\aa &=& s[a_1,a_2] \\
&=& [sa_1,sa_2]
\end{eqnarray*}
Similarly, when two vectors are added, their co-ordinates are added
component-wise. So if $\aa = [a_1,a_2]$ and $\bb=[b_1,b_2]$, then
\begin{eqnarray*}
\aa+\bb&=&[a_1,a_2]+[b_1,b_2]\\
&=&[a_1+b_1,a_2+b_2]
\end{eqnarray*}
This is shown in Figure~\ref{fig_coordadd}.
\begin{figure}
\centerline{\includegraphics[height=2in]{2_coordadd}}
\caption{Adding vector co-ordinates. \label{fig_coordadd}}
\end{figure}
The analogous formulae hold in three (and higher dimensions). If
$\aa=[a_1,a_2,\ldots,a_n]$ and $\bb = [b_1,b_2,\ldots,b_n]$, then
\begin{eqnarray*}
s\aa &=& s[a_1,a_2,\ldots,a_n]\\
&=&[sa_1,sa_2,\ldots,sa_n]\\
\aa+\bb&=&[a_1,a_2,\ldots,a_n]+[b_1,b_2,\ldots,b_n]\\
&=&[a_1+b_1,a_2+b_2,\ldots,a_n+b_n]
\end{eqnarray*}
\begin{example}
\label{2008_a1_1}
Sketch axes $x_1$-$x_2$. Add the vectors $[1,1]$ and $[2,-1]$ to
your sketch. Draw these vectors with base point at the origin. Now add
the vector $[1,-2]$ to your sketch, starting at the base point
$[1,1]$. That is, draw the vector with components 1 to the right and 2
down starting at $[1,1]$. {\bf Note:}\ your sketch should show
graphically that $[1,1]+[1,-2]=[2,-1]$. {\rm See Figure~\ref{ch2exnew2}.}
\end{example}
\begin{figure}[htb]
\centerline{\includegraphics[height=1.5in]{2_newfig1}}
\caption{Figure for example \ref{2008_a1_1} \label{ch2exnew2}}
\end{figure}
\subsection{Properties of vector addition and scalar multiplication}
Let $\zv$ denote the zero vector. This is the vector all of whose
components are zero. The following properties are intuitive and easy
to verify.
\begin{enumerate}
\item $\aa+\bb=\bb+\aa$
\item $\aa+(\bb+\cc)=(\aa+\bb)+\cc$
\item $\aa+\zv=\aa$
\item $\aa+(-\aa)= \zv$
\item $s(\aa+\bb)=(s\aa+s\bb)$
\item $(s+t)\aa=s\aa+t\aa$
\item $(st)\aa=s(t\aa)$
\item $1\aa=\aa$
\end{enumerate}
They follow from similar properties which hold for numbers. For
example, for numbers $a_1$ and $b_1$ we know that $a_1+b_1 =
b_1+a_1$. Thus
\begin{eqnarray*}
\aa + \bb & = & [a_1,a_2]+[b_1,b_2] \\
& = & [a_1+b_1,a_2+b_2] = [b_1+a_1,b_2+a_2] \\
& = & [b_1,b_2]+[a_1,a_2] = \bb+ \aa, \\
\end{eqnarray*}
so property 1 holds. Convince yourself that the rest of these
properties are true. (What is the vector $-\aa$?). It might seem like
a waste of time fussing over obvious properties such as
these. However, we will see when we come to the cross product and
matrix product, that sometimes such ``obvious'' properties turn out to
be false! It is important to know what the allowable operations for vectors
(and matrices which we will see in later chapters) are since we will be doing
algebra to solve matrix and vector equations. We will take special care to
highlight the operations that have different properties from the scalar case.
\subsection{MATLAB: basic scalar and vector operations}
There are MATLAB computer labs that accompany this course at UBC. You will be given
an account on the Mathematics Department undergraduate network and instructions
on how to access the computers in the labs and start the MATLAB application.
A freely available google application, Octave, can execute all of the commands in the course
with the same syntax.
In the command window at the prompt {\tt >>} (MATLAB) or $\rhd$ (Octave),
you can type MATLAB commands directly. Some basic commands are given below
\begin{description}
\item[{\bf assignment:}] Scalar and vector variables can be assigned
using the ``='' operator. For example
\begin{verbatim}
a = 2
\end{verbatim}
followed by {\tt <enter>}
assigns the scalar value of 2 to the variable {\tt a}. The result
of the command is printed out although this can be suppressed by using a
colon at the end of the command:
\begin{verbatim}
a = 2;
\end{verbatim}
Here {\tt a} is still assigned the value of 2 but no output is generated.
Vector variables are assigned with the following notation:
\begin{verbatim}
b = [1 2];
\end{verbatim}
Note that {\tt b = [1, 2]} has the same meaning in MATLAB, i.e., numbers separated by a comma or a space imply row vectors. For column vectors, the entries have to be separated by semicolons:
\begin{verbatim}
b1 = [2; 3];
\end{verbatim}
Note also that there are no special distinctions between the names of scalar and
vector variables.
\item[{\bf addition:}] Both scalar and vector addition can be done with
the ``+'' operator. Keeping the values of scalar {\tt a} and vector {\tt b}
above, we enter the commands
\begin{verbatim}
a2 = 5;
b2 = [2 9];
a+a2
c = b+b2;
\end{verbatim}
The first two lines above assign a new scalar and vector. The third line
prints out the answer 7, namely $2+5$. The last line assigns the resulting vector
{\tt [3 11]}, namely {\tt [1 2] + [2 9]}, to the new vector {\tt c} but prints nothing.
\item[{\bf scalar multiplication}] Scalar multiplication (of vectors and
other scalars) is implemented using the ``$*$'' command. Using the variables
defined above,
\begin{verbatim}
a*a2
a*b
\end{verbatim}
would result in 10, namely 2 times 5, and {\tt [2 4]}, namely 2 times {\tt [1 2]}.
The ``$*$'' command
also implements matrix-vector and matrix-matrix multiplication discussed
later in the course. Vector-vector multiplication (dot products and
cross products) are implemented using different commands as discussed in the
next section.
\item[{\bf other commands:}] There are many useful functions built
in to MATLAB such as {\tt sqrt} (square root), {\tt cos} (cosine, taking
an argument in radians), {\tt acos} (inverse cosine, giving an result
in radians) and many more. They are called as follows
\begin{verbatim}
sqrt(2)
\end{verbatim}
which will return $\sqrt{2}$ to 4 decimal places. Type {\tt help} followed
by a command name gives you a description of that command. Try
typing {\tt help atan2} since {\tt atan2} is a pretty useful function.
These MATLAB functions can take vector arguments, they act on each
entry of the vector. For example
\begin{verbatim}
sqrt([1 4])
\end{verbatim}
will produce the vector {\tt [1 2]}.
\end{description}
\subsection{Problems}
\begin{problem}
\label{2009_a1_1}
Sketch axes $x_1$-$x_2$. Add the vectors $[2,2]$ and $[1,-1]$ to
your sketch. Draw these vectors with base point at the origin. Now add
the vector $[1,-1]$ to your sketch, starting at the base point
$[2,2]$. That is, draw the vector with components 1 to the right and 1
down starting at $[2,2]$. {\bf Note:}\ your sketch should show
graphically that $[2,2]+[1,-1]=[3,1]$.
\end{problem}
\begin{problem}
\label{op1_1}
Let $\aa$, $\bb$ and $\cc$ be fixed non-zero vectors. Describe and
sketch the following sets of points in two and three dimensions:
\begin{enumerate}
\renewcommand{\labelenumi}{(\roman{enumi})}
\item $\{s\aa : s\in\RR\}$ (i.e., the set of all scalar multiples of
$\aa$)\par
\item $\{s\aa : s>0\}$ (i.e., the set of all positive scalar multiples
of $\aa$)\par
\item $\{\bb + s\aa : s\in\RR\}$\par
\item $\{s\aa + t\bb : s,t\in\RR\}$\par
\item $\{\cc + s\aa + t\bb : s,t\in\RR\}$\par
\end{enumerate}
\end{problem}
\begin{problem}
\label{op1_2}
Describe the vectors $\aa - \bb$ and $\bb - \aa$.
\end{problem}
\begin{problem}
\label{op1_3}
Find an expression for the midpoint between $\aa$ and $\bb$. Find an expression
for a point one third of the way between $\aa$ and $\bb$.
\end{problem}
\begin{problem}
\label{op1_4}
Find an expression for the line segment joining $\aa$ and $\bb$.
\end{problem}
\section{Geometrical Aspects of Vectors}
\subsection{Length of a vector}
It follows from the Pythagorean formula that the length $\|\aa\|$ of
$\aa=[a_1,a_2]$ satisfies $\|\aa\|^2=a_1^2+a_2^2$. This is shown in
Figure~\ref{fig_pyth}.
\begin{figure}
\centerline{\includegraphics[height=2in]{2_pyth}}
\caption{Pythagorean Formula. \label{fig_pyth}}
\end{figure}
Thus
\[
\|\aa\|= \sqrt{a_1^2+a_2^2}.
\]
Similarly, for a vector $\aa=[a_1,a_2,a_3]$ in three dimensions,
\[
\|\aa\|= \sqrt{a_1^2+a_2^2+a_3^2}.
\]
The distance between two vectors $\aa$ and $\bb$ is the length of the
difference $\bb-\aa$.
\subsection{The dot product}
The dot product of two vectors is defined in both two and three
dimensions (actually in any dimension). The result is a number. Two
main uses of the dot product are testing for orthogonality and
computing projections.
The dot product of $\aa=[a_1,a_2]$ and $\bb=[b_1,b_2]$ is given by
\[
\aa\cdot\bb = a_1b_1 + a_2b_2.
\]
Similarly, the dot product of $\aa=[a_1,a_2,a_3]$ and
$\bb=[b_1,b_2,b_3]$ is given by
\[
\aa\cdot\bb = a_1b_1 + a_2b_2 + a_3b_3.
\]
The properties of the dot product are as follows:
\begin{description}
\item[0.] If $\aa$ and $\bb$ are vectors, then $\aa\cdot\bb$ is a number.
\item[1.] $\aa\cdot\aa = \|a\|^2$.
\item[2.] $\aa\cdot\bb = \bb\cdot\aa$.
\item[3.] $\aa\cdot(\bb+\cc) = \aa\cdot\bb + \aa\cdot\cc$.
\item[4.] $s(\aa\cdot\bb) = (s\aa)\cdot\bb$.
\item[5.] $\zv\cdot\aa=0$.
\item[6.] $\aa\cdot\bb = \|\aa\|\|\bb\|\cos(\theta)$, where $\theta$
is angle between $\aa$ and $\bb$.
\item[7.] $\aa\cdot\bb = 0$ $\iff$ $\aa=\zv$ or $\bb=\zv$ or $\aa$ and
$\bb$ are orthogonal (i.e,. perpendicular).
\end{description}
Properties 0 to 5 are easy consequences of the definitions.
For example, to
verify property 5 we write
\[
\zv\cdot\aa = [0,0,0]\cdot[a_1,a_2,a_3]= 0a_1+0a_2+0a_3=0.
\]
Property 6 is the most important property and is often taken as the
definition of the angle $\theta$ between vectors $\bf a$ and $\bf b$.
Notice that our definition is given in terms of the
components of the vectors, which depend on how we chose the
co-ordinate axes. It is not at all clear that if we change the
co-ordinate axis, and hence the co-ordinates of the vectors, that we
will get the same answer for the dot product. However, property 6 says
that the dot product only depends on the lengths of the vectors and
the angle between them. These quantities are independent of how
co-ordinate axes are chosen, and hence so is the dot product.
To show that property 6 holds we compute $\|\aa-\bb\|^2$ in two
different ways. First of all, using properties 1 to 5, we have
\begin{eqnarray}
\nonumber
\|\aa-\bb\|^2 & = & (\aa-\bb)\cdot(\aa-\bb) \\
\nonumber
& = & \aa\cdot\aa - \aa\cdot\bb - \bb\cdot\aa + \bb\cdot\bb \\
\label{ch2_theta1}
& = & \|\aa\|^2 + \|\bb\|^2 - 2 \aa\cdot\bb
\end{eqnarray}
(Which properties were used in each step?) Next we compute
$\|\aa-\bb\|$ as depicted in Figure~\ref{fig_cos2} (left).
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_cos1}
\includegraphics[height=1.5in]{2_cos2}}
\caption{The vectors $\aa$, $\bb$ and $\aa-\bb$ (left)
Lengths of Segments (right). \label{fig_cos2}}
\end{figure}
We mark the lengths of each of the line segments in Figure~\ref{fig_cos2}
(right).
Using Pythagoras' theorem for the right angled triangle on the right
of this diagram, we see that
\[
\|\aa-\bb\|^2 = (\|\aa\|-\|\bb\|\cos(\theta))^2 + \|\bb\|^2\sin^2(\theta).
\]
Thus, using $\cos^2(\theta)+\sin^2(\theta)=1$,
\begin{eqnarray}
\nonumber
\|\aa-\bb\|^2 & = & \|\aa\|^2+\|\bb\|^2\cos^2(\theta) -
2\|\aa\|\|\bb\|\cos(\theta) + \|\bb\|^2\sin^2(\theta) \\
\label{ch2_theta2}
& = & \|\aa\|^2+\|\bb\|^2 - 2\|\aa\|\|\bb\|\cos(\theta)
\end{eqnarray}
Actually, this is just the cosine law applied to the triangle in Figure~\ref{fig_cos2}
and you may have been able to write (\ref{ch2_theta2}) directly.
Now we equate the two expressions (\ref{ch2_theta1}, \ref{ch2_theta2})
for $\|\aa-\bb\|^2$. This gives
\[
\|\aa\|^2 + \|\bb\|^2 - 2 \aa\cdot\bb = \|\aa\|^2+\|\bb\|^2 -
2\|\aa\|\|\bb\|\cos(\theta)
\]
Subtracting $\|\aa\|^2 + \|\bb\|^2$ from both sides and dividing by
$-2$ now yields
\[
\aa\cdot\bb=\|\aa\|\|\bb\|\cos(\theta).
\]
This proves property 6.
Property 7 now follows directly from 6. If $\aa\cdot\bb = 0$ then
$\|\aa\|\|\bb\|\cos(\theta)=0$ so either $\|\aa\|=0$, in which case
$\aa=\zv$, or $\|\bb\|=0$, in which case $\bb=\zv$, or
$\cos(\theta)=0$, which implies that $\theta = \pi/2$ (since $\theta$
lies between $0$ and $\pi$). This implies $\aa$ and $\bb$ are
orthogonal.
Property 6 can be used to compute the angle between two vectors as shown in the example below.
\begin{example}
What is the angle between the vectors whose tails lie at the
centre of a cube and whose heads lie on adjacent vertices? {\rm To compute
this take a cube of side length $2$ and centre it at the origin, so
that the vertices lie at the points $[\pm 1, \pm 1, \pm1]$. Then we
must find the angle between $\aa=[1, 1, 1]$ and $\bb=[-1, 1, 1]$.
Since
\[
\aa\cdot\bb = -1 + 1 + 1 = 1 =
\|\aa\|\|\bb\|\cos(\theta)=\sqrt{3}\sqrt{3}\cos(\theta)
\]
we obtain
\[
\theta = \arccos(1/3) \sim 1.231 \quad (\sim 70.5^\circ)
\]}
\end{example}
\begin{example}
For what value (or values) of $s$ is the vector $[1,1,s]$ perpendicular to $[1,5,3]$?
{\rm The dot product of the two vectors must be zero for them to be orthogonal. We compute
\[
[1,1,s] \cdot [1,5,3] = 1+5+3s
\]
so $6+3s=0$ for orthogonality, $s=-2$.}
\end{example}
Here is an example to review the basic operations on vectors we know so far.
\begin{example}
% \label{2008_a1_2}
Consider the vectors ${\bf a} = [2,3]$ and ${\bf b} =
[1,-3]$ in $\mathbb{R}^2$. Compute the following:
{\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}
\item ${\bf a} + {\bf b}$
\item $3 {\bf a}$
\item $2{\bf a} + 4{\bf b}$
\item ${\bf a} \cdot {\bf b}$
\item $\| {\bf b} \|$
\end{enumerate}}
{\rm Solutions:
\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}
\item $\aa + \bb = [2,3]+[1,-3] = [3,0]$
\item $3 \aa = 3 [2,3] = [6,9]$
\item $2\aa + 4\bb = 2[2,3] + 4[-1,3] = [4,6]+[4,-12] = [8,-6]$
\item $\aa \cdot \bb = [2,3] \cdot [1,-3] = 2-9 = -7$.
\item $\| \bb \| = \sqrt{1^2 + (-3)^2} = \sqrt{10}$.
\end{enumerate}}
\end{example}
\subsection{Projections and Unit Vectors}
Suppose $\aa$ and $\bb$ are two vectors. The projection of $\aa$ in
the direction of $\bb$, denoted ${\rm proj}_\bb\aa$, is the vector in
the direction of $\bb$ whose length is determined by drawing a line
perpendicular to $\bb$ that goes through $\aa$. In other words, the
length of ${\rm proj}_\bb\aa$ is the component of $\aa$ in the
direction of $\bb$. This is shown in Figure~\ref{fig_proj}
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_proj}}
\caption{Projection. \label{fig_proj}}
\end{figure}
To compute ${\rm proj}_\bb\aa$, we first note that it is a multiple of
$\bb$. Thus ${\rm proj}_\bb\aa = s\bb$ for some number $s$. To
compute $s$, we use the fact that the vector ${\rm proj}_\bb\aa - \aa$
(along the dotted line in the diagram) is orthogonal to $\bb$. Thus
$({\rm proj}_\bb\aa - \aa)\cdot\bb = 0$, or $(s\bb-\aa)\cdot\bb=0$, or
$(s\bb)\cdot\bb-\aa\cdot\bb=0$, or $s(\bb\cdot\bb)=\aa\cdot\bb$, or
$s = (\aa\cdot\bb) / (\bb\cdot\bb) = (\aa\cdot\bb) / \|\bb\|^2$. Thus
\begin{equation}
\label{eq:projection}
{\rm proj}_\bb\aa = {{\aa\cdot\bb}\over{\|\bb\|^2}}\bb.
\end{equation}
If $\bb$ is a unit vector (i.e., $\|\bb\|=1$, length 1) this expression is even
simpler. We will use the notation $\hat{b}$ to denote unit vectors. In this case
\[
{\rm proj}_{\hat{b}} \aa = (\aa\cdot\hat{b})\,\hat{b}.
\]
It is easy to find a unit vector $\hat{b}$ that points in the same direction as any nonzero
vector $\bb$, simply compute
\[
\hat{b} = \frac{1}{\| \bb \|} \bb.
\]
Since $\hat{b}$ is a (positive) scalar multiple of $\bb$ in the above formula, it clearly points in the
same direction as $\bb$. A straight forward calculation shows that $\hat{b}$ has unit length
(try it!).
\begin{example}
Find the unit vector $\hat{b}$ that points in the same direction as $\bb = [1, 2]$.
{\rm We compute
\[
\| \bb \| = \sqrt{1^2 + 2^2} = \sqrt{5}
\]
and then
\[
\hat{b} = \frac{1}{\sqrt{5}} [1,2] = [1/\sqrt{5}, 2/\sqrt{5}].
\]}
\end{example}
Projections are useful for computing the components of a vector in
various directions. An easy example is given be the co-ordinates of a
vector. These are simply the components of a vector in the direction
of the standard basis vectors. So in two dimensions
\begin{eqnarray*}
a_1 & = & \aa\cdot{\bf i} = [a_1,a_2]\cdot[1,0] \\
a_2 & = & \aa\cdot{\bf j} = [a_1,a_2]\cdot[0,1]
\end{eqnarray*}
\begin{example}
Let $\aa = [1,0,2]$ and $\bb = [0, 5, 2]$. Compute
$ \mbox{proj}_{\bf b} {\bf a}$ (the projection of $\bf a$ in the
direction of $\bf b$).
{\rm We use (\ref{eq:projection}) and first compute
\[
\| \bb \|^2 = 5^2 + 2^2 = 29 \mbox{\ \ \ and $\aa \cdot \bb = 4$},
\]
then
\[
\mbox{proj}_{\bf b} {\bf a} = \frac{4}{29} [0, 5, 2] = [0, 20/29, 8/29].
\]}
\end{example}
\subsection{MATLAB: {\tt norm} and {\tt dot} commands}
MATLAB has built-in functions that implement most of the mathematical
operations introduced this course. For example, the commands
\begin{description}
\item[{\tt norm(a)}] returns the length (norm) of the vector {\tt a}.
\item[{\tt dot(a,b)}] returns the dot product of the vectors
{\tt a} and {\tt b} (if the vectors do not have the same length, an
error results as you would expect).
\end{description}
Using these commands and scalar multiplication of vectors, a projection
of {\tt a} onto the direction {\tt b} can be implemented:
\begin{verbatim}
(dot(a,b)/norm(b)^2))*b
\end{verbatim}
where {\tt /} denotes division (of scalar quantities in this case) and
{\tt \textasciicircum p} gives the p'th power of a quantity.
\subsection{Problems}
\begin{problem}
\label{2009_a1_2}
Consider the vectors ${\bf a} = [1,2]$ and ${\bf b} =
[1,-2]$ in $\mathbb{R}^2$ (the set of vectors with 2 components).
Compute the following:
\begin{enumerate}
\item ${\bf a} + {\bf b}$
\item $2 {\bf a}$
\item ${\bf a} - {\bf b}$
\item ${\bf a} \cdot {\bf b}$
\item $\| {\bf b} \|$
\end{enumerate}
\end{problem}
\begin{problem}
\label{2008_a1_3}
A circle in the $x_1$-$x_2$ plane has centre at $[2,5]$. A given
point on its circumference is $[3,3]$. Write an equation that describes
all the points $[x_1,x_2]$ on the circle.
\end{problem}
\begin{problem}
\label{op1_5}
Find the equation of a sphere centred at $\aa=[a_1,a_2,a_3]$ with
radius $r$. (Hint: the sphere is the set of points
$\xx=[x_1,x_2,x_3]$ whose distance from $\aa$ is $r$
\end{problem}
\begin{problem}
\label{op1_6}
Find the equation of a sphere if one of its diameters has endpoints
$[2,1,4]$ and $[4,3,10]$
\end{problem}
\begin{problem}
\label{op1_7}
Compute the dot product of the vectors $\aa$ and $\bb$ and find the angle
between them.
{\begin{enumerate}
\renewcommand{\labelenumi}{(\roman{enumi})}
\item $\aa=[1,2]$, $\bb=[-2,3]$
\item $\aa=[-1,2]$, $\bb=[1,1]$
\item $\aa=[1,1]$, $\bb=[2,2]$
\item $\aa=[1,2,1]$, $\bb=[-1,1,1]$
\item $\aa=[-1,2,3]$, $\bb=[3,0,1]$
\end{enumerate}}
\end{problem}
\begin{problem}
\label{2009_a1_4}
Let ${\bf a} = [1,1,1]$ and ${\bf b} = [3,1,-2]$. Compute the
following:
\begin{enumerate}
\item The angle between ${\bf a}$ and ${\bf b}$.
\item $ \mbox{proj}_{\bf a} {\bf b}$ (the projection of $\bf b$ in the
direction of $\bf a$).
\end{enumerate}
\end{problem}
\begin{problem}
\label{2008_a1_5}
Let ${\bf a} = [1,4,0]$ and ${\bf b} = [2,-1,5]$. Compute the
following:
{\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}
\item The angle between ${\bf a}$ and ${\bf b}$.
\item $ \mbox{proj}_{\bf a} {\bf b}$ (the projection of $\bf b$ in the
direction of $\bf a$).
\end{enumerate}}
\end{problem}
\begin{problem}
\label{op1_8}
For which value of $s$ is the vector $[1,2,s]$ orthogonal to
$[-1,1,1]$?
\end{problem}
\begin{problem}
\label{op1_9}
Does the triangle with vertices $[1,2,3]$, $[4,0,5]$ and $[3,4,6]$
have a right angle?
\end{problem}
\begin{problem}
\label{2009_a1_5}
Determine the values of $c_1$ and $c_2$ such that the vector
$[c_1,1,c_2]$ is a scalar multiple of $[2,-2,3]$.
\end{problem}
\begin{problem}
\label{op1_10}
An air-plane with an approach speed of 70 knots is on approach to
runway 26 (i.e., pointing in the direction of 260 degrees). This
is shown in Figure~\ref{fig_runway} (left). If the
wind is from 330 degrees at 10 knots, what heading should the pilot
maintain to stay lined up with the runway? What is the groundspeed of
the air-plane?
\end{problem}
\begin{figure}
\centerline{\includegraphics[height=1.5in]{2_runway}
\includegraphics[height=1.5in]{2_pend2}}
\caption{Runway diagram for problem~\ref{op1_10} (left) and
the pendulum of problem~\ref{op1_11} (right) \label{fig_runway}}
\end{figure}
\begin{problem}
\label{op1_11}
Suppose the angle of the pendulum shaft makes an angle of $\theta$
with the vertical direction as
shown in Figure~\ref{fig_runway} (right). The force of gravity has
magnitude (length) equal to $mg$ and points downwards. The force along
the shaft of the pendulum acts to keep the shaft rigid, i.e., the
component of the total force along the shaft is zero. Write down the
co-ordinates of the two forces and the total force using two different
sets of co-ordinate axes --- one horizontal and vertical, and one
parallel to and orthogonal to the shaft of the pendulum.
\end{problem}
\begin{problem}
\label{matlab_op1_11}
(Matlab) In Matlab code, if one defines a vector $\aa=[a_1,a_2,\cdots,a_n]$, with the $a_i$'s being any numbers, the output of typing $\aa(j)$ would be $a_j$.
Suppose that you have a two element vector. How would you write a line of Matlab code to compute the norm of the vector, without using the {\tt norm} or {\tt dot} commands?
\end{problem}
\section{Determinants and the Cross Product}
\subsection{The determinant in two and three dimensions}
\label{s:trick}
The determinant is a number that is associated with a square matrix,
that is, a square array of numbers.
In two dimensions it is defined by
\[
\det\left[\matrix{a_1&a_2\cr b_1&b_2\cr}\right]=a_1b_2-a_2b_1.
\]
\begin{example}
Find the determinant of
\[
\left[\matrix{1 & 2 \cr 3 & 4 \cr}\right].
\]
{\rm Using the formula above, we have that the determinant is
\[
1\times 4 - 2 \times 3 = -2.
\]
}
\end{example}
\noindent The definition in three dimensions is
\begin{eqnarray*}
\det \left[ \begin{array}{ccc}
a_1&a_2&a_3 \\
b_1&b_2&b_3 \\
c_1&c_2&c_3
\end{array}
\right]
& = & a_1\det\left[\matrix{b_2&b_3\cr c_2&c_3\cr}\right]
- a_2\det\left[\matrix{b_1&b_3\cr c_1&c_3\cr}\right]
+ a_3\det\left[\matrix{b_1&b_2\cr c_1&c_2\cr}\right] \\
& = & a_1b_2c_3-a_1b_3c_2 + a_2b_3c_1-a_2b_1c_3 + a_3b_1c_2-a_3b_2c_1
\end{eqnarray*}
We want to determine the relationship between the determinant and the
vectors $\aa=[a_1,a_2]$ and $\bb = [b_1,b_2]$ (in two dimensions) and
$\aa=[a_1,a_2,a_3]$, $\bb = [b_1,b_2,b_3]$ and $\cc=[c_1,c_2,c_3]$ (in
three dimensions). We will do the two dimensional case now, but
postpone the three dimensional case until after we have discussed the
cross product.
\begin{example}
Find the determinant of
\[
A = \left[ \begin{array}{ccc}
1 & 1 & 0 \\
4 & 2 & 2 \\
1 & 0 & 3
\end{array}
\right].
\]
{\rm It is easiest to remember the formula using the first line in the equation above
using the determinants of the corresponding $2 \times 2$ blocks of the matrix.
\[
\det A = 1 (2 \times 3-0) -1 (4 \times 3 -2) + 0 = -4.
\]
}
\end{example}
So let $\aa=[a_1,a_2]$ and $\bb = [b_1,b_2]$ be two vectors in
the plane. Define
\[
\aa^\perp = [-a_2,a_1].
\]
Notice that $\aa^\perp$ has the same length as $\aa$, and is
perpendicular to $\aa$, since
\[
\aa^\perp\cdot\aa = -a_2a_1 + a_1a_2 = 0.
\]
There are exactly two vectors with these properties. The vector
$\aa^\perp$ is the one that is obtained from $\aa$ by a counterclockwise
rotation of $\pi/2$ (i.e., $90^\circ$). To see this, notice that if
$\aa$ lies in the first quadrant (that is, $a_1>0$ and $a_2>0$) then
$\aa^\perp$ lies in the second quadrant, and so on. Later in the course
we will study rotations and this will be a special case.
Notice now that the determinant can be written as a dot product.
\[
\aa^\perp\cdot\bb = -a_2b_1+a_1b_2 = \det\left[\matrix{a_1&a_2\cr
b_1&b_2\cr}\right]
\]
We want to use the geometric formula for the dot product of $\aa^\perp$
and $\bb$. Let $\theta$ be the angle between $\aa$ and $\bb$ and
$\pi/2-\theta$ be the angle between $\aa^\perp$ and $\bb$, as shown in
Figure~\ref{fig_ppgram2}.
\begin{figure}
\centerline{\includegraphics[height=2in]{2_ppgram2}}
\caption{The vector $a^\perp$ (labelled incorrectly in the figure as $\hat{a}$). \label{fig_ppgram2}}
\end{figure}
Using the geometric meaning of the dot product, we obtain
\begin{eqnarray*}
\det\left[\matrix{a_1&a_2\cr b_1&b_2\cr}\right]
& = & \aa^\perp\cdot\bb \\
& = & \|\aa^\perp\|\|\bb\|\cos(\pi/2-\theta) \\
& = & \|\aa\|\|\bb\|\sin(\theta)
\end{eqnarray*}
We need to be a bit careful here. When we were discussing the dot
product, we always assumed that the angle between two vectors was in
the range $0$ to $\pi$. In fact, the geometric formula for the dot
product is not sensitive to how we measure the angle. Suppose that
instead of $\theta$ in the range $0$ to $\pi$ we use
$\theta_1=-\theta$ (measuring the angle ``backwards'') or
$\theta_2=2\pi-\theta$ (measuring the angle going the long way around
the circle). Since $\cos(\theta)=\cos(-\theta)=\cos(2\pi-\theta)$ we
have
\[ \cc\cdot\dd=\|\cc\|\|\dd\|\cos(\theta)=\|\cc\|\|\dd\|\cos(\theta_1)
=\|\cc\|\|\dd\|\cos(\theta_2).
\]
In other words, the geometric formula for the dot product still is
true.
In the diagram above, we want to let the angle $\theta$ between $\aa$
and $\bb$ range between $-\pi$ and $\pi$. In this case the angle
$\pi/2-\theta$ between $\aa^\perp$ and $\bb$ is sometimes not in the
range between $0$ or $2\pi$. But if this happens, then it is still the
angle between $\aa^\perp$ and $\bb$, just ``backwards'' or ``the long
way around.'' Thus the geometric formula above still is correct.
Values of $\theta$ between $0$ and $\pi$ correspond to the situation
where the direction of $\bb$ is obtained from the direction of $\aa$
by a counterclockwise rotation of less than $\pi$. This is the case in
the diagram. On the other hand, $\theta$ between $-\pi$ and $0$
corresponds to the case where a clockwise rotation of less than $\pi$
is needed to get from the direction of $\aa$ to the direction of
$\bb$.
The quantity $\sin(\theta)$ can be positive or negative, depending on
the orientations of $\aa$ and $\bb$, but in any case the positive
quantity $\|\bb\||\sin(\theta)|$ is the height of the parallelogram
spanned by $\aa$ and $\bb$ if we take $\aa$ to be the base. In this
case, the length of the base is $\|\aa\|$. Recall that the area of a
parallelogram is the length of the base times the height. Thus
\[
\left|\det\left[\matrix{a_1&a_2\cr b_1&b_2\cr}\right]\right|
=\hbox{Area of parallelogram spanned by $\aa$ and $\bb$}
\]
The determinant is positive if $\sin(\theta)$ is positive, that is, if
$\theta$ is positive. This is the case if the direction of $\bb$ is
obtained by a counterclockwise rotation of half a circle or less from
the direction of $\aa$. Otherwise the determinant is negative.
Notice that the determinant whose rows are the components of two
non-zero vectors $\aa$ and $\bb$ is zero exactly when the vectors
$\aa$ and $\bb$ are pointing in the same direction, or in the opposite
direction, that is, if one is obtained from the other by scalar
multiplication. The sign of the determinant gives information about
their relative orientation.
\begin{example}
Find the area $\cal A$ of the parallelogram spanned by $\aa = [1, 1]$ and
$\bb = [1, 3]$. {\rm
Using the formula above, we know that
\[
{\cal A} = \left|\det\left[\matrix{1 & 1 \cr 1 & 3\cr}\right]\right|
= | 3-1| = |2| = 2.
\]
In addition, since the determinant is positive, we know that $\bb$ is counterclockwise to $\aa$
as can be seen graphically.
}
\end{example}
\subsection{The cross product}
Unlike the dot product, the cross product is only defined for vectors
in three dimensions. And unlike the dot product, the cross product of
two vectors is another vector, not a number. If $\aa = [a_1,a_2,a_3]$
and $\bb=[b_1,b_2,b_3]$, then $\aa \times \bb$ is a vector given by
\[
\aa \times \bb = [a_2b_3-a_3b_2, a_3b_1-a_1b_3, a_1b_2-a_2b_1].
\]
An easy way to remember this is to write down a $3\times 3$ matrix whose
first row contains the unit basis vectors and whose second and third rows
contain the components of $\aa$ and $\bb$. Then the cross product is obtained
by following the usual rules for computing a $3\times 3$ determinant.
\begin{eqnarray*}
\det\left[\matrix{
{\bf i}&{\bf j}&{\bf k}\cr
a_1&a_2&a_3\cr
b_1&b_2&b_3\cr
}\right]
& = & {\bf i}\det\left[\matrix{a_2&a_3\cr b_2&b_3\cr}\right]
- {\bf j}\det\left[\matrix{a_1&a_3\cr b_1&b_3\cr}\right]
+ {\bf k}\det\left[\matrix{a_1&a_2\cr b_1&b_2\cr}\right] \\
& = & [a_2b_3-a_3b_2, a_3b_1-a_1b_3, a_1b_2-a_2b_1]
\end{eqnarray*}
The geometric meaning of the cross product is given
the following three properties:
\begin{enumerate}
\item $\aa\times\bb$ is orthogonal to $\aa$ and to $\bb$
\item $\|\aa\times\bb\|=\|\aa\|\|\bb\|\sin(\theta)$, where $\theta$ is
the angle between $\aa$ and $\bb$. In this formula, $\theta$ lies
between $0$ and $\pi$, so that $\sin(\theta)$ is positive. This is
the same as saying that the length of $\aa\times\bb$ is the area of
the parallelogram spanned by $\aa$ and $\bb$.
\item The vectors $\aa$, $\bb$ and $\aa\times\bb$ obey the right hand
rule.
\end{enumerate}
This geometric description of the cross product shows that the
definition of the cross product is independent of how we choose our
co-ordinate axes. To verify 1, we compute the dot products
$\aa\cdot(\aa\times\bb)$ and $\bb\cdot(\aa\times\bb)$ and verify that
they are zero. (This is one of the problems below.)
To verify 2 we must show that the length of $\aa\times\bb$ is the area
of the parallelogram spanned by $\aa$ and $\bb$, since the quantity