Line From Two Points: Definition, Formula & Example

A line from two distinct points is the unique straight line passing through both coordinate locations. If the points are (x₁, y₁) and (x₂, y₂) with x₁ ≠ x₂, first calculate the slope m = (y₂ − y₁)/(x₂ − x₁). Then substitute either point into point-slope form y − y₁ = m(x − x₁), or convert the result to slope-intercept or standard form. When x₁ = x₂, the line is vertical and its equation is simply x = x₁; its slope is undefined. A horizontal line occurs when y₁ = y₂ and has slope zero. The two-point method is fundamental to coordinate geometry because two distinct points uniquely determine a straight line. It can be used to build equations, verify collinearity, model constant rates of change, calculate intercepts, and prepare equations for line-intersection problems.
How Do You Find a Line From Two Points?
Suppose the two points are:
P₁ = (x₁, y₁)
P₂ = (x₂, y₂)
If:
x₁ ≠ x₂
calculate slope:
m = (y₂ − y₁)/(x₂ − x₁)
Then use Point-Slope Form:
y − y₁ = m(x − x₁)
Either point can be used.
Afterward, the equation can be simplified into the desired form.
Basic Example
Find the line through:
(2, 3)
and:
(6, 11)
First calculate slope:
m = (11 − 3)/(6 − 2)
= 8/4
= 2
Use point:
(2, 3)
Then:
y − 3 = 2(x − 2)
Expand:
y − 3 = 2x − 4
Therefore:
y = 2x − 1
This is the line through both points.
Verify the First Point
For:
y = 2x − 1
substitute:
x = 2
Then:
y = 2(2) − 1
= 3
So:
(2, 3)
lies on the line.
Verify the Second Point
Substitute:
x = 6
Then:
y = 2(6) − 1
= 11
Therefore:
(6, 11)
also lies on the line.
Checking both original points is one of the best ways to catch algebra or sign errors.
Why Two Points Determine a Unique Line
One point alone does not determine a unique line because infinitely many lines can pass through the same point.
A second distinct point fixes the direction.
That direction is represented by slope:
m = Δy/Δx
Therefore two distinct points determine:
a position
and:
a direction
which uniquely specify one straight line.
The only special case is a vertical line, where direction is represented by:
x = constant
rather than a finite slope.
Slope From Two Points
The Slope formula is:
m = (y₂ − y₁)/(x₂ − x₁)
It measures:
vertical change / horizontal change
or:
rise/run
For points:
(1, 4)
and:
(5, 10)
we have:
rise = 10 − 4 = 6
run = 5 − 1 = 4
Therefore:
m = 6/4
= 3/2
Subtraction Order Must Be Consistent
You may calculate:
(y₂ − y₁)/(x₂ − x₁)
or reverse both:
(y₁ − y₂)/(x₁ − x₂)
These give the same slope.
For example:
(11 − 3)/(6 − 2) = 8/4 = 2
and:
(3 − 11)/(2 − 6) = −8/−4 = 2
But mixing subtraction orders produces the wrong sign.
Point-Slope Form
Once slope m is known, use:
y − y₁ = m(x − x₁)
This form directly encodes:
one point
and:
the line’s slope
For the line through:
(3, 5)
with:
m = −2
we get:
y − 5 = −2(x − 3)
This is already a complete line equation.
Using the Second Point Instead
Suppose the line passes through:
(2, 3)
and:
(6, 11)
with:
m = 2
Using the second point:
y − 11 = 2(x − 6)
Expand:
y − 11 = 2x − 12
Therefore:
y = 2x − 1
The same equation results.
Either original point can be used after slope is known.
Slope-Intercept Form
Slope-intercept form is:
y = mx + b
where:
m = slope
b = y-intercept
After calculating m from two points, solve for b using either point.
For:
(2, 3)
and slope:
m = 2
use:
3 = 2(2) + b
So:
3 = 4 + b
Therefore:
b = −1
and:
y = 2x − 1
Direct Formula for the Intercept
If:
m = (y₂ − y₁)/(x₂ − x₁)
then:
b = y₁ − mx₁
So the line can be found through:
y = mx + b
For:
(−2, 5)
and:
(4, −1)
slope:
m = (−1 − 5)/(4 − (−2))
= −6/6
= −1
Then:
b = 5 − (−1)(−2)
= 3
Therefore:
y = −x + 3
Standard Form
A line can also be written:
Ax + By = C
For:
y = 2x − 1
move terms:
2x − y = 1
This is standard form.
Depending on the application, standard form may avoid fractions or make simultaneous line equations easier to compare.
Two-Point Form
For nonvertical lines, an equation can be written directly as:
(y − y₁)/(y₂ − y₁) = (x − x₁)/(x₂ − x₁)
when the denominators are meaningful.
An equivalent cross-multiplied form is:
(y − y₁)(x₂ − x₁) = (x − x₁)(y₂ − y₁)
This form builds the line directly from the two coordinates without first displaying m separately.
Two-Point Form Example
For:
(2, 3)
and:
(6, 11)
write:
(y − 3)(6 − 2) = (x − 2)(11 − 3)
So:
4(y − 3) = 8(x − 2)
Divide by 4:
y − 3 = 2(x − 2)
Therefore:
y = 2x − 1
Vertical Line From Two Points
Suppose:
P₁ = (4, −2)
P₂ = (4, 7)
Then:
x₂ − x₁ = 0
The slope formula would require division by zero, so the slope is undefined.
Both points share:
x = 4
Therefore the line equation is:
x = 4
A vertical line cannot be written as:
y = mx + b
with a finite real m.
Horizontal Line From Two Points
Suppose:
P₁ = (−3, 5)
P₂ = (8, 5)
Then:
y₂ − y₁ = 0
Therefore:
m = 0
The line equation is:
y = 5
Every point on the line has the same y-coordinate.
Positive Slope
If y increases as x increases:
m > 0
For example:
(1, 2)
and:
(5, 10)
give:
m = 8/4 = 2
The line rises from left to right.
Negative Slope
If y decreases as x increases:
m < 0
For:
(1, 8)
and:
(5, 2)
we have:
m = −6/4
= −3/2
The line falls from left to right.
Zero and Undefined Slopes
A horizontal line has:
m = 0
A vertical line has:
undefined slope
These are different cases.
Zero slope means:
Δy = 0
Undefined slope means:
Δx = 0
Confusing these cases can produce an incorrect equation.
Example With Negative Coordinates
Find the line through:
(−3, 4)
and:
(2, −6)
Slope:
m = (−6 − 4)/(2 − (−3))
= −10/5
= −2
Use point-slope form:
y − 4 = −2(x + 3)
Expand:
y − 4 = −2x − 6
Therefore:
y = −2x − 2
Example With Fractional Slope
Find the line through:
(1, 2)
and:
(7, 5)
Slope:
m = (5 − 2)/(7 − 1)
= 3/6
= 1/2
Point-slope form:
y − 2 = (1/2)(x − 1)
Slope-intercept form:
y = x/2 + 3/2
Standard form:
x − 2y = −3
All three equations describe the same line.
Avoiding Fractions With Standard Form
When slope is fractional, standard form can be convenient.
Suppose:
m = 3/5
and the line passes through:
(2, 4)
Point-slope form:
y − 4 = (3/5)(x − 2)
Multiply by 5:
5y − 20 = 3x − 6
Rearrange:
3x − 5y = −14
This avoids fractional coefficients.
A Direct Determinant-Style Equation
A line through two points can also be expressed as:
(y₁ − y₂)x + (x₂ − x₁)y = x₂y₁ − x₁y₂
This form handles nonvertical and vertical lines uniformly.
For:
(2, 3)
and:
(6, 11)
we get:
(3 − 11)x + (6 − 2)y = 6(3) − 2(11)
−8x + 4y = −4
Divide by 4:
−2x + y = −1
Therefore:
y = 2x − 1
Collinear Points
Three or more points are collinear when they lie on the same straight line.
One test is to compare slopes.
For points:
A, B, C
calculate:
m_AB
and:
m_AC
If the slopes are equal, with vertical cases handled appropriately, the three points are collinear.
Alternatively, find the line through A and B and verify that C satisfies its equation.
Collinearity Example
Consider:
A = (1, 3)
B = (3, 7)
C = (5, 11)
Slope AB:
(7 − 3)/(3 − 1) = 2
Slope BC:
(11 − 7)/(5 − 3) = 2
The direction is unchanged.
The line through A and B is:
y − 3 = 2(x − 1)
so:
y = 2x + 1
Substitute C:
11 = 2(5) + 1
Therefore all three points are collinear.
Noncollinear Example
Consider:
A = (0, 0)
B = (2, 4)
C = (4, 9)
Slope AB:
4/2 = 2
Slope AC:
9/4 = 2.25
The slopes differ.
Therefore the three points do not lie on one line.
Line Through Two Points and Distance
The Distance Formula between the two defining points is:
d = √[(x₂ − x₁)² + (y₂ − y₁)²]
Slope and distance use the same coordinate differences.
Slope measures:
direction ratio
Distance measures:
segment length
For:
Δx = 3
Δy = 4
slope is:
4/3
while distance is:
5
Direction Angle of a Line
For a nonvertical line:
m = tan θ
where θ is an inclination angle measured from the positive x-axis.
Therefore:
θ = tan⁻¹m
For:
m = 1
the principal angle is:
45°
For:
m = √3
it is:
60°
The Inverse Trigonometric Functions relationship converts slope into an angular direction.
Direction From Two Points
For points:
(x₁,y₁)
and:
(x₂,y₂)
the displacement components are:
Δx = x₂ − x₁
Δy = y₂ − y₁
A basic angle calculation uses:
tan θ = Δy/Δx
But the signs of both components must be considered to identify the correct quadrant.
Slope alone represents line inclination modulo 180° because reversing direction still traces the same line.
Parallel Lines
Two nonvertical lines are parallel when their slopes are equal:
m₁ = m₂
Suppose the line through:
(1, 2)
and:
(4, 8)
has slope:
m = 6/3 = 2
Any different line with slope 2 is parallel to it.
For example:
y = 2x + 5
is parallel to:
y = 2x
because the slopes match.
Perpendicular Lines
Two nonvertical, nonhorizontal perpendicular lines have slopes satisfying:
m₁m₂ = −1
So if:
m₁ = 2
then a perpendicular slope is:
m₂ = −1/2
A perpendicular line through a specified point can then be written with point-slope form.
Vertical and horizontal lines are also perpendicular to each other.
Perpendicular Line Example
Find a line perpendicular to the line through:
(1, 2)
and:
(5, 10)
and passing through:
(3, 4)
Original slope:
m = 8/4 = 2
Perpendicular slope:
−1/2
Equation:
y − 4 = −(1/2)(x − 3)
This construction uses the two original points only to establish the initial direction.
Line Intersection
Once two line equations have been constructed, their common point can be found with Line Intersection.
For example:
y = 2x − 1
and:
y = −x + 8
At an intersection, both y-values are equal:
2x − 1 = −x + 8
Therefore:
3x = 9
x = 3
Then:
y = 5
The intersection is:
(3, 5)
Constructing each line and finding where they cross are separate coordinate tasks.
Parallel Lines and No Intersection
If two different lines have identical slopes but different intercepts:
y = 2x + 1
and:
y = 2x − 4
they never intersect.
Both rise at the same rate but remain separated.
If the slopes and intercepts are both equal, the equations represent the same line and have infinitely many common points.
Midpoint of the Defining Segment
The Midpoint Formula for two points is:
M = ((x₁ + x₂)/2, (y₁ + y₂)/2)
The midpoint must lie on the line through the two points.
For:
(2, 3)
and:
(6, 11)
the midpoint is:
(4, 7)
Check:
y = 2(4) − 1
= 7
Therefore the midpoint lies on the same line, as expected.
Segment Versus Infinite Line
Two given points determine:
a segment between the points
and:
an infinite line extending through them
The distance formula measures the finite segment.
The line equation describes infinitely many points extending in both directions.
The distinction matters in geometric interpretation.
Line Through Diameter Endpoints
Suppose two points are endpoints of a circle diameter.
The line through them passes through the circle center.
For endpoints:
A = (−2, 1)
B = (6, 7)
the midpoint is:
M = (2, 4)
which is the center.
The line through A and B has slope:
m = 6/8 = 3/4
Its equation can be written:
y − 1 = (3/4)(x + 2)
This combines line construction with circle geometry.
Line and Circle Intersection
A line equation may later be substituted into a Circle Equation.
Depending on the resulting quadratic equation, the line may meet the circle at:
zero points
one point
or:
two points
These correspond to:
exterior line
tangent
secant
The two-point line formula constructs the line; the circle equation determines how that line relates to the circle.
Chord Line
If the two known points lie on the same circle, the segment between them is a Chord Length.
The line through those endpoints is a secant unless the two points coincide.
For endpoints:
A
and:
B
the line equation describes the entire secant line, while:
distance(A,B)
gives the chord itself.
These are distinct geometric quantities.
Line Through Triangle Vertices
Triangle sides are line segments joining pairs of vertices.
For triangle vertices:
A, B, C
the line through A and B can be constructed from those coordinates.
The line through A and C can be constructed similarly.
Their slopes or vectors can then help determine the angle at A.
The Law of Cosines provides another route when the three side lengths are known.
Line Geometry and the Law of Sines
A triangle formed by line intersections and known points may eventually provide an opposite side-angle pair.
At that stage, the Law of Sines can solve remaining triangle measurements:
a/sin A = b/sin B = c/sin C
The line equation establishes the geometric boundaries; the triangle law handles side-angle relationships inside them.
Kite Diagonals as Lines
A Kite Area defined by coordinate vertices has two diagonals.
Each diagonal can be represented by a line through two opposite vertices.
If the expected kite structure holds, those diagonal lines are perpendicular.
Their intersection can identify the internal crossing point, while the distances between opposite vertices give:
d₁
and:
d₂
for:
A = d₁d₂/2
Equation From an x-Intercept and y-Intercept
Suppose the two known points are intercepts:
(a, 0)
and:
(0, b)
The line can be written in intercept form:
x/a + y/b = 1
For:
(6, 0)
and:
(0, 3)
we obtain:
x/6 + y/3 = 1
Multiply by 6:
x + 2y = 6
Therefore:
y = −x/2 + 3
Finding the x-Intercept
For a nonhorizontal line:
y = mx + b
set:
y = 0
Then:
0 = mx + b
so:
x = −b/m
provided:
m ≠ 0
For:
y = 2x − 6
the x-intercept is:
x = 3
Therefore the intercept point is:
(3, 0)
Finding the y-Intercept
Set:
x = 0
in:
y = mx + b
Then:
y = b
Therefore the y-intercept is:
(0, b)
For:
y = −3x + 7
the y-intercept is:
(0, 7)
This is why b is called the y-intercept in slope-intercept form.
Modeling Constant Rate of Change
A line through two measured points often represents a constant rate.
Suppose a quantity has values:
20 at x = 2
and:
50 at x = 8
Slope:
m = (50 − 20)/(8 − 2)
= 30/6
= 5
The model is:
y − 20 = 5(x − 2)
Therefore:
y = 5x + 10
The slope 5 represents the constant change in y for each one-unit increase in x.
Interpolation
Once the line through two data points is known, values between them can be estimated under a linear assumption.
Using:
y = 5x + 10
at:
x = 5
we get:
y = 35
Because x = 5 lies between the original x-values 2 and 8, this is linear interpolation.
The validity of the estimate depends on whether a linear relationship is appropriate for the underlying situation.
Extrapolation
Using the same line outside the original x-range is extrapolation.
For:
x = 12
the model gives:
y = 70
Mathematically this point lies on the same line.
Whether the prediction is meaningful depends on whether the real relationship continues linearly beyond the observed interval.
The geometry of the line itself imposes no such practical guarantee.
Distance From a Point to a Line
Once a line has been written in standard form:
Ax + By + C = 0
the perpendicular distance from point:
(x₀,y₀)
to the line is:
d = |Ax₀ + By₀ + C|/√(A² + B²)
This is a different distance problem from finding the distance between the two original points.
Constructing standard form first can therefore support later geometric calculations.
Example of Standard Form
The line through:
(2, 3)
and:
(6, 11)
was:
y = 2x − 1
Write:
2x − y − 1 = 0
Therefore:
A = 2
B = −1
C = −1
This form can be used in point-to-line distance, intersections, or perpendicular constructions.
General Line Through Two Points Without Division
A robust formula through:
(x₁,y₁)
and:
(x₂,y₂)
is:
(y₁ − y₂)x + (x₂ − x₁)y + (x₁y₂ − x₂y₁) = 0
This remains valid for vertical lines because it does not divide by:
x₂ − x₁
For two distinct points, the coefficients cannot all vanish simultaneously.
Vertical-Line Check With the General Formula
Take:
(4, −2)
and:
(4, 7)
Then:
(−2 − 7)x + (4 − 4)y + [4(7) − 4(−2)] = 0
So:
−9x + 36 = 0
Therefore:
x = 4
The formula naturally handles the vertical case.
Scaling a Direction Vector
The line through two points has direction vector:
v = (x₂ − x₁, y₂ − y₁)
Any nonzero scalar multiple:
kv
points along the same line.
For:
v = (2, 4)
the vector:
(1, 2)
has the same direction.
This is why simplifying rise/run does not change slope.
Parametric Form
Using point:
(x₁,y₁)
and direction:
(Δx,Δy)
a line can be represented parametrically:
x = x₁ + tΔx
y = y₁ + tΔy
where t is any real number.
For points:
(2, 3)
and:
(6, 11)
the direction is:
(4, 8)
so:
x = 2 + 4t
y = 3 + 8t
At:
t = 0
we get the first point.
At:
t = 1
we get the second.
Parametric Form of a Vertical Line
For:
(4, −2)
and:
(4, 7)
the direction vector is:
(0, 9)
Therefore:
x = 4
y = −2 + 9t
This shows that vertical lines are perfectly ordinary in vector or parametric form even though slope-intercept form cannot represent them.
Common Line From Two Points Mistakes
A common mistake is reversing only one subtraction in the slope formula.
Use a consistent order:
(y₂ − y₁)/(x₂ − x₁)
Another error is dividing by zero when:
x₁ = x₂
In that case, write:
x = constant
Do not call a horizontal line’s slope undefined; its slope is zero.
When converting point-slope form, distribute the slope through parentheses carefully.
Always verify the final equation with both original points.
If a fractional slope appears, it is not automatically an error.
Finally, remember that the equation describes the entire infinite line, while the two original points define only two locations on it.
Frequently Asked Questions
What is the formula for a line from two points?
First calculate:
m = (y₂ − y₁)/(x₂ − x₁)
Then use:
y − y₁ = m(x − x₁)
when x₁ ≠ x₂.
What if the x-coordinates are equal?
The line is vertical:
x = x₁
and its slope is undefined.
What if the y-coordinates are equal?
The line is horizontal:
y = y₁
and:
m = 0
Can either point be used in point-slope form?
Yes. Both produce the same line when the slope is calculated correctly.
How do you convert to slope-intercept form?
Expand:
y − y₁ = m(x − x₁)
and isolate y to obtain:
y = mx + b
How do you find b?
b = y₁ − mx₁
using either point.
How do you check the equation?
Substitute both original coordinate pairs. Both must satisfy the equation.
Do two distinct points always determine one line?
Yes.
How can you test whether three points are collinear?
Find the line through two points and verify the third point satisfies it, or compare their slopes.
How is slope related to the two points?
m = Δy/Δx
It describes the line’s constant vertical change per unit horizontal change.
How is distance different from slope?
Distance measures the length between the points; slope measures the line’s direction.
How do you find where two lines meet?
Construct both equations, then solve them simultaneously using the line-intersection method.
What is the general equation that also handles vertical lines?
(y₁ − y₂)x + (x₂ − x₁)y + (x₁y₂ − x₂y₁) = 0
How can I avoid sign errors?
Keep point order consistent in both coordinate differences, use parentheses around negative coordinates, and verify the finished equation with both original points.



