In this explainer, we will learn how to find the equation of a line in the form or given the slope and one point, or two different points, that it passes through.

An equation of a straight line, or a linear equation, in two variables is any polynomial equation of degree 1 containing exactly two variables (usually and ). You have already encountered equations of straight lines in the slopeβintercept form, that is, in the form which describe a straight line in the plane, with slope , crossing the -axis at the point . An example of a polynomial equation that is not linear might be something of the form This equation contains a term of degree 2, namely , and is therefore not an equation of a straight line. It is a quadratic equation and if you were to draw its graph, you would not get a straight line but a curveβa parabola.

In this explainer, we will look at equations of straight lines in two other forms: the pointβslope form, and the general form, and we will learn how to derive these equations from two pieces of data: either two given points on the line in question or a single point on the line and the lineβs slope.

Let us consider first the pointβslope form of an equation of a straight line: Here, and are the variables, denotes the slope of the line, and and are the - and -coordinates of any given point that lies on the line. One way to think about this form of an equation of a straight line is as a reformulation of the definition of the slope.

The slope of a straight line is defined as follows:

If we are given two points on the line, say and , then we can calculate the ratio of the change in to the change in using the differences of the -coordinates and -coordinates of the two points. That is,

Taking to be the βgeneral pointβ on the line, we have and multiplying everything by yields

We can also convert back and forth between the slopeβintercept and pointβslope forms. On the one hand, given an equation of a line in the slopeβintercept form we can rearrange it as which is in pointβslope form; the point is the -intercept of the line. On the other hand, given a straight line equation in the pointβslope form we can first expand the bracket: Then, we can rearrange for which is in slopeβintercept form; is the -coordinate of the lineβs -intercept.

To write down the pointβslope form of a straight line equation given that the slope and a point on the line are straightforward, let us look at an example.

### Example 1: Finding the Equation of a Line given the Slope and a Point on the Line

Find, in pointβslope form, the equation of the graph with slope 4 that passes through the point .

### Answer

The question tells us that we should give our answer in pointβslope form. Therefore, the first thing to do is to write down the pointβslope form of an equation of a straight line:

The only thing to do now is to substitute in the relevant quantities. In this equation, denotes the slope of the line, which we are told is . The quantities and are the - and -coordinates of any point on the line. This we are also given: is a point on the line, so we can take and . Hence, our answer is or

Both the pointβslope and the slopeβintercept forms are useful forms of an equation of a straight line. As we saw in the previous example, they are often easy to write down, and they are also easy to interpret, giving one immediate access to the slope of the line in question and the coordinates of a point on it. However, both forms have a small problem: not every straight line can be written in these forms. Specifically, lines of the form for any constant , that is, lines parallel to the -axis, cannot be written in these forms since the slopes of such lines are not defined. For this reason, we will sometimes need to use the general form of an equation of a straight line . Fortunately, converting from pointβslope form to general form is just a matter of rearrangement: where this corresponds to , , and in the general form. Similarly, we can rearrange to slopeβintercept form to get where , , and .

Now, what if we are given not a lineβs slope and a point on it, but two points on a line? In order to write down an equation of the line in this situation, we must first calculate the slope of the line. As above, the slope of a line can be calculated by where and are two points on the line. Now that we have the slope of the line and a point on it (in fact, two: you can pick either or ), we can write down an equation for the line in pointβslope form just as in the previous example.

### Example 2: Finding the Equation of a Line in General Form given Two Points on the Line

A line passes through the points and . Work out the equation of the line, giving your answer in the form .

### Answer

First, we calculate the slope of the line using Now, we can substitute the slope and the coordinates of a point on the line into the pointβslope form of the equation of the line: Substituting the coordinates of the point , we get the equation

To convert this equation into general form , we first collect all nonzero terms on the left-hand side: Then, we multiply everything by 4 to get integral coefficients:

So, the equation of the line passing through the points and in general form is .

In the previous example, after calculating the slope of the line, we substituted in the coordinates of one of the points we were givenβthe point βto obtain an equation for the line. However, we were given two points on the line, not one. What if we had used the coordinates of the other point? Would this not give us a different equation?

Indeed, substituting the coordinates of into yields or which is certainly not the same equation as However, while these two equations are different, they describe the same line, since by multiplying out the right-hand side and simplifying, we get The first equation yields the same equation in slopeβintercept form as when we apply this procedure to the second equation:

So, we have shown that regardless of the choice of points, we will always arrive at the same equation upon rearranging. In general, this is a quality that applies to any point on the line that we choose.

The examples that follow are variations on this theme of finding the equation of a line given its slope and a point or given two points on the line.

### Example 3: Finding the Equation of a Line given Its Slope and Given That It Shares Its π- or π-Intercept with Another Given Line

The line crosses the -axis at the point . Find the equation of the line with a slope of passing through the point .

### Answer

This is an example of a question in which we are being asked to find the equation of a line given its slope and a point on it. The only complication here is that the point we are given is slightly βdisguised.β

First of all, write down the pointβslope form of the equation of the line: We can immediately substitute in the value of the slope since we are given this in the question:

We are also given a point on the line: . The question is, what are the coordinates of this point? We are told that is the point at which the line crosses the -axis. Since the -axis is the collection of all points on the plane with -coordinate zero, we can substitute zero for in the equation to find the -coordinate of this lineβs -intercept: Hence, the coordinates of the point are . We can now substitute these coordinates into giving us a final answer of or

In the previous example, we were not given the coordinates of a point on the line directly but had to deduce it from the information given to us. In this next example, we will investigate the case when one of the points is given as the intersection point of two other lines.

### Example 4: Finding the Equation of a Line given a Point on the Line and Given That It Passes through the Intersection Point of Two Other Given Lines

The lines and intersect at the point . The point has coordinates . Find the equation of the line passing through the points and .

### Answer

In this question, we are being asked to find the equation of a line given two points and on that line. We are given the coordinates of the point but are only told that the point is the intersection point of two other lines. We will therefore need to do a little work to calculate the coordinates of . We will proceed as follows:

- Calculate the coordinates of the point .
- Use the points and to calculate the slope of the line passing through them.
- Substitute the slope of the line and the coordinates of either point or into the pointβslope form of the equation of a straight line to find the equation we are looking for.

So, we begin by calculating the coordinates of the point . We have that is the intersection of the lines and . So, we can find the coordinates of this point by setting the -variables in each equation to be equal to each other. That is, we have To simplify this, we can multiply everything by 3, and then collect the terms in on the left to get and the constant terms on the right to get Then, we divide by 4 to get Now, substitute into either of the equations or to find the -coordinate of the point : So, the coordinates of are .

We can now calculate the slope of the line passing through and : The last step is to substitute our slope and the coordinates of either or into the pointβslope form of the equation of a straight line, to find the equation we are looking for. So, our final answer is using the point , or using the point .

In this final example, we will calculate an equation of a straight line given the data of two points on the line, neither of which are given explicitly by coordinates.

### Example 5: Finding the Equation of a Line That Passes through the π- and π-Intercepts of Two Other Lines

Find the equation of the line joining the -intercept of the line with the -intercept of the line . Give your answer in the form , where , , and are integers.

### Answer

Once we have calculated the coordinates of the -intercept of the line and the -intercept of the line , this is simply a question of working out the equation of a line passing through two given points and then converting that equation to the general form .

Since we are given the equation of the line in slopeβintercept form, the coordinates of its -intercept may be read off directly: it crosses the -axis at . Let us call this point .

To find the -intercept of the line , we substitute into its equation: giving us the coordinates . Let us call this point .

It may be helpful to draw a sketch at this point.

The next step is to calculate the slope of the line passing through and :

At this point, we could substitute into the pointβslope form of the equation of a straight line, but since we actually know the -intercept of our line (namely ), it is easier to use the slopeβintercept form So, substituting, we have This is an equation for the line passing through the points and . All that remains now is to convert this into the general form with , , and as integers. First, we collect all nonzero terms on the left-hand side: Finally, we multiply everything by for our final answer:

Let us finish by recapping a few important concepts from this explainer.

### Key Points

- Given the slope of a line and the coordinates of a point on , you can write down an equation for by substituting , , and into the pointβslope form of the equation of a straight line:
- If you are given two points and on a line , you can write down an equation for by first calculating its slope using the formula and then substituting this along with the coordinates of either of the points or into the pointβslope form of the equation of a straight line as before.
- It is sometimes necessary to write down the equation of a straight line in the general form not least because not all lines have equations of slopeβintercept or pointβslope forms (namely lines for constant , parallel to the -axis). You can convert from slopeβintercept or pointβslope form to general form by rearranging