how to find the equation of a line
To find the equation of a line, you really just need two ingredients: its slope and one point on the line.
How to Find the Equation of a Line
(Quick Scoop guide with examples)
1. The core idea (slope + point)
The most common way to write a line is the slope–intercept form:
y=mx+by=mx+by=mx+b
where mmm is the slope and bbb is the yyy-intercept.
If you know a slope mmm and a point (x1,y1)(x_1,y_1)(x1,y1), a more flexible starting formula is the point-slope form :
y−y1=m(x−x1)y-y_1=m(x-x_1)y−y1=m(x−x1)
You can always rearrange this into y=mx+by=mx+by=mx+b later if you want.
2. Step‑by‑step: from two points
Imagine you’re handed two points and asked for the line that goes through both. This is one of the most common problems.
Step 1: Find the slope
For points (x1,y1)(x_1,y_1)(x1,y1) and (x2,y2)(x_2,y_2)(x2,y2), the slope is
m=y2−y1x2−x1m=\frac{y_2-y_1}{x_2-x_1}m=x2−x1y2−y1
This measures how much yyy changes when xxx increases by 1.
Step 2: Plug into point-slope form
Take either point (your choice) and plug into
y−y1=m(x−x1)y-y_1=m(x-x_1)y−y1=m(x−x1)
This already is an equation of your line.
Step 3: Simplify to slope‑intercept (optional)
Expand and solve for yyy to get y=mx+by=mx+by=mx+b. Many textbooks and online lessons prefer this final form because it makes the slope and intercept easy to see.
Quick mental image: the slope tells you how steep your “hill” is, and the intercept tells you where that hill crosses the vertical yyy-axis.
3. Example: finding the line through two points
Say the line passes through (1,2)(1,2)(1,2) and (3,6)(3,6)(3,6).
- Slope :
m=6−23−1=42=2m=\frac{6-2}{3-1}=\frac{4}{2}=2m=3−16−2=24=2
- Point-slope form using (1,2)(1,2)(1,2):
y−2=2(x−1)y-2=2(x-1)y−2=2(x−1)
- Simplify :
y−2=2x−2y-2=2x-2y−2=2x−2
y=2xy=2xy=2x
So the equation of the line is y=2xy=2xy=2x.
4. Other common situations
There are a few “special cases” where the equation is even quicker to spot.
If you know slope and one point
Use point-slope form directly:
- Given slope mmm and point (x1,y1)(x_1,y_1)(x1,y1):
y−y1=m(x−x1)y-y_1=m(x-x_1)y−y1=m(x−x1)
Then simplify if you want it as y=mx+by=mx+by=mx+b.
Mini‑example : slope m=−12m=-\frac{1}{2}m=−21, point (4,5)(4,5)(4,5).
y-5=-\frac{1}{2}(x-4) \Rightarrowy-5=-\frac{1}{2}x+2 \Rightarrowy=-\frac{1}{2}x+7
So the equation is y=-\frac{1}{2}x+7.
If you know the graph
From a graph, you usually:
- Pick two clear points.
- Compute the slope using the same fraction formula.
- Use either point in point-slope form.
Horizontal and vertical lines
Sometimes the slope idea breaks down or simplifies a lot.
- Horizontal line through (a,b):
The y value is always b, so the equation is simply
y=b
- Vertical line through (a,b):
The x value is always a, so the equation is
x=a
This line doesn’t have a finite slope (it’s “undefined”), so you do not use y=mx+b here.
5. Different “styles” of the same line
The same geometric line can be written in more than one algebraic form.
Here are the main ones you’ll see:
| Form | Equation shape | When it’s useful |
|---|---|---|
| Slope–intercept | $$y = mx + b$$ | Fast reading of slope and y‑intercept. | [9][3]
| Point–slope | $$y - y_1 = m(x - x_1)$$ | Best when you know slope and a point. | [7][3]
| Standard/general | $$ax + by = c$$ | Nice for solving systems and integer coefficients. | [3][7]
| Horizontal | $$y = b$$ | Flat lines; slope 0. | [7][3]
| Vertical | $$x = a$$ | Vertical lines; slope undefined. | [3][7]
6. Quick “forum-style” recap
If you’re stuck on “how to find the equation of a line,” think:
- Find the slope (if possible),
- Use point-slope form ,
- Rearrange to whatever final form your teacher or exam wants.
In recent online discussions and tutorials, the point-slope formula is often recommended as the simplest, most systematic way: it works the same whether you’re given two points, a slope and a point, or a graph you can read from.
TL;DR :
- Use m=\frac{y_2-y_1}{x_2-x_1} to get slope.
- Plug into y-y_1=m(x-x_1).
- Simplify to y=mx+b if needed, and remember y=b for horizontal and x=a for vertical lines.
Information gathered from public forums or data available on the internet and portrayed here.