The Equation of a Line

Part 11, Chapter 11: Lines, Rays, and Segments

Learning objectives

  • Write the equation of a line in slope-intercept form and point-slope form
  • Find the slope of a line through two given points
  • Identify horizontal and vertical lines and their equations
  • Convert between different forms of line equations

The parametric form is elegant; the ordinary form y=mx+by = mx + b is what you grew up with. Both describe the same lines, but the ordinary form trades the parameter tt for a direct relation between xx and yy. That makes it perfect for graphing, for spotting whether two lines are parallel or perpendicular at a glance, and for the entire enterprise of school algebra. This section is the bridge between the two views: parametric and ordinary.

Slope, the rate of change

The slope of the line through (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) (assuming x1neqx2x_1 \neq x_2) is

m=fracy2y1x2x1.m = \frac{y_2 - y_1}{x_2 - x_1}.

It measures how much yy changes for each unit change in xx. A slope of 22 means: walk 11 unit right, climb 22 units. A slope of 1/3-1/3 means: walk 33 units right, drop 11 unit. Slope is the geometric soul of the line, and (in calculus) it generalises to the derivative.

Slope-intercept form

The most common equation for a line:

y=mx+b.y = m x + b.

Here mm is the slope and bb is the yy-intercept, the value of yy where the line crosses the yy-axis (i.e., when x=0x = 0). Two numbers determine a line completely.

Where this shows up
  • Statistics: Linear regression fits the line y=mx+by = mx + b to a cloud of data points; the slope mm is the most-asked-for number in elementary stats ("how much does Y change per unit of X?").
  • Economics: A demand curve Q=abPQ = a - bP is a line in slope-intercept form; the slope b-b measures price sensitivity (price elasticity at a point), one of the most central quantities in microeconomics.
  • Physics: Hooke's law F=kxF = -kx is a line through the origin with slope k-k; the spring constant is just the negative slope, and finding kk from data is the simplest experiment a physics student does.

Adjust the slope and intercept sliders. The equation display updates live as y=mx+by = mx + b. Each pair (m,b)(m, b) gives a unique line.

Point-slope form

When you know the slope mm and any one point (x1,y1)(x_1, y_1) on the line, the point-slope form writes the equation directly:

yy1=m(xx1).y - y_1 = m (x - x_1).

This is just the slope formula m=(yy1)/(xx1)m = (y - y_1)/(x - x_1) rearranged. It is the workhorse for finding line equations: compute slope, plug in a point, simplify if you want.

Special cases: horizontal and vertical lines

  • A horizontal line has slope m=0m = 0; its equation is y=by = b (constant).
  • A vertical line has undefined slope (division by zero in mm); its equation is x=ax = a. Vertical lines cannot be written as y=mx+by = mx + b.

Parallel and perpendicular: slope tests

Using slopes, two non-vertical lines are:

  • Parallel ⇔ their slopes are equal: m1=m2m_1 = m_2.
  • Perpendicular ⇔ their slopes are negative reciprocals: m1m2=1m_1 m_2 = -1, or m2=1/m1m_2 = -1/m_1.

So y=3x+2y = 3x + 2 and y=3x5y = 3x - 5 are parallel (same slope 33, different intercept); y=2x+1y = 2x + 1 and y=tfrac12x+7y = -\tfrac{1}{2}x + 7 are perpendicular (2cdot(1/2)=12 \cdot (-1/2) = -1).

From two points to an equation, the standard recipe

Through (1,3)(1, 3) and (4,9)(4, 9): slope m=(93)/(41)=2m = (9 - 3)/(4 - 1) = 2. Use point-slope with (1,3)(1, 3): y3=2(x1)y - 3 = 2(x - 1). Simplify: y=2x+1y = 2x + 1. Done. The same line can be written as y9=2(x4)y - 9 = 2(x - 4) using the other point, check by simplifying that you get y=2x+1y = 2x + 1 either way.

Try it

  • Before adjusting: with m=2m = 2 and b=0b = 0, what is the equation of the line, and which point does it pass through? Set the sliders and verify it is y=2xy = 2x through the origin.
  • Predict first: with m=1m = -1 and b=3b = 3, where does the line cross the yy-axis, and does it rise or fall? Set the sliders and verify it is y=x+3y = -x + 3.
  • What is the slope of a line perpendicular to y=tfrac25x+1y = \tfrac{2}{5}x + 1? Answer: tfrac52-\tfrac{5}{2}.

A trap to watch for

"Parallel lines have the same equation." No, parallel lines have the same slope but generally different intercepts. The lines y=2x+1y = 2x + 1 and y=2x+5y = 2x + 5 are parallel but distinct (the second one is shifted up by 44). If two distinct lines have the same equation, they are the same line, which is more than parallel. A second common trap: forgetting that vertical lines have no slope and cannot fit y=mx+by = mx + b. Always check whether the two points share an xx-coordinate before computing slope; if they do, you have a vertical line x=ax = a.

What you now know

You can move freely between the slope-intercept form y=mx+by = mx + b, the point-slope form yy1=m(xx1)y - y_1 = m(x - x_1), and the parametric form P(t)=A+t(BA)P(t) = A + t(B - A); you can identify parallel and perpendicular lines from their slopes; and you can write the equation of a line through any two given points. With this section you have a complete algebraic toolkit for straight lines in the plane, the foundation for everything that follows in trigonometry, conics, and calculus.

Quick check

Mark section complete →

References

  • Lang, S. (1971). Basic Mathematics. Springer. Chapter 10, §4, the ordinary equation of a line and slope-intercept form.
  • Stewart, J. (2015). Calculus, 8th ed. Cengage. Appendix B covers lines in coordinates as a calculus prerequisite.
  • Apostol, T. M. (1967). Calculus, Volume 1, 2nd ed. Wiley. §1.6 develops slope-intercept lines and connects them to the derivative.
  • Coxeter, H. S. M. (1969). Introduction to Geometry, 2nd ed. Wiley. §13 develops line equations in the broader affine setting.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.