Previously, we have looked at lengths of vectors and distances between vectors. In this video, we'll introduce angles as a second important geometric concept that will allow us to define orthogonality. Orthogonality is central to projections and dimensionality reduction. Similar to lengths and distances, the angle between two vectors is defined through the inner product. If we have two vectors, x and y, and we want to determine the angle between them, we can use the following relationship. The cosine of this angle between the two vectors is given by the inner product between the two vectors divided by the norm of x times the norm of y. Let us have a look at an example and let's compute an angle between two vectors, x which is one, one and y which is one, two. And let's quickly draw this. This is x and this is y, we are interested in the angle omega between those. If we use a dot product as the inner product, we get that the cosine of omega is x transpose y divided by the square root of x transpose x times y transpose y, which is three divided by the square root of 10. This means the angle is approximately 0.32 radians or 18 degrees. Intuitively, the angle between two vectors tells us how similar their orientations are. Let's look at another example in 2D again with a dot product as the inner product. We're going to look at the same vector x that we used to have before, so x equals one, one which is this vector over here, and now choose y to be minus one and plus one and this is this vector. Now we're going to compute the angle between these two vectors and we see that the cosine of this angle between x and y is with a dot product x transpose times y divided by the norm of x times the norm of y. And this evaluates to zero. This means that omega is pi over two in radians, if you want to say this in degrees, we have 90 degrees. This is an example where two vectors are orthogonal. Generally, the inner product allows us to characterise orthogonality. Two vectors, x and y, where x and y are non-zero vectors, are orthogonal if and only if their inner product is zero. This also means that orthogonality is defined with respect to inner product. And vectors that are orthogonal with respect to one inner product do not have to be orthogonal with respect to another inner product. Let's take these two vectors that we just had where the dot product between them gave that they are orthogonal, but now we are going to choose a different inner product. In particular, we are going to choose the inner product between x and y to be x transpose times the matrix two, zero, zero, one, times y. And if we choose this inner product, it follows that the inner products between x and y is minus one. This means that the two vectors are not orthogonal with respect to this particular inner product. From a geometric point of view, we can think of two orthogonal vectors as two vectors that are most dissimilar and have nothing in common besides the origin. We can also find a basis of a vector space such that the basis vectors are orthogonal to each other. That means, we get the inner product between b_i and b_j is zero if i is not the same index as j. And we can also use the inner product to normalise these basis vectors. That means, we can make sure that every b_i has length one. Then we call this an orthonormal basis. In this video, we discussed how to compute angles between vectors using inner products. We also introduced the concept of orthogonality, and so that vectors maybe orthogonal with respect to one inner product, but not necessarily if we change the inner product. We will be exploiting orthogonality later on in the course. If we have a vector and we want to compute the smallest difference vector to any point on a line that does not contain the vector, then we will end up finding a point on the line such as the segment between the point and the original the vector is orthogonal to that line.