Mathwords logoMathwords

Equation of a Line — Forms, Formula & Examples

Equation of a Line

The various common forms for the equation of a line are listed below. In all forms, slope is represented by m, the x-intercept by a, and the y-intercept by b.

Note: The standard form coefficients A, B, and C have no particular graphical significance.

Forms for the Equation of a Line

Slope-intercept

y = mx + b

Used when you have the slope and the y-intercept.
Point-slope

yy1 = m(xx1)

(x1, y1) is a point on the line.
Standard form

Ax + By = C

If possible, A is nonnegative and A, B, and C are relatively prime integers.
Two-intercept

Mathematical equation: x/a + y/b = 1, the intercept form of a line with x-intercept a and y-intercept b.

Used when you have both intercepts.
Vertical

x = a

All points have x-coordinate a.
Horizontal

y = b

All points have y-coordinate b.

 

Movie Clips (with narration)

Eqn of a Horizontal Line
Horizontal Line:
how to find the equation

(1.43M)
Eqn of a Vertical Line
Vertical Line:
how to find the equation

(1.46M)
Eqn of a line, point-slope
Point and Slope:
How to find the equation of a line

(4.13M)
Eqn of a line, two points
Two Points:
How to find the equation of a line

(5.5M)

Key Formula

y=mx+b(slope-intercept)yy1=m(xx1)(point-slope)Ax+By=C(standard form)\begin{gathered}y = mx + b \qquad\text{(slope-intercept)}\\y - y_1 = m(x - x_1) \qquad\text{(point-slope)}\\Ax + By = C \qquad\text{(standard form)}\end{gathered}
Where:
  • mm = Slope of the line (rise over run)
  • bb = y-intercept — the y-coordinate where the line crosses the y-axis
  • (x1,y1)(x_1, y_1) = A known point on the line
  • A,B,CA, B, C = Integer coefficients in standard form, where A is nonnegative and A, B, C are relatively prime
  • x,yx, y = Coordinates of any point on the line

Worked Example

Problem: Find the equation of the line that passes through the points (1, 2) and (4, 8). Write the answer in slope-intercept form.
Step 1: Calculate the slope using the two points.
m=y2y1x2x1=8241=63=2m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{8 - 2}{4 - 1} = \frac{6}{3} = 2
Step 2: Use point-slope form with the point (1, 2) and slope m = 2.
y2=2(x1)y - 2 = 2(x - 1)
Step 3: Distribute the slope on the right side.
y2=2x2y - 2 = 2x - 2
Step 4: Add 2 to both sides to isolate y and obtain slope-intercept form.
y=2xy = 2x
Answer: The equation of the line is y = 2x (slope-intercept form with m = 2 and b = 0).

Another Example

This example differs by starting with a single point and slope (rather than two points) and converting to standard form instead of slope-intercept form.

Problem: Write the equation of the line with slope −3 that passes through the point (2, 5). Give the answer in standard form.
Step 1: Start with point-slope form using the given point and slope.
y5=3(x2)y - 5 = -3(x - 2)
Step 2: Distribute the slope on the right side.
y5=3x+6y - 5 = -3x + 6
Step 3: Add 3x to both sides to move the x-term to the left.
3x+y5=63x + y - 5 = 6
Step 4: Add 5 to both sides to isolate the constant on the right.
3x+y=113x + y = 11
Answer: The equation in standard form is 3x + y = 11.

Frequently Asked Questions

What is the difference between slope-intercept form and point-slope form?
Slope-intercept form, y = mx + b, directly shows the slope and the y-intercept, making it easy to graph quickly. Point-slope form, y − y₁ = m(x − x₁), is built around a specific point on the line and the slope. Use slope-intercept when you already know the y-intercept; use point-slope when you know the slope and any point that may not be on the y-axis.
How do you find the equation of a line from two points?
First, compute the slope: m = (y₂ − y₁)/(x₂ − x₁). Then substitute m and either point into the point-slope form y − y₁ = m(x − x₁). Finally, simplify into whichever form your problem requires. If the two x-coordinates are equal, the line is vertical and has the equation x = a.
When should you use standard form for a line?
Standard form Ax + By = C is useful when solving systems of equations (since both variables are on the same side), when working with integer coefficients, or when a problem specifically requests it. It also makes it easy to find intercepts: set x = 0 to get the y-intercept and y = 0 to get the x-intercept.

Slope-Intercept Form vs. Point-Slope Form

Slope-Intercept FormPoint-Slope Form
Formulay = mx + by − y₁ = m(x − x₁)
Key information shownSlope (m) and y-intercept (b)Slope (m) and one point (x₁, y₁)
Best used whenYou know the slope and where the line crosses the y-axisYou know the slope and any point on the line
Ease of graphingVery easy — plot b, then use m to find a second pointEasy — plot the known point, then use m
Converting between themExpand point-slope and solve for yRearrange slope-intercept using any known point

Why It Matters

The equation of a line is one of the most fundamental concepts in algebra and appears constantly in courses from Algebra I through Calculus. You need it to model real-world relationships such as cost versus quantity, distance versus time, and temperature conversions. It also forms the foundation for topics like systems of equations, linear regression, and the tangent-line approximation in calculus.

Common Mistakes

Mistake: Subtracting coordinates in the wrong order when computing slope, such as computing (y₂ − y₁)/(x₁ − x₂) instead of (y₂ − y₁)/(x₂ − x₁).
Correction: Always subtract in the same order: if you use y₂ − y₁ in the numerator, you must use x₂ − x₁ in the denominator. Swapping the order in only one part flips the sign of the slope.
Mistake: Forgetting to distribute the slope to every term inside the parentheses in point-slope form, for example writing y − 3 = 2x − 1 instead of y − 3 = 2(x − 1) = 2x − 2.
Correction: Multiply the slope by each term inside the parentheses. Here 2(x − 1) = 2x − 2, not 2x − 1.

Related Terms