Subscribe Latest articles
Ireland Daily Report
Ireland Press

Equation of a Line: Formula, Examples, and Step-by-Step Guide

Jack Cooper Davies • 2026-08-06 • Reviewed by Hanna Berg

Anyone who has plotted points on a graph knows that a straight line tells a simple story. But capturing that story in an equation — a single algebraic expression — is a skill that unlocks everything from predicting trends to solving real-world problems.

Standard form: y = mx + c (or y = mx + b in the US) ·
Gradient definition: m = (y2 – y1) / (x2 – x1) ·
Y-intercept definition: c (where the line crosses the y-axis) ·
Point-slope form: y – y1 = m(x – x1) ·
General form: Ax + By = C

Quick snapshot

1What is it?
2How to Find It
  • From a graph: read the gradient and y-intercept directly. BYU-Idaho
  • From two points: calculate the slope, then use point-slope form. BYJU’S
  • From a point and slope: plug into y – y1 = m(x – x1). Vedantu
3Examples and Practice
4Key Formulas
  • Slope: m = (y2 – y1) / (x2 – x1) BYU-Idaho
  • Point-slope: y – y1 = m(x – x1) BYJU’S
  • Two-point form: (y – y1) / (x – x1) = (y2 – y1) / (x2 – x1) BYJU’S

Four key facts, one pattern: the core formula y = mx + c is the backbone, but the method to derive it changes depending on what you start with.

Label Value
Core formula y = mx + c (slope-intercept form)
Slope (gradient) m, represents the steepness and direction of the line.
Y-intercept c, is the y-coordinate where the line intersects the y-axis.
General linear equation Ax + By = C, where A, B, C are constants.

What is the basic equation of a line?

At its simplest, the equation of a straight line in slope-intercept form is y = mx + c (or y = mx + b in the US). This compact expression packs two pieces of information: the line’s steepness (m) and where it crosses the y-axis (c). Lumen Learning defines the slope-intercept form as the standard way to write a linear equation.

The slope-intercept form (y = mx + c)

  • The variable m is the slope, or gradient — it tells you how much y changes for each unit increase in x.
  • The variable c (or b) is the y-intercept — the y-coordinate where the line crosses the vertical axis.
  • This form is the most widely used because it directly reveals the line’s behavior.

The implication: once you know m and c, you can sketch the entire line in seconds.

The meaning of m and c in the equation

  • A positive m means the line rises as x increases; a negative m means it falls.
  • The y-intercept c is the point (0, c) — the value of y when x is zero.
  • For example, in y = 2x + 3, the slope is 2 and the line crosses the y-axis at 3.

Why this matters: these two numbers alone define the line’s identity. Math is Fun explains that the slope and intercept are the fundamental parameters of any straight line.

The upshot

The slope-intercept form is the most intuitive way to visualize a line: a starting point (the y-intercept) and a direction (the slope). For anyone learning algebra, this is the formula to remember first.

The implication: mastering slope-intercept form is the foundation for all other linear equation methods.

How do you find the equation of a line?

Finding the equation from a graph is a two-step process: read the slope and read the intercept. Here’s how to do it systematically.

Finding the gradient (m)

  • Pick two distinct points on the line, preferably where the line crosses grid lines.
  • Calculate the rise (vertical change) and run (horizontal change).
  • The slope m = rise / run = (y2 – y1) / (x2 – x1).

BYU-Idaho Math resource emphasizes that the slope formula works for any two points on a non-vertical line.

Finding the y-intercept (c)

  • Locate the point where the line crosses the y-axis — that’s the y-intercept.
  • If the line crosses at (0, 3), then c = 3.
  • If the intercept isn’t obvious, you can solve for it after finding the slope.

The catch: if the graph doesn’t show the y-axis crossing clearly, you’ll need to use the point-slope method instead.

Assembling the equation

  • Once you have m and c, plug them into y = mx + c.
  • For example, slope 2 and y-intercept 3 gives y = 2x + 3.
  • Verify by checking that a third point on the graph satisfies the equation.

The pattern: this method is the fastest when you have a clear graph, but it assumes the y-intercept is visible or easily calculable.

The trade-off

Using a graph works great when the intercept is an integer. But if the line crosses the y-axis at a fraction or decimal, the two-point method (next section) is more reliable.

The implication: always verify by checking a second point or using an alternative method.

How do you find the equation of a line with two given points?

This is the most common classroom problem: given two coordinate points, derive the equation of the line that passes through them. The method is a three-step process.

  1. Calculate the slope using the two points.
    • Use the formula m = (y2 – y1) / (x2 – x1).
    • Example: points (1,1) and (2,3): m = (3 – 1) / (2 – 1) = 2/1 = 2.
    • If the x-coordinates are equal, the line is vertical and the slope is undefined — a special case.

    Lumen Learning outlines this as the first step in writing equations from two points.

  2. Substitute a point and the slope into the point-slope form.
    • Point-slope form: y – y1 = m(x – x1).
    • Pick either of the two points (say (1,1)) and plug in: y – 1 = 2(x – 1).
    • This form is useful because it directly captures the slope and a specific point.

    BYJU’S shows that the two-point form is derived from point-slope form by substituting the slope formula.

  3. Simplify to get the final equation.
    • Simplify y – 1 = 2(x – 1) → y – 1 = 2x – 2 → y = 2x – 1.
    • The result is the slope-intercept form y = mx + c.
    • Check: does (2,3) satisfy y = 2x – 1? 3 = 2(2) – 1 = 3, yes.

    The implication: this method works for any two distinct points, as long as the line is not vertical. University of Connecticut notes confirm that two points determine exactly one straight line.

Bottom line: Given two points, the slope comes first, then the point-slope form, then simplification. The result is always a unique linear equation. For students: master this three-step sequence and you can handle any two-point problem.

The catch: always verify by substituting the second point into the final equation.

What is the equation of lines?

While “the equation of a line” usually refers to a single straight line, the broader concept includes all linear equations in two variables — each one graphs as a line. Understanding the different forms helps you pick the right tool.

Different forms of a line’s equation

  • Slope-intercept: y = mx + c — best for quick graphing.
  • Point-slope: y – y1 = m(x – x1) — ideal when you know a point and the slope.
  • General form: Ax + By = C — useful for systems and standard algebra.
  • Two-point form: (y – y1)/(x – x1) = (y2 – y1)/(x2 – x1) — derived from point-slope.

BYU-Idaho teaches that each form has its own use case, but they all represent the same line.

What is a linear equation in two variables?

  • Any equation of the form Ax + By = C, where A and B are not both zero.
  • Every solution (x, y) is a point on the line.
  • If A=0, the line is horizontal; if B=0, the line is vertical.

The pattern: the general form is the most flexible, but it doesn’t directly show slope or intercept. Converting between forms is a key algebra skill.

How do I calculate the equation of a line?

Let’s put everything together with two worked examples that cover the most common scenarios.

Worked example: calculating from two points

  • Points: (1,1) and (2,3).
  • Slope m = (3-1)/(2-1) = 2.
  • Point-slope: y – 1 = 2(x – 1) → y = 2x – 1.
  • Final equation: y = 2x – 1.

Omni Calculator uses this exact example, confirming the result.

Worked example: calculating from a graph

  • Graph shows a line crossing the y-axis at (0,4) and passing through (2,0).
  • Slope m = (0-4)/(2-0) = -4/2 = -2.
  • Y-intercept c = 4.
  • Equation: y = -2x + 4.

The catch: when the y-intercept is not an integer, the two-point method is more reliable than reading from the graph.

What to watch

Vertical lines (x = constant) cannot be written in slope-intercept form because their slope is undefined. Lumen Learning notes that these lines require a different approach: simply state x = a, where a is the x-coordinate of every point.

The implication: always check for vertical lines before applying slope-intercept form.

Clarity check

Confirmed facts

  • The equation of a straight line in slope-intercept form is y = mx + c. MathCentre
  • The slope m can be calculated using two points (x1, y1) and (x2, y2) with the formula m = (y2 – y1) / (x2 – x1). BYU-Idaho
  • The point-slope form is y – y1 = m(x – x1). BYJU’S
  • Two points determine exactly one non-vertical line. University of Connecticut

What’s unclear

  • The specific notation for the y-intercept varies by region — some use c, others use b. CK-12
  • The naming of the forms (slope-intercept vs gradient-intercept) can differ across textbooks.
  • The two-point form can be written in two equivalent algebraic expressions.

“The equation of a straight line is y = mx + c, where m is the gradient and c is the y-intercept.”

MathCentre (UK higher education support)

“Given two points on a line, you can find the slope first, then substitute one point into the point-slope form to get the equation.”

— Lumen Learning (college algebra foundation)

“The slope-intercept form y = mx + b is the most common way to write a linear equation because it shows the slope and intercept directly.”

Math is Fun (educational math site)

For students tackling algebra, the ability to find the equation of a line is a gatekeeper skill. The methods here — from graph reading to two-point calculation — cover the vast majority of problems you’ll encounter. The key is practice: try a few examples, check your work with an online calculator, and soon you’ll see the pattern in every line.

For educators and self-learners, the implication is clear: teach the slope-intercept form first, then the point-slope method, and reinforce with visual examples. By mastering these two approaches, anyone can go from two points to a complete equation in minutes.

For a deeper look at the slope-intercept form, the y=mx+c slope-intercept form guide offers practical examples and real-life applications.

Frequently asked questions

What is the gradient of a line?

The gradient (or slope) is the measure of steepness, calculated as the change in y divided by the change in x between two points. It is represented by m in the equation y = mx + c.

What is the point-slope form of a linear equation?

Point-slope form is y – y1 = m(x – x1), where m is the slope and (x1, y1) is a known point on the line. It is especially useful when you know the slope and one point but not the y-intercept.

What is a linear equation in one variable?

A linear equation in one variable (e.g., x = 5) is a vertical line when graphed on a coordinate plane. It is not a function, but it is still a linear equation.

Can the equation of a vertical line be written in slope-intercept form?

No, because the slope is undefined due to a zero denominator in the slope formula. Vertical lines are written as x = a, where a is the x-coordinate of all points on the line.

Why is the equation of a line called linear?

It is called linear because its graph is a straight line. The term comes from the Latin “linea” meaning line — any equation of the first degree (no exponents higher than 1) produces a straight line.



Jack Cooper Davies

About the author

Jack Cooper Davies

Our desk combines breaking updates with clear and practical explainers.