In this explainer, we will learn how to write the equation of a line parallel or perpendicular to another line.
There are many ways of classifying straight lines that can be helpful, depending on the circumstances. The most familiar expression of a straight line is using the formula
where we would plot this graph in the -plane, with representing the slope of the line and representing the -intercept. The slope tells us the slope of the line, and the -intercept is where it crosses the -axis. These two pieces of information are enough to understand everything about a straight line and to plot it at any point in the -plane, and we refer to equation (1) as the “slope–intercept” form of a straight line. More often than not, when solving a problem involving a straight line, we will be looking to write the answer in this format, where and are calculated as part of solving the problem.
The value of the slope determines the general “direction” of the straight line. Reading left to right, if is positive, then the slope goes “uphill,” and if is negative, then the slope goes “downhill.” We can demonstrate this by taking two straight lines, as follows:
The two lines have the same -intercept but slopes with opposite signs. These two functions are plotted in the graph below, where is shown in red and is shown in green. The graph of travels “uphill” as we move left to right, which is due to the positive slope, whereas travels “downhill” due to the negative slope. This is a fundamental property relating to straight lines, and we will return to the matter later when we discuss perpendicular lines.
For the moment, it is worth remembering that slope–intercept form is only one way of writing the equation of a straight line, even though this is the most common. We may generally be given any linear equation as a way of classifying a straight line, for example -plane where , , and are real numbers. This expression is less common than slope–intercept form of equation (1), but nonetheless it is perfectly valid. Indeed, solving the above equation for will yield the traditional slope–intercept form (providing that ). Sometimes, we will be given the equation of a straight line in the above format rather than in slope–intercept form, and we will be expected to work with this expression natively.
There are two other ways of writing a straight line that will be particularly useful. Suppose we are told that there is a straight line that has slope and passes through the particular point . Then, the equation of the straight line with these properties is given by which can of course be rearranged into the slope–intercept form of equation (1). For this result to be directly applicable, the slope must first be known, and there are many examples where this will be the case, as we will see throughout the rest of this explainer.
The final result is the most relevant for a discussion on the slope, since it expresses the equation of a straight line that is known to pass through the two points and . In this case, the equation of the straight line is given by the formula
In this case, we will actually choose to rewrite the above expression in slope–intercept form by solving for , since this will serve as a reminder of how we can calculate the slope of any straight line from two points that the line passes through. Suppose we were to take the equation above and multiply both sides by . This would effectively cancel this term in the denominator of the left-hand side, giving the new result
As an interim step, we can tidy up the equation above slightly, as follows:
Expanding out the right-hand side then gives and then finally solving for gives
This is hardly the neatest way of writing the previous equation, but it does allow us to compare it directly to the slope–intercept form of a straight line as described in equation (1). By comparing the -terms between this equation and the one directly above, we find that we can write the slope as which confirms what we know about calculating the slope of a straight line given two points on the line.
These results have been included as a reminder of the known techniques we can employ when working with straight lines, and we will use all of these throughout the explainer as an integral part of our workings. Although we will give some outline working in many examples, it is generally assumed that you will be comfortable enough with these techniques that many stages of working should not be too mysterious! With this point hopefully made, we will now introduce the first of the two key concepts of this explainer: parallel lines.
Definition: Parallel Lines
Consider two straight lines with slopes and . These two lines are parallel if and the lines have different -intercepts. If the -intercepts are also the same, then the two lines are identical.
We will demonstrate this with an example. Suppose that we had the straight line that was already written in slope–intercept form as follows:
We know that the slope is equal to 3, meaning that the slope goes uphill, moving from left to right. Furthermore, the line has a -intercept of . This is enough information to allow us to render the following plot.
Now suppose that we took the second straight line that is governed by the equation
Clearly the two straight lines have the same slope but different -intercepts. By our definition above, this means that the two straight lines are parallel to each other, which can be seen when we plot the new line below in green.
By the definition of parallelism, these two lines will never meet each other. This can be observed algebraically if one attempts to solve the simultaneous equations and , which quickly results in a mathematical error.
The above situation is probably the easiest circumstance of determining whether two lines are parallel because they are both written in slope–intercept form, meaning that we can directly compare the slopes and the -intercepts. In the following examples, we will see that we have to work harder and use many of the results that were introduced in this explainer before we even began speaking of parallel lines.
Example 1: Finding the Equation of a Line That Is Parallel to a Given Line
Write, in the form , the equation of the line through that is parallel to the line .
We begin by rearranging the equation into the standard slope–intercept form. Doing so gives the equation which means that the slope of this line is . The line we must calculate is parallel to the line above, meaning that the we can write the slope of the new line as . We are also told that the new line must pass through the point , which, with knowledge of the slope, is enough to classify the line entirely. For a general straight line with slope that passes through the point , we can use the formula
By substituting and into this equation, we obtain which we can solve for to find
We could check that these lines are parallel by plotting both of them, as we have done below. The first line is plotted in green, and the second line is plotted in red. We can see that the red line passes through the point , which is plotted in purple.
It is not always necessary to plot straight lines, nor to think of them in any geometric sense, if all we are interested in is whether or not they are parallel. The conditions in the above definition are algebraic conditions on the relationships between the two slopes and the two -intercepts. As such, plotting straight lines can sometimes be thought of as a helpful technique rather than a necessary step, although of course it is normally good practice to sketch out a problem in order to understand it fully and help verify any results. In the following two examples, we will answer the questions using purely algebraic means and then plot a graph to verify our working.
Example 2: Finding the Values of the Unknown Coefficients in Two Parallel Straight Lines’ Equations
The straight lines and are parallel. What is the value of ?
For the two lines to be parallel, we require that their two slopes be equal. Rearranging both of the given equations for will give the two results
The two slope terms will be equal if , which will also imply that the -intercepts will be different (also having opposite sign). This fits the two requirements for straight lines to be parallel, meaning that the second line is written in full as
Below, we have plotted both of these lines to demonstrate that they are parallel, where the first line is in red and the second line is in green. This confirms that the answer is correct.
Example 3: Finding the Equation of a Straight Line That is Parallel to Another Given Line
Find, in slope–intercept form, the equation of the straight line passing through the point and parallel to the straight line passing through the two points and .
We begin by calculating the equation of the second line so that we can find the slope as part of this process. For a straight line passing through the two points and , we can use the formula
By setting and into the equation above, we obtain
This simplifies slightly to give which we can solve for to find
Now that the second line has been written in slope–intercept form, we can see that the slope is . For any line to be parallel to this line, the slope must be the same, meaning that .
Now that the slope of the new line is known, we can recall the formula for a straight line with known slope that passes through the point :
Taking the calculated slope and the given point , we substitute both of these into the equation above to obtain
Solving for gives the equation in slope–intercept form:
To verify that we have completed the calculations correctly, we have created the plot below. The two points and are plotted in purple, with the first line going through these two points being plotted in red. The point is plotted in black, and the parallel line through this point is plotted in green.
In the previous two examples, we saw how we needed a strong understanding of the core techniques that could be used to obtain the equation of a straight line, depending on which two pieces of information we are initially given. Ideally, these would be the slope and the -intercept, which would allow the line to be written immediately in slope–intercept form. Usually, however, this is not the case, and we are instead given information that requires us to complete some extra working in order to understand the full picture. The same principles will be true as we move into the second half of this explainer to focus on perpendicular lines, where we will assume that the main techniques involving straight lines are fully understood.
Definition: Perpendicular Lines
Consider two straight lines with slopes and . These two lines are perpendicular (at right angles to each other) if they have the relationship . This relationship is often expressed by the equivalent form , meaning that the product of the slopes must be . Two perpendicular lines will meet each other exactly once.
To illustrate this idea, we will return to the two lines that we gave at the very start of this explainer. These were defined as
We observed that the slope of the first line was positive, meaning that it went “uphill”, and that the slope of the second line was negative, meaning that it went “downhill.” As a reminder, when plotted, the two lines are as follows.
What we have not yet stated is that, visually, these two lines appear to be perpendicular to each other, meeting at a right angle at the point , which also happens to be the -intercept. If the slope of the first line is written as and the slope of the second line as , then we do find that these obey the given relationship . Then, according to our definition, these lines are perpendicular.
If two lines are perpendicular, then , which means that the two slopes must have the opposite sign to each other. Consequently, if is positive, then must be negative, and vice versa. Geometrically speaking, if the first line is uphill, then the second (perpendicular) line is downhill, and vice versa. This geometric understanding provides a method for verifying whether two given lines are perpendicular. It should be noted, however, that two lines having slopes with opposite signs does not mean that they are perpendicular. For example, if one line had a slope of 10 000 and the other had a slope of , then these would certainly not be perpendicular!
Note that, unlike the criteria for parallel lines, for perpendicular lines there are no conditions on the -intercepts of the two lines involved. In fact, this is entirely irrelevant when deciding whether two lines are perpendicular, which depends only on the two slopes of the lines involved. We can actually prove that two perpendicular lines will always meet. Suppose we took two perpendicular lines with two different -intercepts but with the relationship between the slopes . We could take the two lines in slope–intercept form, as follows:
We could solve for both and to find where these two lines meet each other by first setting
Bringing the slope terms to the left-hand side and the -intercept term to the right-hand side gives which we choose to write in the equivalent form
Solving for then gives
The crucial point is that we can always calculate the -coordinate of the meeting point, irrespective of the values of or , although we must be wary that we cannot allow the slope of either line to be zero, as otherwise the initial relationship would not be valid. By substituting the above value for into the equation , we would find (after skipping some working) that meaning that we always have an expression for the -coordinate of the meeting point.
For the moment, this is all that we will need to understand about perpendicular lines, and we will now proceed with some examples of this type.
Example 4: Determining the Condition for Two Lines to be Perpendicular Using Their Equations
If lines and are perpendicular, which of the following products equals ?
Assume that there are two perpendicular lines with slopes and . Then, by definition, these slopes must be in the relationship . Alternatively, we can express this in the form .
With this alternative expression now being established, we see that the two given lines are written in slope–intercept form. Hence, the slopes are respectively and . For these lines to be perpendicular, we require that , or, alternatively, that . Therefore, the product of and is , which corresponds to option D above.
We will now give two final examples that will require us to understand the criteria for two lines to be perpendicular as well as all of the different formulae for straight lines that we gave at the beginning of this explainer. For both examples, we will complete the working algebraically and then plot the graphs of the straight lines as a confirmatory step. Given that we will always be talking about perpendicular lines, we will expect to observe the behavior that we noted earlier: that if one line has a positive slope, then the other will have a negative slope (and vice versa), meaning that one line will always be going uphill, while the other will always be going downhill.
Example 5: Finding the Equation of a Straight Line That is Perpendicular to Another Given Line
Find, in slope–intercept form, the equation of the line perpendicular to that passes through the point .
We are conveniently given the first line in slope–intercept form, which means that we can directly read off the slope as . For any other line to be perpendicular, the two slopes must obey the relationship , which gives the slope of the second line as . We will choose to write this as .
The equation of a straight line with slope that goes through the point is given by
We substitute and into this expression, giving
Rearranging and solving for gives the equation in slope–intercept form:
In the graph below, we have plotted the first line in red and the second, perpendicular line in green. As we can see, the two lines do appear to be perpendicular, and the second line passes through the point , as shown in black. The two slopes have opposite signs, which is also reflected in the diagram.
Example 6: Determining in Slope–Intercept Form the Equation of a Line given a Perpendicular Line
Determine, in slope–intercept form, the equation of the line passing through and perpendicular to the line passing through and .
We will first calculate the slope of the straight line that passes through the points and . The slope for a straight line through the two points and is as follows:
We substitute the values and into this equation, giving
With this result established, we are now interested in finding the equation of the straight line that is perpendicular to the initial line while passing through the point . If the slope of the second line is , then we must have the relationship , which gives . We will write this more simply as . We can now find the equation of this line by recalling that the equation for a straight line with a known slope that passes through the point is given by the formula
Now, substituting and into this equation gives
Solving this equation for gives the slope–intercept form
Below, we have plotted the initial straight line in red, and this passes through the two points and , which are plotted in purple. The second line is plotted in green, and this is clearly perpendicular to the red line, also passing through the given point .
- The slope–intercept form of a straight line is given by , where is the slope and is the -intercept.
- An equation with slope that goes through the point can be written as , which can be rearranged into slope–intercept form.
- The equation of a straight line through the two points and can be written as , which can also be rearranged into slope–intercept form.
- Take two straight lines with slopes and . These lines are parallel if (and the two -intercepts are different).
- If we have the relation , then the two straight lines are perpendicular and it is guaranteed that they will meet each other. This relationship is sometimes written in the form .