Week 4 Lecture Notes

This week we’ll be reviewing linear algebra.

Monday, February 3

A vector x∈ℝnx \in \mathbb{R}^n is all three of the following things:

  1. A list of nn-real numbers.
  2. A point in nn-dimensional space.
  3. An arrow with a magnitude and direction.

We looked at the following two examples to test our intuitions about vectors.

  1. Let a=[123]a = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} and b=[0−11]b = \begin{bmatrix} 0 \\ -1 \\ 1 \end{bmatrix}. What vector would you add to aa in order to get bb?

  2. Does the line passing through aa and bb also pass through c=[4119]c = \begin{bmatrix} 4 \\ 11 \\ 9 \end{bmatrix}?

A matrix A∈ℝm×nA \in \mathbb{R}^{m \times n} is a rectangular array of real numbers with mm rows and nn columns. Make sure you remember how matrix multiplication works and also what the transpose ATA^T of a matrix is.

  1. Let A=[102−131]A = \begin{bmatrix} 1 & 0 \\ 2 & -1 \\ 3 & 1 \end{bmatrix}, B=[1002]B = \begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix}, and C=[111001]C = \begin{bmatrix} 1 & 1 & 1 \\ 0 & 0 & 1 \end{bmatrix}. Which of the following matrix products make sense? ABAB, ACAC, BABA, BCBC, CACA, CBCB? Calculate each product that makes sense.

Of course, a vector x∈ℝnx \in \mathbb{R}^n can be thought of as a matrix. We will always assume that vectors are column vectors unless otherwise specified.

The length or norm of a vector x∈ℝnx \in \mathbb{R}^n is ∥x∥=x12+x22+…+xn2. \|x \| = \sqrt{x_1^2 + x_2^2 + \ldots + x_n^2 }. Another way to write this is ∥x∥=xTx. \|x \| = \sqrt{x^T x}.

The inner product of x,y∈ℝnx,y \in \mathbb{R}^n is xTyx^T y.

  1. Prove that xTy=yTxx^T y = y^T x.

The inner product is also known as the dot product or scalar product of two vectors.

Theorem (Inner Products and Angles)

For any x,y∈ℝnx,y \in \mathbb{R}^n, xTy=∥x∥∥y∥cosθ x^T y = \|x\| \|y\| \cos \theta where θ\theta is the angle between xx and yy.

  1. Use the Law of Cosines to prove this theorem.

One major application of inner products is the definition of the correlation coefficient for two vectors x,y∈ℝnx, y \in \mathbb{R}^n.

Definition (Correlation Coefficient)

For any x,y∈ℝnx,y \in \mathbb{R}^n the correlation between xx and yy is: r=(x−x‾∥x−x‾∥)T(y−y‾∥y−y‾∥). r = \left( \frac{x-\bar{x}}{\|x-\bar{x}\|} \right)^T \left( \frac{y-\bar{y}}{\|y-\bar{y}\|} \right).

  1. Find the correlation between x=[35−8]x = \begin{bmatrix} 3 \\ 5 \\ -8 \end{bmatrix} and y=[120]y = \begin{bmatrix}1 \\ 2 \\ 0 \end{bmatrix}.

Study Questions

  1. Why is it obvious from the definition that the correlation between two vectors will always be between positive and negative one?

  2. What does it mean about xx and yy if r=+1r = +1? What if r=−1r = -1?