Equation of a Line: All Forms Formulas and Examples

#Equation of a Line
TL;DR
The equation of a line is a rule in x and y that every point on the line satisfies and no other point does. It has six standard forms, and all of them grow from one fact: a line has a single slope.
Ashra SiddiquiΒ·reviewed byShikha SharmaLast updated on December 2, 202614 min read

Key Points

  • Slope-intercept: y=mx+by = mx + b. Point-slope: yβˆ’y1=m(xβˆ’x1)y - y_1 = m(x - x_1). Two-point: the same, with m=y2βˆ’y1x2βˆ’x1m = \frac{y_2 - y_1}{x_2 - x_1}.
  • Intercept: xa+yb=1\frac{x}{a} + \frac{y}{b} = 1. Normal: xcos⁑θ+ysin⁑θ=px\cos\theta + y\sin\theta = p. General: Ax+By+C=0Ax + By + C = 0.
  • Two facts fix a line: a slope and a point, two points, or two intercepts.
  • Only the general form covers vertical lines x=hx = h, which have no slope.

Why One Line Has So Many Equations

Every straight line on a graph can be written several ways, and each one hides a clue. Take the line through (0, 3) and (4, 0):

  • Know its steepness? Write y=βˆ’34x+3y = -\frac{3}{4}x + 3.
  • Know where it cuts the axes? Write x4+y3=1\frac{x}{4} + \frac{y}{3} = 1.
  • Solving a system? Write 3x+4y=123x + 4y = 12.

All three describe the same line. Picking the form that matches what you know is half the work; knowing why each is true takes one idea.

one line with its slope, y-intercept and x-intercept, the ingredients of every form of the equation of a line
A grid with the blue line through (0, 3) and (4, 0), its y-intercept and x-intercept marked in purple, and a slope step of run 4 and rise βˆ’3, giving slope βˆ’3/4.

What Is the Equation of a Line?

The equation of a line is a relationship between xx and yy that is true for every point on the line and false for every point off it. On y=2x+1y = 2x + 1, the point (3, 7) works (7=2(3)+17 = 2(3) + 1) and (3, 6) does not.

Two ingredients describe any line:

  • Its slope mm, how steep it is: rise over run, m=y2βˆ’y1x2βˆ’x1m = \dfrac{y_2 - y_1}{x_2 - x_1}. See slope.
  • Its position, given by any one point on it.

Every form packages those two facts differently, inside coordinate geometry.

What Are the Different Forms of the Equation of a Line?

There are six forms worth knowing. Each is exact; they differ in which information they show.

Form Equation Use it when you know
Slope-intercept y=mx+by = mx + b the slope and the y-intercept
Point-slope yβˆ’y1=m(xβˆ’x1)y - y_1 = m(x - x_1) the slope and one point
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
Intercept xa+yb=1\frac{x}{a} + \frac{y}{b} = 1 both intercepts, aa on the x-axis and bb on the y-axis
Normal xcos⁑θ+ysin⁑θ=px\cos\theta + y\sin\theta = p the distance pp from the origin and the direction θ\theta of that perpendicular
General Ax+By+C=0Ax + By + C = 0 any line, including vertical ones
the slope-intercept, point-slope, two-point and intercept forms each start from different information about the same line
Four panels showing the same line pinned down four ways: slope βˆ’3/4 with the y-intercept (0, 3); slope βˆ’3/4 with the point (1, 9/4); the two points (0, 3) and (4, 0); and the intercepts a = 4 and b = 3, each with its form underneath.

Slope-intercept form

y=mx+by = mx + b

mm is the slope and bb the y-intercept, where the line crosses the y-axis. It graphs fastest and suits "starting value plus rate" stories. See the slope-intercept form of a line.

Point-slope form

yβˆ’y1=m(xβˆ’x1)y - y_1 = m(x - x_1)

Use it when you know the slope and one point (x1,y1)(x_1, y_1). Full steps: point-slope form.

Two-point form

yβˆ’y1=y2βˆ’y1x2βˆ’x1(xβˆ’x1)y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}(x - x_1)

Given two points, it finds the slope and writes the line in one move. See the two-point form.

Intercept form

xa+yb=1\frac{x}{a} + \frac{y}{b} = 1
  • aa is the x-intercept and bb the y-intercept: mark both crossings and join them.
  • It cannot describe a line through the origin, or one parallel to an axis.
  • See the intercept form.

General form

Ax+By+C=0Ax + By + C = 0
  • Every line fits, with AA and BB not both zero.
  • Two lines are parallel when their AA and BB are in the same ratio.
  • It is the equation of a straight line in standard notation.

Normal form

xcos⁑θ+ysin⁑θ=px\cos\theta + y\sin\theta = p

Drop a perpendicular from the origin to the line. It has length pp (always positive) and makes angle ΞΈ\theta with the x-axis.

  • From Ax+By+C=0Ax + By + C = 0, divide by A2+B2\sqrt{A^2 + B^2}, with the sign that makes pp positive.
  • For 3x+4y=123x + 4y = 12, divide by 5: p=2.4p = 2.4 and cos⁑θ=35\cos\theta = \frac{3}{5}, so ΞΈβ‰ˆ53.1Β°\theta \approx 53.1Β°.
  • It explains the A2+B2\sqrt{A^2 + B^2} in the distance between two parallel lines.
the normal form describes the line by the distance p from the origin and the angle ΞΈ of the perpendicular
The line 3x + 4y = 12 with a green perpendicular from the origin O of length p = 2.4, meeting the line at a right angle, and the angle ΞΈ β‰ˆ 53.1Β° marked between that perpendicular and the x-axis.

What about horizontal and vertical lines?

  • A horizontal line through (h,k)(h, k) has slope 0: y=ky = k.
  • A vertical line has run 0, so no slope: x=hx = h.
  • A vertical line cannot be y=mx+by = mx + b, which is why the general form (with B=0B = 0) exists.
a horizontal line has slope 0 and equation y = βˆ’2, while a vertical line has no slope and equation x = 4
A grid with the blue horizontal line y = βˆ’2 and the orange vertical line x = 4 crossing at (4, βˆ’2), with points marked on each and run = 0 noted on the vertical line.

In the coordinate lab, each line runs through two handles you can drag.

  • The blue line starts through (βˆ’4, βˆ’1) and (4, 3): slope 12\frac{1}{2}, so y=12x+1y = \frac{1}{2}x + 1.
  • "Coincident" uses four different handles, yet both lines are y=12xβˆ’12y = \frac{1}{2}x - \frac{1}{2}.
  • "Perpendicular" shows slopes 12\frac{1}{2} and βˆ’2-2, which multiply to βˆ’1-1.

Try It Yourself

Use the coordinate lab to see Equation of a Line at work: drag, change the numbers and watch what happens.

How Is the Equation of a Line Derived?

Each form comes straight from the fact that a line has one slope.

The core idea: similar triangles

  • Draw a run-and-rise triangle between two points on a line, then another between two other points.
  • The triangles have the same angles, so they are similar triangles with sides in the same ratio.
  • So rise Γ· run is the same for any two points: the slope is one number.
two different slope triangles on the same line give the same slope, 2/3
The line y = 2/3x + 1 on a grid with a small orange triangle of run 3 and rise 2 and a larger green triangle of run 6 and rise 4, both giving 2/3.

Point-slope form

  1. Fix a point (x1,y1)(x_1, y_1) and let (x,y)(x, y) be any other point on the line.
  2. Their slope is mm: yβˆ’y1xβˆ’x1=m\dfrac{y - y_1}{x - x_1} = m.
  3. Multiply by (xβˆ’x1)(x - x_1): yβˆ’y1=m(xβˆ’x1)y - y_1 = m(x - x_1).

A point off the line gives a different slope, so it fails the equation.

Slope-intercept and two-point forms

  • Use the y-intercept (0,b)(0, b) as the point: yβˆ’b=m(xβˆ’0)y - b = m(x - 0), so y=mx+by = mx + b.
  • Replace mm with y2βˆ’y1x2βˆ’x1\frac{y_2 - y_1}{x_2 - x_1} to get the two-point form.
  • Clearing fractions gives the general form; dividing by Β±A2+B2\pm\sqrt{A^2 + B^2} gives the normal form.

A second view: start at a point and step along

Start at (x1,y1)(x_1, y_1) and take tt steps, each one across and mm up, to reach (x1+t,Β y1+mt)(x_1 + t,\ y_1 + mt). With t=xβˆ’x1t = x - x_1, that is y=y1+m(xβˆ’x1)y = y_1 + m(x - x_1) again. This "point plus steps" idea is how lines are written with vectors in 3D.

And the converse

Every Ax+By+C=0Ax + By + C = 0 with AA, BB not both zero is a line.

  • If Bβ‰ 0B \ne 0: y=βˆ’ABxβˆ’CBy = -\frac{A}{B}x - \frac{C}{B}, slope-intercept form.
  • If B=0B = 0: x=βˆ’CAx = -\frac{C}{A}, a vertical line.
  • Fermat linked first-degree equations and straight lines in the 1630s, as Descartes published La GΓ©omΓ©trie (1637).

Examples of the Equation of a Line

Example 1

Find the equation of the line through (βˆ’3, 5) and (2, 8).

  1. Slope: 8βˆ’52βˆ’(βˆ’3)=35\frac{8 - 5}{2 - (-3)} = \frac{3}{5}.
  2. Trap: yβˆ’5=35(xβˆ’3)y - 5 = \frac{3}{5}(x - 3) drops a sign. At x=βˆ’3x = -3 it gives 1.4, not 5.
  3. Correct: xβˆ’(βˆ’3)=x+3x - (-3) = x + 3, so yβˆ’5=35(x+3)y - 5 = \frac{3}{5}(x + 3).
  4. Simplify: y=35x+345y = \frac{3}{5}x + \frac{34}{5}. Check (2, 8): 65+345=8\frac{6}{5} + \frac{34}{5} = 8.

Final answer: y=35x+345y = \frac{3}{5}x + \frac{34}{5}.

dropping the minus sign in point-slope form shifts the line so it misses the point (βˆ’3, 5) by 18/5
A grid with the points (βˆ’3, 5) and (2, 8) on the green line y = 3/5x + 34/5, and a dashed orange parallel line, labelled dropped sign, that passes 18/5 below (βˆ’3, 5).

Example 2

Write y=35x+345y = \frac{3}{5}x + \frac{34}{5} in general form.

  1. Multiply by 5: 5y=3x+345y = 3x + 34.
  2. Move all terms to one side. Check (βˆ’3, 5): βˆ’9βˆ’25+34=0-9 - 25 + 34 = 0.

Final answer: 3xβˆ’5y+34=03x - 5y + 34 = 0.

Example 3

Write 3x + 4y = 12 in intercept form and normal form.

  1. Divide by 12: x4+y3=1\frac{x}{4} + \frac{y}{3} = 1, so the intercepts are 4 and 3.
  2. Divide by 9+16=5\sqrt{9 + 16} = 5: 35x+45y=125\frac{3}{5}x + \frac{4}{5}y = \frac{12}{5}.

Final answer: intercept form x4+y3=1\frac{x}{4} + \frac{y}{3} = 1; normal form with p=2.4p = 2.4, cos⁑θ=35\cos\theta = \frac{3}{5}, sin⁑θ=45\sin\theta = \frac{4}{5}.

Example 4

Write the horizontal line through (7, βˆ’2) and the vertical line through (4, βˆ’2).

  1. Horizontal keeps yy fixed, with slope 0.
  2. Vertical keeps xx fixed, with no slope.

Final answer: y=βˆ’2y = -2 and x=4x = 4.

Example 5

Find the line through (1, 2) perpendicular to 3x + 4y = 12.

  1. The given slope is βˆ’34-\frac{3}{4}; perpendicular slopes multiply to βˆ’1-1, so use 43\frac{4}{3}.
  2. yβˆ’2=43(xβˆ’1)y - 2 = \frac{4}{3}(x - 1), so 3yβˆ’6=4xβˆ’43y - 6 = 4x - 4.
  3. Check (1, 2): 4βˆ’6+2=04 - 6 + 2 = 0.

Final answer: 4xβˆ’3y+2=04x - 3y + 2 = 0.

Example 6

A taxi charges a 3 dollar base fare plus 2 dollars per kilometre. Write the fare yy for distance xx.

  1. The base fare is the intercept; the rate is the slope.
  2. At 5 km: 2(5)+3=132(5) + 3 = 13 dollars.

Final answer: y=2x+3y = 2x + 3.

What Are the Most Common Mistakes With the Equation of a Line?

Mistake 1: Losing a sign in point-slope form

Where it slips in: A point with a negative coordinate, simplified in your head too early.

Don't do this: Write yβˆ’5=35(xβˆ’3)y - 5 = \frac{3}{5}(x - 3) for the point (βˆ’3,5)(-3, 5).

The correct way: Write xβˆ’(βˆ’3)x - (-3) in brackets first, then simplify to x+3x + 3. Check both points at the end.

Mistake 2: Mixing the order in the slope

Where it slips in: Computing mm from two points.

Don't do this: Write y2βˆ’y1x1βˆ’x2\frac{y_2 - y_1}{x_1 - x_2}, which flips the sign.

The correct way: Subtract in the same order on top and bottom. Write the two points one above the other first.

Mistake 3: Forcing a vertical line into y = mx + b

Where it slips in: Two points with the same x-coordinate, such as (4, 1) and (4, βˆ’3).

Don't do this: Divide by a run of 0 and hunt for bb.

The correct way: Equal x-coordinates mean a vertical line: x=4x = 4, or xβˆ’4=0x - 4 = 0 in general form.

Why Do We Need So Many Forms of a Line?

Now that the forms, their proofs and the usual traps are clear, the question is why we keep six. Each form answers a different starting question in the fewest steps.

  • Slope-intercept: graphing, and "rate plus starting value" stories like fares and wages.
  • Point-slope: a slope at one point, such as a tangent line in calculus.
  • Two-point: turning two known locations into a path, as in mapping.
  • Intercept: a quick sketch from the axis crossings.
  • Normal: problems about distance from the origin, since pp is that distance.
  • General: solving systems, and the only form that covers every line.

Where the Equation of a Line Does Real Work

  • Unit conversions: F=95C+32F = \frac{9}{5}C + 32. Each degree Celsius is 1.8 Β°F, and the scales meet at βˆ’40-40.
  • Prices and plans: a fixed charge plus a rate, like the taxi in Example 6.
  • Physics: at constant speed, distance against time is a line whose slope is the speed.
  • Graphics and mapping: the sign of Ax+By+CAx + By + C tells which side of a line a point is on.
converting Celsius to Fahrenheit follows a straight line with slope 9/5 and intercept 32
A graph of F = 9/5 C + 32 with points for water freezing at (0, 32), body temperature at (37, 98.6), water boiling at (100, 212) and the crossing point (βˆ’40, βˆ’40).

Conclusion

The equation of a line relates xx and yy so that every point on the line fits it and no other point does.

  • Every form comes from one fact: a line has one slope, because its slope triangles are similar.
  • Choose the form that matches what you know, then convert if asked.
  • Vertical lines (x=hx = h) need the general form; lines through the origin have no intercept form.
  • Watch for sign slips and mismatched subtraction, and check the final equation with the given points.

Practice These to Solidify Your Understanding

  1. Write the line through (1, 2) and (4, 11) in slope-intercept form.
  2. Write 2xβˆ’3y=62x - 3y = 6 in intercept form.
  3. Give the line through (βˆ’5, 9) and (βˆ’5, 1).

Answers:

  1. Slope 11βˆ’24βˆ’1=3\frac{11 - 2}{4 - 1} = 3, so y=3xβˆ’1y = 3x - 1.
  2. Divide by 6: x3+yβˆ’2=1\frac{x}{3} + \frac{y}{-2} = 1, intercepts 3 and βˆ’2.
  3. x=βˆ’5x = -5, a vertical line.

A slope of βˆ’3 in question 1? Recheck Mistake 2.

To master lines with a teacher, explore Bhanzu's geometry tutor, a high school math tutor, or math classes online.

Want a live Bhanzu trainer to walk your child through lines and their equations? Book a free demo class, online globally, or in person at our McKinney, TX center.

Read More

Research Behind This Article

  1. OpenStax, Precalculus 2e, Section 2.1: Linear Functions (slope, slope-intercept and point-slope forms). openstax.org
  2. OpenStax, Precalculus 2e, Section 2.2: Graphs of Linear Functions (horizontal, vertical, parallel and perpendicular lines). openstax.org
  3. J. J. O'Connor and E. F. Robertson, Pierre de Fermat, MacTutor History of Mathematics, University of St Andrews. mathshistory.st-andrews.ac.uk
  4. J. J. O'Connor and E. F. Robertson, RenΓ© Descartes, MacTutor History of Mathematics, University of St Andrews. mathshistory.st-andrews.ac.uk

Quick Quiz: Check Yourself

Three levels, questions with figures, instant feedback with the reason.

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the most common form of the equation of a line?
Slope-intercept form, y=mx+by = mx + b. You can read the slope and y-intercept straight off it.
Can every line be written as y = mx + b?
No. Vertical lines have no slope, so they are written x=hx = h, or in general form.
How do you convert slope-intercept form to general form?
Move every term to one side and clear fractions, as in Example 2.
What is the difference between standard form and general form?
General form is Ax+By+C=0Ax + By + C = 0; standard form is usually Ax+By=CAx + By = C. Both describe the same line.
How many points do you need to find the equation of a line?
Two different points, or one point and the slope.
Which form should I use with two points?
The two-point form: find the slope, then use point-slope form with either point, as in Example 1.
✍️ Written By
Ashra Siddiqui
Ashra Siddiqui
Subject Matter Expert
Ashra Siddiqui is a Subject Matter Expert on Bhanzu's Learning Experience team with over 10 years of experience teaching mathematics at the primary and middle school levels. She follows a student-centred, differentiated approach, recognizing that every child learns differently, and connects concepts to real-life examples. She has also trained students for competitive exams and Olympiads.
LinkedIn
πŸ”¬ Reviewed By
Shikha Sharma
Subject Matter Expert
Related Articles
Book a FREE Demo ClassBook Now β†’