Week 2 - Vectors are objects that move around space
Intro
- The module covers the following topics:
- Calculating the Magnitude (aka Vector Modulus).
- Combining vectors using the Dot Product.
- Vector Scaling and Vector Projections
- Looking at the Vector set we use to define space called the Basis Vectors.
- Understanding Linear Independence and Linear Combinations.
Finding the size of a vector, its angle, and projection
Modulus and inner product
- A vector has two properties: its length and its direction.
- Vector Magnitude (0:35-2:54)
- A vector can be described in terms of its unit vectors. In this example, they're and :
- From Pythagorean Theorem, we can calculate the magnitude (size) of the vector as
- Vectors are mostly written as column vectors:
- Doesn't matter if our vector contains dimensions in space or things with different physicals units like time and price: we define the size of a vector through the square root of the sums of the squares of its components.
- Dot Product (02:54-10:00)
- If you have 2 vectors and , the dot products are defined as:
- The dot product has the following properties:
- It's commutative:
- It's distributive over additional. If you had a 3rd vector , then
- It's associative over scalar multiplication
- A vector dot product against itself is equal to the magnitude of a vector squared. By taking the square root, you have the magnitude of the vector.
Cosign and dot product
-
Cosign rule from algebra (Law Of Cosines):
-
If you have a triangle with sides a, b and c and angle between a and b then:

-
-
In the triangle above, we can use Vector Subtraction
- So , which means:
- We can replace with the dot product of itself
- We can then multiply it out:
- Which can be simplified to:
- We can compare to right hand side:
- Which can be simplified to:
- Or
- If and were unit vectors, then !
- If , we know that , so the dot product of 2 orthogonal vectors is 0!
- Since we know , the dot product of 2 unit vectors pointing in the same direction is 1.
- We know , so the dot product of 2 opposite vectors is -1.
Projection
-
Scalar Projection (00:00-04:04)
-
Scalar projection is the amount one vector "goes along" another.
-
Draw a line straight down from the tip of vector onto vector . How far along does it land?

-
Using Pythagoras Theorem, we know that
- In the above image, the hypotenuse is the length of s: so which we can rearrange to
-
-
We note that the dot product is :
- So the dot product is: "the projection of s onto r" * "size of r":
- You can rearrange the expression to: , to get the scalar projection.
- That explains why the Dot Product is also called the "Projection Product".
- Vector Projection (04:04-05:52)
- Allows you to include the direction of into the scalar projection.
- Defined to be
- Or
-
Changing the reference frame
Changing basis
-
Coordinate System (00:00 - 03:35)
-
Coordinate system is defined by 2 vectors called the Basis Vectors. In the image, they're and .

-
If our space had more dimensions, you could have more basis vectors.
- We can think of as being some amount of the basis vectors:
- Choice of and is arbitrary. It could be at 90° or a different length. We would still define R as the sum of vectors used to define space.
- If we defined another set of basis vectors and , we could describe in terms of those vectors. The numbers in would be different.
- We can note that the vector r exists in a different space with another set of numbers.
- Changing Basis (03:36-10:32)
-
We can use the dot product to find the numbers for a Vector in a different space if you know the new basis vectors in terms of the original.
-
In this example, (or
-2, 4s) and (or2, 1s)
-
-
The new set of basis vectors must be 90° to each other. We can use the dot product to find the new numbers for in a new basis if we know what is in terms of .
- If they aren't 90 degrees to each other, we have to use matrices and a transformation of the axis.
- If we first project onto , we get a scalar projection that describes how much of you need. Vector projection gives you a projection in of that length.
- Same with
- Maths works like this:
- Project onto , which gives you a scalar projection. That is
- Then vector projection gives you vector in the direction of b_1, which is the length of r.
- Do that for all to get the vector
- For example:
- Get the scalar projection of onto
- Note you get the vector projection of
- Then
- So in the basis and is
- Get the scalar projection of onto
- Project onto , which gives you a scalar projection. That is
-
Basic, vector space, and linear independence
- A basis is a set of n-vectors that:
- Are not linear combinations (they're linearly independent)
- Span the space: the space is then n-dimensional
- Linear Independence (0:42-2:37)
- A vector is independent of another if you cannot get the 2nd vector by taking multiplies of the first.
- for any or
- In other words, does not lie on the plane spanned by and
- A vector is independent of another if you cannot get the 2nd vector by taking multiplies of the first.
- Basis vectors must be linearly independent, but it doesn't mean that they have to be unit vectors of length one or orthogonal, but life is much easier if they are.
Applications of changing basis
- If you have some 2d data points that lie on a straight line, you can map how far each data point maps along a line.
- Distance from the line is considered noise.
- Noise tells you how good the line fit is.
- Goal of a neural network would be to extract the most important features as basis vectors.
Summary
- We've learned about vectors being objects that describe where we are in space.
- We've defined vector attributes like additional and scaling a vector by a number.
- Found the magnitude of Modulus of a vector.
- Done the dot scalar and vector projection product.
- Defined the basis of vector space and its dimension
- Ideas of linear independence and linear combinations.
- Used projections to look at one case of changes from one basis to another (where basis vectors are orthogonal).