## Learn how to use the distance formula

A natural need is to be able to calculate distances in the space. It can be the distance between two points, between a point and a line or between a line and a plane. There are distance formulas for the different cases, and they are presented here.

Distance is always measured between two points. The distance formula is equivalent to creating a vector between two points and calculating its length.

It is tempting to memorize these, but it is not recommended because there is a strong connection between students who do not pass the exam and those who memorize these formulas instead of learning the craft.

### Distance between two points

By a distance , we always mean the shortest distance between two points, which is equivalent to calculating the length of a vector that has been created from these two points. The following function applies for :

which can be recognized from the length of a vector. Since each vector is a relative difference in the different terms, that is, an arrow between two points, the formula for the distance between the points can be derived from the definition of the length of a vector.

The following applies to the distance formula :

Let and be points in the space . Then:

if and only if

### Distance between a point and a line

We will cover two methods to calculate the distance between a point and a line .

#### Method 1: Cross product in

Let:

Take a point located on the line . With a little creativity, you can see that and span a parallelogram with the height . The area is the base multiplied by the height, which is also equal to the length of the cross product . Therefore, we can divide the latter by the length of the base (the vector ) to get the height .

The above formula only works for because the cross product is only defined then.

#### Method 2: Projection

Let:

The distance can be found by projection, a relationship which is illustrated by a simple vector summation:

Therefore, it applies that:

#### Method 3: Dot product

Consider the shortest distance between the point and the point on the line whose vector forms a right angle with the line. If both and are known points, the calculation of the length is simple, namely:

Remember that , which means that the vector is orthogonal to the line . We find the unknown point by setting the corresponding requirement for , i.e. the equation:

Because the two vectors form a right angle, the dot product becomes 0. The point is unknown with several coordinates, which results in several unknowns (one per coordinate) while we only have one equation. However, the point can be expressed using the parametric form for for some unknown parameter value :

where and are known. We make the following substitution:

The equation is solved for the as yet unknown value, namely , since the vector forms a right angle with . When solved, insert in the parametric form and get the desired point . Then we have two known points, and , and the distance between them is the length of their vector:

#### Method 4: Create a plane

With a little creativity, we can construct the plane that contains the point and has a normal vector parallel to the direction vector for . From there, the intersection point between and can be determined, which will also be the closest point on the line to . The procedure is as follows:

Create the equation:

for the plane with normal vector = direction vector for = .

The constant is obtained by inserting the point into the plane's equation.

Insert the parametric form for into the plane . Solve for the parameter (we have one equation and one variable).

Let be the parameter that represents the intersection point . Insert in the parametric form for and get .

Calculate the distance:

### Distance between a point and a plane

Let be a plane and be a point in the space as follows:

Create the line that passes through the point and hits the plane at a right angle. The direction vector therefore becomes the plane's normal vector (which we read from the plane's equation). We then get:

We are looking for the point of intersection between the line and the plane . The parametric form for expresses all points along the line, and we can express each such point in the following way:

Our design of guarantees an intersection point precisely because the direction vector is the plane's normal vector. Therefore, we put the above expression into the plane's equation:

The above equation is easily solved because only is unknown. Let's note the solution as :

which also returns the desired intersection point when it is inserted into the parametric form for . The point therefore has the following coordinates:

Now both and are known, and therefore the distance is easily calculated by creating a vector and calculating the length:

Which leads to the formula for the distance between a point and a plane. Again - it is recommended to remember the method leading to the formula rather than remembering the formula by heart!

## Good outline for linear algebra and short to-do list

We work hard to provide you with short, concise and educational knowledge. Contrary to what many books do.

## Get exam problems for old linear algebra exams divided into chapters

The trick is to both learn the theory and practice on exam problems. We have categorized them to make it extra easy.