Math glossary

Equation of a Straight Line: Six Forms and When to Use Them

Write a straight-line equation from slope, one or two points, or intercepts. Compare standard, point-slope, intercept, and normal forms.

TL;DR

A straight line in the coordinate plane satisfies Ax+By=CAx+By=C, where AA and BB are not both zero. Use slope and a point, two points, or intercepts to find the equation.

Key Points

  • Slope-intercept form shows the slope and the value at x=0x=0.
  • Point-slope form is convenient when you know any point and the slope.
  • Two points determine a unique line if the points are distinct.
  • A vertical line has equation x=cx=c and undefined slope.
  • Check an equation by substituting the original points.

What are the forms of a straight-line equation?

A line is the set of all points that satisfy its equation. Different equations can represent the same set if they are obtained by reversible algebraic steps.

Form Equation What you need
Slope-intercept y=mx+by=mx+b Slope mm and intercept value bb
Point-slope y−y1=m(x−x1)y-y_1=m(x-x_1) A point and a finite slope
Standard Ax+By=CAx+By=C Real coefficients with AA and BB not both zero
Two-point y−y1=y2−y1x2−x1(x−x1)y-y_1=\frac{y_2-y_1}{x_2-x_1}(x-x_1) Two points with different xx coordinates
Intercept x/a+y/b=1x/a+y/b=1 Two distinct, nonzero axis intercepts aa and bb
Normal xcosα+ysinα=px\cos\alpha+y\sin\alpha=p Distance pp from the origin and the direction of a perpendicular

In normal form, α\alpha is measured from the positive xx-axis to a unit normal pointing from the origin toward the line and p≥0p\ge0. When the line passes through the origin, p=0p=0 and either unit normal gives a valid equation. For Ax+By=CAx+By=C, divide the equation by A2+B2\sqrt{A^2+B^2}. If the right side is negative, multiply the entire result by −1-1. The resulting xx and yy coefficients are the components cosα\cos\alpha and sinα\sin\alpha of the unit normal. The slope guide explains how the direction along a line is measured instead.

A line through points one comma two and four comma eight has a horizontal run of three and a vertical rise of six
Two points determine the direction and location. Their rise over run is 6/3=26/3=2.

How do you write the equation from one or two points?

If you know a point (x1,y1)(x_1,y_1) and finite slope mm, every point on the line must follow the same change in yy per change in xx. Therefore y−y1=m(x−x1)y-y_1=m(x-x_1). This equation includes the starting point because both sides become zero there. Expand if the question asks for y=mx+by=mx+b. OpenStax, Find the Equation of a Line

With two distinct points, calculate the slope first. Subtract coordinates in the same order. If both first coordinates are equal, the line is vertical and its equation is x=x1x=x_1. If both second coordinates are equal, the line is horizontal with equation y=y1y=y_1. For all other pairs, substitute either point into point-slope form and check the other point afterwards.

For a form that also handles vertical lines, multiply the two-point equation through by the run:

(x2−x1)(y−y1)=(y2−y1)(x−x1).(x_2-x_1)(y-y_1)=(y_2-y_1)(x-x_1).

If the run is zero and the points are distinct, the rise is nonzero and the equation forces x=x1x=x_1. If the two supplied points are identical, neither form determines a unique line. OpenStax, Writing an Equation Given Two Points

Can you write a line from two points without using a slope fraction?

Yes. Use the cross-multiplied form and simplify to standard form. With (−2,5)(-2,5) and (4,1)(4,1), the run is 6 and the rise is −4-4. Substitution gives 6(y−5)=−4(x+2)6(y-5)=-4(x+2), which simplifies to 2x+3y=112x+3y=11. Checking the first point gives −4+15=11-4+15=11. Checking the second gives 8+3=118+3=11. This approach avoids rounding a fractional slope before computing the intercept.

You can also calculate direction through the line’s midpoint for a check. The midpoint guide gives (1,3)(1,3) for this pair, and 2(1)+3(3)=112(1)+3(3)=11. The midpoint alone is not enough to find the line. It gives a third point to verify after you know the two endpoints.

How do you convert between forms?

To change y=mx+by=mx+b to standard form, move the xx and yy terms to one side. Multiply all terms by a common denominator if you want integer coefficients. For example, y=(2/3)x−4y=(2/3)x-4 gives 3y=2x−123y=2x-12, or 2x−3y=122x-3y=12. Standard-form triples that differ by a nonzero common multiplier describe the same line. Some courses also ask for no common integer factor and a positive leading coefficient. OpenStax, Use the Slope-Intercept Form

To convert Ax+By=CAx+By=C back, solve for yy if B≠0B\ne0. The slope is −A/B-A/B and the intercept value is C/BC/B. When B=0B=0, solve for xx instead. If you need a line through its nonzero axis crossings, the intercept guide explains how to recover and check them.

How do you use a parallel or perpendicular line?

Parallel nonvertical lines have equal slopes. Choose the given slope, substitute the new point, and verify the new intercept when a distinct line is required. Lines with equal slopes and equal intercepts coincide.

Perpendicular nonvertical lines with finite, nonzero slopes have a slope product of −1-1. For example, a line perpendicular to slope 3/23/2 has slope −2/3-2/3. A horizontal line and a vertical line are perpendicular as well. The perpendicular lines guide separates those cases. OpenStax, Find the Equation of a Line

Six Worked Straight-Line Equation Examples

Example 1

Find the line with slope −3-3 and yy-intercept 5.

  1. Use m=−3m=-3 and b=5b=5 in slope-intercept form.
  2. The equation is y=−3x+5y=-3x+5.
  3. Check that (0,5)(0,5) and (1,2)(1,2) satisfy it.

Example 2

Find the equation through (1,2)(1,2) and (4,8)(4,8).

  1. Calculate slope (8−2)/(4−1)=2(8-2)/(4-1)=2.
  2. Insert slope 2 and (1,2)(1,2) into point-slope form to get y−2=2(x−1)y-2=2(x-1).
  3. Simplify to y=2xy=2x. At x=4x=4, it gives y=8y=8.

Example 3

Write the line through (−2,4)(-2,4) with slope 3/23/2 in standard form.

  1. Start with y−4=(3/2)(x+2)y-4=(3/2)(x+2).
  2. Multiplying by 2 gives 2y−8=3x+62y-8=3x+6.
  3. Rearranging yields 3x−2y=−143x-2y=-14.

Example 4

Find the line through (6,−1)(6,-1) and (6,5)(6,5).

  1. The first coordinates agree and the second coordinates differ.
  2. The change in xx is zero, so the slope is undefined.
  3. Every point on the line has x=6x=6. Its equation is x=6x=6.

Example 5

Find a line through (3,−2)(3,-2) perpendicular to 2x+3y=62x+3y=6.

  1. The given line has slope −2/3-2/3.
  2. Use slope 3/23/2 through the new point to get y+2=(3/2)(x−3)y+2=(3/2)(x-3).
  3. Rearranging gives 3x−2y=133x-2y=13. At (3,−2)(3,-2) the left side is 9+4=139+4=13.

Example 6

Convert 3x+4y=203x+4y=20 to normal form.

  1. The length of the coefficient vector is 32+42=5\sqrt{3^2+4^2}=5.
  2. The equation becomes (3/5)x+(4/5)y=4(3/5)x+(4/5)y=4.
  3. The perpendicular distance from the origin is 4, and a unit normal has components (3/5,4/5)(3/5,4/5).

Common Straight-Line Equation Mistakes

Mistake 1: Substituting a point’s second coordinate as the intercept

A point’s yy value is the intercept only when its xx coordinate is zero. Use b=y1−mx1b=y_1-mx_1 for a point elsewhere.

Mistake 2: Multiplying only some terms when clearing fractions

Multiply both sides and every term by the same number. Substitute a known point to catch sign errors.

Mistake 3: Entering zero as the slope of a vertical line

A vertical line has zero run and undefined slope. Zero slope describes a horizontal line.

Try It Yourself

  1. Write the equation through (2,7)(2,7) with slope 3.
  2. Write the equation through (0,4)(0,4) and (5,4)(5,4).
  3. Find the line through (1,2)(1,2) parallel to y=−4x+3y=-4x+3.

Answers. 1. y=3x+1y=3x+1. 2. y=4y=4. 3. y=−4x+6y=-4x+6.

Conclusion

  • Identify the information given before choosing an equation form.
  • Check whether the line is vertical before dividing by its run.
  • Substitute known points into the finished equation to test it.

Read More

Research Behind This Article

  1. OpenStax, Elementary Algebra 2e: Find the Equation of a Line. OpenStax
  2. OpenStax, Intermediate Algebra: Find the Equation of a Line. OpenStax
  3. OpenStax, Algebra 1: Writing an Equation Given Two Points. OpenStax
  4. OpenStax, Elementary Algebra 2e: Use the Slope-Intercept Form of an Equation of a Line. OpenStax