~~REVEAL~~ ====== Chapter 3: Vectors and geometry ====== ==== Vectors ==== * $\def\m#1{\begin{bmatrix}#1\end{bmatrix}}\m{4\\3}$ is a $2\times 1$ column vector * i.e., a pair of numbers written in a column * We also use pairs of numbers to write points in the plane $\mathbb R^2$ * e.g., $(4,3)$ is a point * you get there by starting from the origin, moving $4$ units to the right and $3$ units up. * We think $\vec v=\m{4\\3}$ as an instruction to move $4$ units to the right and $3$ units up. * This movement is called "translation by $\vec v$". ==== Translation by $\vec v$ ==== The vector $\vec v=\m{4\\3}$ moves: * $(0,0)$ to $(4,3)$ * $(-2,6)$ to $(2,9)$ * $(x,y)$ to $(x+4,y+3)$. * We're not too fussy about the difference between points like $(4,3)$ and vectors like $\m{4\\3}$. * If we write points as column vectors, we can perform algebra (addition, subtraction, scalar multiplication) using points and column vectors. ==== ==== For example, we could rewrite the examples above by saying that $\vec v=\m{4\\3}$ moves: * $\m{0\\0}$ to $\m{0\\0}+\m{4\\3}=\m{4\\3}$ * $\m{-2\\6}$ to $\m{-2\\6}+\m{4\\3}=\m{2\\9}$ * $\m{x\\y}$ to $\m{x\\y}+\m{4\\3}=\m{x+4\\y+3}$. * More generally: a column vector $\vec v$ moves a point $\vec x$ to $\vec x+\vec v$. ==== Example ==== Which vector $\vec v$ moves the point $A=(-1,3)$ to $B=(5,-4)$? * We need a vector $\vec v$ with $A+\vec v=B$ * So $\vec v=B-A = \m{5\\-4}-\m{-1\\3}=\m{6\\-7}$. * We write $\vec{AB}=\m{6\\-7}$, since this is the vector which moves $A$ to $B$. ==== Definition of $\vec{AB}$ ==== If $A$ and $B$ are any points in $\mathbb{R}^n$, then the vector $\vec{AB}$ is defined by \[ \vec{AB}=B-A\] (on the right, we interpret points as column vectors so we can subtract them to get a column vector). * $\vec{AB}$ is the vector which moves $A$ to $B$. ==== Example ==== In $\mathbb{R}^3$, * if $A=(3,-4,5)$ * and $B=(11,6,-2)$ * then $\vec{AB}=\def\mat#1{\left[\begin{smallmatrix}#1\end{smallmatrix}\right]}\def\m#1{\mat{#1}}\m{11\\6\\-2}-\m{3\\-4\\5}=\m{8\\10\\-7}$. ==== The uses of vectors ==== Vectors are used in geometry and science to represent quantities with both a **magnitude** (size/length) and a **direction**. For example: * displacements (in geometry) * velocities * forces Recall that a column vector moves points. Its magnitude, or length, is how far it moves points. ==== Definition: the length of a vector ==== If $\vec v=\m{v_1\\v_2\\\vdots\\v_n}$ is a column vector in $\mathbb{R}^n$, then its **magnitude**, or **length**, or **norm**, is the number \[ \|\vec v\|=\sqrt{v_1^2+v_2^2+\dots+v_n^2}.\] ==== Examples ==== * $\left\|\m{4\\3}\right\|=\sqrt{4^2+3^2}=\sqrt{16+9}=\sqrt{25}=5$ * \begin{align*}\left\|\m{1\\0\\-2\\3}\right\|&=\sqrt{1^2+0^2+(-2)^2+3^2}\\&=\sqrt{1+0+4+9}=\sqrt{14}\end{align*} ==== Exercise ==== Prove that if $c\in \mathbb{R}$ is a scalar and $\vec v$ is a vector in $\mathbb{R}^n$, then \[ \|c\vec v\|=|c|\,\|\vec v\|.\] That is, multiplying a vector by a scalar $c$ scales its length by $|c|$, the absolute value of $c$. * Hints: $\sqrt{xy}=\sqrt{x}\sqrt{y}$ whenever $x,y\ge0$, and $\sqrt{c^2}=|c|$ for any $c\in \mathbb R$. ==== Distance between two points ==== $\|\vec{AB}\|$ is the distance from point $A$ to point $B$ * since this is the length of vector which takes point $A$ to point $B$. * e.g. how far from from $A=(1,2)$ to $B=(-3,4)$? * $\small\|\def\m#1{\left[\begin{smallmatrix}#1\end{smallmatrix}\right]}\vec{AB}\|=\left\|\m{-3\\4}-\m{1\\2}\right\|=\left\|\m{-4\\2}\right\|=\sqrt{(-4)^2+2^2}=\sqrt{20}$. * e.g. what's the length of the main diagonal of the unit cube in $\mathbb{R}^3$? * = distance from $0=(0,0,0)$ to $A=(1,1,1)$ * $\|\vec{0A}\|=\left\|\m{1\\1\\1}\right\|=\sqrt{1^2+1^2+1^2}=\sqrt3$. ==== Scalar multiplication and direction ==== Multiplying a vector by a scalar changes its length, but doesn't change its direction. ==== Definition: unit vectors ==== {{page>unit vector}} ==== Proposition: finding a unit vector in the same direction as a given vector ==== If $\vec v$ is a non-zero vector, then $\vec w=\frac1{\|\vec v\|}\vec v$ is a unit vector (in the same direction as $\vec v$). === Proof === * Use the formula $\|c\vec v\|=|c|\,\|\vec v\|$ and the fact that $\|\vec v\|>0$: * $\|\vec w\|=\left\|\frac1{\|\vec v\|}\vec v\right\|=\left|\frac1{\|\vec v\|}\right|\,\|\vec v\|=\frac1{\|\vec v\|}\,\|\vec v\| = 1$. * So $\vec w$ is a unit vector. * It's a scalar multiple of $\vec v$, so is in the same direction as $\vec v$. ■ ==== Example ==== What is unit vector in the same direction as $\vec v=\m{1\\2}$? * By the Proposition, $\frac{1}{\|\vec v\|}$ is a unit vector in the same direction as $\vec v$. * $\|\vec v\|=\sqrt{1^2+2^2}=\sqrt5$ * So the unit vector in the same direction as $\vec v$ is: * $\frac1{\|\vec v\|}\vec v = \frac1{\sqrt 5}\vec v=\frac1{\sqrt5}\m{1\\2}=\m{1/\sqrt{5}\\2/\sqrt5}$. ===== Addition of vectors ===== If $\vec v=\vec{AB}$, then $\vec v$ moves $A$ to $B$, so $A+\vec v=B$. If $\vec w=\vec {BC}$, then $\vec w$ moves $B$ to $C$, so $B+\vec w=C$. What about $\vec v+\vec w$? We have $A+\vec v+\vec w=B+\vec w=C$. So $\vec v+\vec w=\vec{AC}$. ==== The triangle law for vector addition ==== {{ :tri.png?nolink&400 |}} ==== The parallelogram law for vector addition ==== {{ :par.png?nolink&400 |}} ====== The dot product ====== ==== Definition of the dot product ==== {{page>dot product}} * Note that while $\vec v$ and $\vec w$ are vectors, their dot product $\vec v\cdot \vec w$ is a scalar. ==== Example ==== Let $\vec v=\m{3\\5}$ and $\vec w=\m{4\\-7}$. * $\vec v\cdot \vec w=\m{3\\5}\cdot \m{4\\-7} = 3(4)+5(-7)=-23$. ===== Properties of the dot product ===== For any vectors $\vec v$, $\vec w$ and $\vec u$ in $\mathbb{R}^n$, and any scalar $c\in \mathbb{R}$: - $\def\dp#1#2{\vec #1\cdot \vec #2}\dp vw=\dp wv$ (the dot product is commutative) - $\vec u\cdot(\vec v+\vec w)=\dp uv+\dp uw$ - $(c\vec v)\cdot \vec w=c(\dp vw)$ - $\dp vv=\|\vec v\|^2\ge 0$, and $\dp vv=0 \iff \vec v=0_{n\times 1}$ The proofs of these properties are exercises. ===== Angles and the dot product ===== ==== Theorem: the relationship between angle and the dot product ==== If $\vec v$ and $\vec w$ are non-zero vectors in $\mathbb{R}^n$, then \[ \dp vw=\|\vec v\|\,\|\vec w\|\,\cos\theta\] where $\theta$ is the angle between $\vec v$ and $\vec w$. * The proof will be given soon, but for now let's work out an example. ==== Example ==== What's the angle between $\vec v=\m{1\\2}$ and $\vec w=\m{-2\\1}$? * $\dp vw=1(-2)+2(1)=-2+2=0$. * $\|\vec v\|=\sqrt5=\|\vec w\|$ * So the angle $\theta$ between $\vec v$ and $\vec w$ has $ 0=\dp vw=\sqrt 5\times \sqrt 5 \times \cos\theta$ * So $5\cos\theta=0$, so $\cos\theta=0$, * So $\theta=\pi/2$ or $\theta=3\pi/2$ (measuring angles in radians). * The angle between $\vec v$ and $\vec w$ is a right angle. * We say $\vec v$ and $\vec w$ are **orthogonal**. ==== Picture of $\vec v=\m{1\\2}$ and $\vec w=\m{-2\\1}$==== We can draw a convincing picture which indicates that these vectors are indeed at right angles: {{ :orth1.png?nolink&400 |}} ==== Proof of the Theorem ==== We wish to show that $\def\vv{\vec v} \def\ww{\vec w}\vv\cdot\ww=\|\vv\|\,\|\ww\|\cos\theta$ where $\theta$ is the angle between $\vv$ and $\ww$. * Recall the [[wp>cosine rule]]:{{ :t1.png?nolink&300 |}} ==== Proof of the Theorem, slide 2==== We wish to show that $\def\vv{\vec v} \def\ww{\vec w}\vv\cdot\ww=\|\vv\|\,\|\ww\|\cos\theta$ where $\theta$ is the angle between $\vv$ and $\ww$. * Consider a triangle with two sides $\vv$ and $\ww$. * By the triangle rule for vector addition, the third side $\vec x$ has $\ww+\vec x=\vv$, so $\vec x=\vv-\ww$:{{ :t2.png?nolink&300 |}} * Apply the cosine rule: $ \|\vv-\ww\|^2=\|\vv\|\,\|\ww\|-2\vv\cdot\ww\cos\theta.$ ==== Proof of the Theorem, slide 3==== We wish to show that $\def\vv{\vec v} \def\ww{\vec w}\vv\cdot\ww=\|\vv\|\,\|\ww\|\cos\theta$ where $\theta$ is the angle between $\vv$ and $\ww$. * $ \|\vv-\ww\|^2=\|\vv\|\,\|\ww\|-2\vv\cdot\ww\cos\theta.$ * We know that $\|\vec x\|^2=\vec x\cdot\vec x$ * So $\|\vv-\ww\|^2=(\vv-\ww)\cdot(\vv-\ww)$ * $=\vv\cdot\vv+\ww\cdot\ww-\ww\cdot\vv-\vv\cdot\ww$ * $=\|\vv\|^2+\|\ww\|^2-2\vv\cdot\ww$. * So $\|\vv\|\,\|\ww\|-2\vv\cdot\ww\cos\theta=\|\vv\|^2+\|\ww\|^2-2\vv\cdot\ww$ * So $\vv\cdot\ww=\|\vv\|\,\|\ww\|\cos\theta$. ■ ==== Corollary 1 ==== If $\vv$ and $\ww$ are non-zero vectors and $\theta$ is the angle between them, then $\cos\theta=\displaystyle\frac{\vv\cdot\ww}{\|\vv\|\,\|\ww\|}$. ==== Corollary 2 ==== If $\vv$ and $\ww$ are non-zero vectors with $\vv\cdot\ww=0$, then $\vv$ and $\ww$ are **orthogonal**: they are at right-angles. ==== Example 1 ==== What is the angle $\theta$ between $\def\c#1#2{\left[\begin{smallmatrix}{#1}\\{#2}\end{smallmatrix}\right]}\c12$ and $\c3{-4}$? * $ \cos\theta=\frac{\c12\cdot\c3{-4}}{\left\|\c12\right\|\,\left\|\c3{-4}\right\|} =\frac{3-8}{\sqrt5\sqrt{25}}=-\frac1{\sqrt5}$ * So $\theta=\cos^{-1}(-1/\sqrt5) \approx 2.03\,\text{radians}\approx 116.57^\circ$. ==== Example 2 ==== Prove that $A=(2,3)$, $B=(3,6)$ and $C=(-4,5)$ are the vertices of a right-angled triangle. * $\vec{AB}=\c36-\c23=\c13$ * $\vec{AC}=\c{-4}5-\c23=\c{-6}2$ * So $\vec{AB}\cdot\vec{AC}=\c13\cdot\c{-6}2=1(-6)+3(2)=0$ * So the sides $AB$ and $AC$ are at right-angles. * So $ABC$ is a right-angled triangle. ==== Example 3 ==== Find a unit vector orthogonal to the vector $\vv=\c12$. * Observe that $\ww=\c{-2}1$ has $\vv\cdot\ww=0$ * So $\vv$ and $\ww$ are orthogonal * $\vec u=\frac1{\|\ww\|}\ww$ is a unit vector in the same direction as $\ww$, (so is also orthogonal to $\vv$). * So $\vec u=\frac1{\sqrt5}\c{-2}1=\c{-2/\sqrt5}{1/\sqrt5}$ is a unit vector orthogonal to $\vv=\c12$.