By the end of this section, you should be able to give precise and thorough answers to the questions listed below. You may want to keep these questions in mind to focus your thoughts as you complete the section.
What is the dot product of two vectors? Under what conditions is the dot product defined?
How do we find the angle between two nonzero vectors in ?
How does the dot product tell us if two vectors are orthogonal?
How do we define the length of a vector in any dimension and how can the dot product be used to calculate the length?
How do we define the distance between two vectors?
What is the orthogonal projection of a vector in the direction of the vector and how do we find it?
What is the orthogonal complement of a subspace of ?
In video games, the speed at which a computer can render changing graphics views is vitally important. To increase a computer's ability to render a scene, programs often try to identify those parts of the images a viewer could see and those parts the viewer could not see. For example, in a scene involving buildings, the viewer could not see any images blocked by a solid building. In the mathematical world, this can be visualized by graphing surfaces. In Figure 23.1 we see a crude image of a house made up of small polygons (this is how programs generally represent surfaces). On the left in Figure 23.1 we see all of the polygons that are needed to construct the entire surface, even those polygons that lie behind others which we could not see if the surface was solid. On the right in Figure 23.1 we have hidden the parts of the polygons that we cannot see from our view.
We also see this idea in mathematics when we graph surfaces. Figure 23.2 shows the graph of the surface defined by that is made up of polygons. At left we see all of the polygons and at right only those parts that would be visible from our viewing perspective.
By eliminating the parts of the polygons we cannot see from our viewing perspective, the computer program can more quickly render the viewing image. Later in this section we will explore one method for how programs remove the hidden portions of images. This process involves the dot product of vectors.
Orthogonality, a concept which generalizes the idea of perpendicularity, is an important concept in linear algebra. We use the dot product to define orthogonality and more generally angles between vectors in for any dimension . The dot product has many applications, e.g., finding components of forces acting in different directions in physics and engineering. The dot product is also an example of a larger concept, inner products, that we will discuss later. We introduce and investigate dot products in this section.
We will illustrate the dot product in , but the process we go through will translate to any dimension. Recall that we can represent the vector as the directed line segment (or arrow) from the origin to the point in , as illustrated in Figure 23.3. Using the Pythagorean Theorem we can then define the length (or magnitude or norm) of the vector in as
If and are vectors in , then we call the expression the dot product of and , and denote it as . With this idea in mind, we can rewrite the norm of the vector as
We can use unit vectors to find vectors of a given length in the direction of a given vector. Let be a positive scalar and a vector in . Use properties from Theorem 23.6 to show that the magnitude of the vector is .
Finding optimal solutions to systems is an important problem in applied mathematics. It is often the case that we cannot find an exact solution that satisfies certain constraints, so we look instead for the βbestβ solution that satisfies the constraints. An example of this is fitting a least squares line to a set of data. As we will see, the dot product will allow us to find βbestβ solutions to certain types of problems, where we measure accuracy using the notion of a distance between vectors. Geometrically, we can represent a vector as a directed line segment from the origin to the point defined by . If we have two vectors and , we can think of the length of the difference as a measure of how far apart the two vectors are from each other. It is natural, then to define the distance between vectors as follows.
As Figure 23.9 illustrates, if vectors and emanate from the same initial point, and and are the terminal points of and , respectively, then the difference is the standard Euclidean distance between the points and .
Determining a βbestβ solution to a problem often involves finding a solution that minimizes a distance. We generally accomplish a minimization through orthogonality β which depends on the angle between vectors. Given two vectors and in , we position the vectors so that they emanate from the same initial point. If the vectors are nonzero, then they determine a plane in . In that plane there are two angles that these vectors create. We will define the angle between the vectors to be the smaller of these two angles. The dot product will tell us how to find the angle between vectors. Let and be vectors in and the angle between them as illustrated in Figure 23.10.
Of particular interest to us will be the situation where vectors and are orthogonal (perpendicular).β40β Intuitively, we think of two vectors as orthogonal if the angle between them is .
When running a sprint, the racers may be aided or slowed by the wind. The wind assistance is a measure of the wind speed that is helping push the runners down the track. It is much easier to run a very fast race if the wind is blowing hard in the direction of the race. So that world records aren't dependent on the weather conditions, times are only recorded as record times if the wind aiding the runners is less than or equal to 2 meters per second. Wind speed for a race is recorded by a wind gauge that is set up close to the track. It is important to note, however, that weather is not always as cooperative as we might like. The wind does not always blow exactly in the direction of the track, so the gauge must account for the angle the wind makes with the track. If the wind is blowing in the direction of the vector in Figure 23.12 and the track is in the direction of the vector in Figure 23.12, then only part of the total wind vector is actually working to help the runners. This part is called the orthogonal projection of the vector onto the vector and is denoted proj. The next activity shows how to find this projection.
The wind component that acts perpendicular to the direction of is called the projection of orthogonal to and is denoted proj as shown in Figure 23.12. Write an equation that involves proj,proj, and . Then solve that equation for proj.
Given that and proj are orthogonal, what does that tell us about proj? Combine this fact with the result of part (a) and that proj to obtain an equation involving ,, and .
The orthogonal projection of a vector onto a vector is really a projection of the vector onto the space Span. The vector proj is the best approximation to of all the vectors in Span in the sense that proj is the closest to among all vectors in Span, as we will prove later.
In Activity 23.2 we defined two vectors and in to be orthogonal (or perpendicular) if . A use of orthogonality in geometry is to define a plane. A plane through the origin in is a two dimensional subspace of , and a plane is defined to be the set of all vectors in that are orthogonal to a given vector (called a normal vector). For example, to find the equation of the plane through the origin in orthogonal to the normal vector , we seek all the vectors such that
as the equation of this plane. The collection of all vectors that are orthogonal to a given subspace of vectors is called the orthogonal complement of that subspace in .
There is a more general idea here as defined in Preview Activity 23.6. If we have a set of vectors in , we let (read as β perpβ, called the orthogonal complement of ) be the set of all vectors in that are orthogonal to every vector in . In our plane example, the set is and is the plane with equation .
We have seen another example of orthogonal complements. Let be an matrix with rows , , , in order. Consider the three spaces Nul ,Row , and Col related to , where Row Span (that is, Row is the span of the rows of ). Let be a vector in Row .
To show that a vector is in the orthogonal complement of a subspace, it is not necessary to demonstrate that the vector is orthogonal to every vector in the subspace. If we have a basis for the subspace, it suffices to show that the vector is orthogonal to every vector in that basis for the subspace, as the next theorem demonstrates.
Let be a basis for a subspace of and let be a vector in . Our theorem is a biconditional, so we need to prove both implications. Since , it follows that if is orthogonal to every vector in , then is orthogonal to every vector in . This proves the forward implication. Now we assume that is orthogonal to every vector in and show that is orthogonal to every vector in . Let be a vector in . Then
for some scalars ,,,. Then
.
Thus, is orthogonal to and is orthogonal to every vector in .
Show that is orthogonal to the line . That is, is orthogonal to any vector on the line .
Solution.
Any vector on the line is a vector between two points on the line. Let and be points on the line . Then is a vector on line . Since and are on the line, we know that and . So and
Let be any point on line . Draw a representative picture of , with its initial point at , along with and . Explain how to use a projection to determine the distance from to .
Solution.
A picture of the situation is shown in Figure 23.18. If , then the distance from point to line is given by proj.
Let and . Every vector in has the form for some scalars and , and
.
So . Now we need to verify that spans . Let be in . Then for every . In particular, or , and or . Equivalently, we have and . So
.
So every vector in is a multiple of , and spans . We conclude that is a basis for . Thus, the vector is a normal vector to the plane if . The same reasoning works if at least one of ,,or is nonzero, so we can say in every case that is a normal vector to the plane .
For each of the following pairs of vectors, find , calculate the angle between and , determine if and are orthogonal, find and , calculate the distance between and , and determine the orthogonal projection of onto .
The Pythagorean Theorem states that if and are the lengths of the legs of a right triangle whose hypotenuse has length , then . If we think of the legs as defining vectors and , then the hypotenuse is the vector and we can restate the Pythagorean Theorem as
.
In this exercise we show that this result holds in any dimension.
for any vectors and in , is considered one of the most important inequalities in mathematics. We verify the Cauchy-Schwarz inequality in this exercise. Let and be vectors in .
Explain why the inequality (23.4) is true if either or is the zero vector. As a consequence, we assume that and are nonzero vectors for the remainder of this exercise.
Let and be vectors in . Then , and form a triangle. We should then expect that the length of any one side of the triangle is smaller than the sum of the lengths of the other sides (since the straight line distance is the shortest distance between two points). In other words, we expect that
.(23.5)
Equation (23.5) is called the Triangle Inequality. Use the Cauchy-Schwarz inequality (Exercise 8) to prove the triangle inequality.
To identify hidden polygons in a surface, we will utilize a technique called back face culling. This involves identifying which polygons are back facing and which are front facing relative to the viewer's perspective. The first step is to assign a direction to each polygon in a surface.
Consider the polygon in Figure 23.20. Since a polygon is flat, every vector in the polygon is perpendicular to a fixed vector (which we call a normal vector to the polygon). A normal vector for the polygon in Figure 23.20 is shown. In this activity we learn how to find a normal vector to a polygon.
Let and be two vectors in . If and are linearly independent, then and determine a polygon as shown in Figure 23.20. Our goal is to find a vector that is orthogonal to both and . Let be another vector in and let be the matrix whose rows are ,, and . Let be the th cofactor of , that is is times the determinant of the submatrix of obtained by deleting the th row and th column of . Now define the vector as follows:
.
The vector is called the cross product of the vectors and . (Note that the cross product is only defined for vectors in .) We will show that is orthogonal to both and , making a normal vector to the polygon defined by and .
Use the result of part (b) and properties of the determinant to calculate and . Explain why is orthogonal to both and and is therefore a normal vector to the polygon determined by and .
Project Activity 23.9 shows how we can find a normal vector to a parallelogram β take two vectors and between the vertices of the parallelogram and calculate their cross products. Such a normal vector can define a direction for the parallelogram. There is still a problem, however.
Project Activity 23.10 shows that the cross product is anticommutative, so we get different directions if we switch the order in which we calculate the cross product. To fix a direction, we establish the convention that we always label the vertices of our parallelogram in the counterclockwise direction as shown in Figure 23.20. This way we always use as the vector from vertex to vertex rather than the reverse. With this convention established, we can now define the direction of a parallelogram as the direction of its normal vector.
Once we have a normal vector established for each polygon, we can now determine which polygons are back-face and which are front-face. Figure 23.21 at left provides the gist of the idea, where we represent the polygons with line segments to illustrate. If the viewer's eye is at point and views the figures, the normal vectors of the visible polygons point in a direction toward the viewer (front-face) and the normal vectors of the polygons hidden from the viewer point away from the viewer (back-face). What remains is to determine an effective computational way to identify the front and back facing polygons.
Consider the situation as depicted at right in Figure 23.21. Assume that and are polygons (rendered one dimensionally here) with normal vectors at their centers as shown. The viewer's eye is at point and the viewer's line of vision to the centers and are indicated by the vectors . Each vector makes an angle with the normal to the polygon.
The dot product then provides us with a simple computational tool for identifying back-facing polygons (assuming we have already calculated all of the normal vectors). We can then create an algorithm to cull the back-facing polygons. Assuming that we the viewpoint and the coordinates of the polygons of the surface, complete the pseudo-code for a back-face culling algorithm:
for all polygons on the surface do
calculate the normal vector n using the ______ product for the current polygon
calculate the center C of the current polygon
calculate the viewing vector ______
if ______ then
render the current polygon
end if
end for
As a final comment, back-face culling generally reduces the number of polygons to be rendered by half. This algorithm is not perfect and does not always do what we want it to do (e.g., it may not remove all parts of a polygon that we don't see), so there are other algorithms to use in concert with back-face culling to correctly render objects.
Technically, is a matrix and not a scalar, but we usually think of matrices as scalars.
We use the term orthogonal instead of perpendicular because we will be able to extend this idea to situations where we normally don't think of objects as being perpendicular.