Gradient of a Line: Definition Formula and Examples

#Gradient of a Line
TL;DR
The gradient of a line is its constant rise over run, the m in y = mx + c. It comes from two points, an equation, a graph or an angle.
Prabhjot Kaur·reviewed byMadhukar VLast updated on December 2, 202611 min read

Key Points

  • A straight line has one gradient, the same between any two of its points; "gradient" and "slope" name the same number.
  • From two points, m = (y₂ − y₁) ÷ (x₂ − x₁); from y = mx + c, read m once the equation is solved for y.
  • From an angle, m = tan θ, with θ measured anticlockwise from the positive x-axis.
  • Parallel lines have equal gradients, and perpendicular lines have gradients that multiply to −1.

The Same Number, Four Disguises

A line can reach you as two points, an equation, a picture on a grid, or an angle. Each hides the same number: the gradient of a line, the amount it climbs for every step to the right. The line through (−4,3)(-4, 3) and (4,−3)(4, -3) drops 66 squares over 88 across, so its gradient is −34-\frac{3}{4}; written as 3x+4y=03x + 4y = 0, the same −34-\frac{3}{4} sits inside the equation.

reading the gradient of a line from a graph by counting squares
A line through (−4, 3) and (4, −3) on a grid, with 8 squares across marked in orange and 6 squares down marked in green, giving gradient = −6 ÷ 8 = −3/4.

What Is the Gradient of a Line?

The gradient of a line is one number that says how steep the line is and which way it slants: the change in yy divided by the change in xx between any two of its points.

m=y2−y1x2−x1=ΔyΔxm = \frac{y_2 - y_1}{x_2 - x_1} = \frac{\Delta y}{\Delta x}

"Gradient" is the British name for the slope of a line. (The full meaning of the word, as a rate or a percentage, is on the gradient definition page.) In y=mx+cy = mx + c, mm is the gradient and cc is the y-intercept. A gradient is positive (rising), negative (falling), zero (horizontal) or undefined (vertical).

Why only one gradient per line? Every slope triangle (rise and run drawn under the line) on the same line has the same angles, so the triangles are similar (same shape, different size) and rise ÷ run never changes. That is what makes a straight line straight.

Four Ways to Find the Gradient of a Line

1. From two points

Subtract the y-values, subtract the x-values in the same order, divide. Through (1,2)(1, 2) and (3,8)(3, 8): m=62=3m = \frac{6}{2} = 3. Every special case is on finding slope from two points.

2. From the equation

In slope-intercept form, y=mx+cy = mx + c, the gradient is the coefficient of xx, but only once the equation is solved for yy. For the general form Ax+By+C=0Ax + By + C = 0, solving for yy gives

m=−AB(B≠0)m = -\frac{A}{B} \quad (B \neq 0)

3. From a graph

Pick two points where the line crosses grid corners, count squares up (negative if down) and across, and divide. Watch the axis scales: stretching an axis changes how steep a line looks, never its gradient.

4. From the angle

If the line makes angle θ\theta with the positive x-axis, measured anticlockwise, then m=tan⁡θm = \tan\theta, because tan is rise (opposite) over run (adjacent). A rising line has an acute angle; a falling one is obtuse, so a line at 135°135° has m=−1m = -1. Going back, a negative gradient gives a negative calculator angle: add 180°180°.

the gradient of a line equals the tangent of its angle of inclination
Two panels. Left: a rising line at θ = 30 degrees from the positive x-axis, gradient tan 30° ≈ 0.58. Right: a falling line at θ = 135 degrees, gradient tan 135° = −1.

A gradient fixes direction, not position: every line y=3x+cy = 3x + c shares gradient 33. Add one point and point-slope form pins the line down. A vertical line's run is 00, so it has no gradient, and no method should produce one.

Gradients of Parallel and Perpendicular Lines

Parallel lines have equal gradients. The x-axis cuts both like a transversal, so their angles of inclination are equal corresponding angles, and equal angles have equal tangents. y=12x+2y = \frac{1}{2}x + 2 and y=12x−1y = \frac{1}{2}x - 1 are parallel lines.

parallel lines have equal gradients
The parallel lines y = ½x + 2 and y = ½x − 1, each with a slope triangle of 2 across and 1 up.

Perpendicular lines, neither vertical, have m1×m2=−1m_1 \times m_2 = -1. Turn a slope triangle with run 33 and rise 22 a quarter turn: the run becomes a rise of 33 and the rise becomes a run of −2-2. The gradient 23\frac{2}{3} becomes −32-\frac{3}{2}, and the product is −1-1. So flip the fraction and change the sign. The one gap: a horizontal and a vertical line are perpendicular with no pair of numbers to multiply.

turning a slope triangle a quarter turn shows why perpendicular gradients multiply to −1
A blue slope triangle with run 3 and rise 2 (m1 = 2/3) and the same triangle turned 90 degrees in orange with run −2 and rise 3 (m2 = −3/2), the two lines meeting at a right angle, with m1 × m2 = −1.

The Angle Between Two Lines

The tangent of the angle between two lines comes straight from their gradients. Using the tangent of a difference of angles:

tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right|

Equal gradients give tan⁡θ=0\tan\theta = 0 (parallel); m1m2=−1m_1 m_2 = -1 makes the denominator 00, so θ=90°\theta = 90° (perpendicular).

Try It Yourself

In the tool, drag each line's handles. Put the blue ones on (0,1)(0, 1) and (1,3)(1, 3) and the orange ones on (0,4)(0, 4) and (3,1)(3, 1): the readout shows m1=2m_1 = 2, m2=−1m_2 = -1 and an acute angle of about 71.57°71.57°. Then press "Parallel" and "Perpendicular".

Examples of the Gradient of a Line

Example 1

What is the gradient of the line y = 3x + 5?

  1. It is already in the form y=mx+cy = mx + c.
  2. The number in front of xx is 33.

Answer: m=3m = 3.

Example 2

Find the gradient of 2y = 6x + 10.

  1. The number in front of xx is 66, and it is tempting to stop there.
  2. Check two points: x=0x = 0 gives y=5y = 5, and x=1x = 1 gives y=8y = 8. One right, three up.
  3. Divide every term by 2: y=3x+5y = 3x + 5.
rearranging 2y = 6x + 10 shows the gradient of the line is 3
The line y = 3x + 5 through (0, 5) with a slope triangle one unit across and three units up, labelled gradient 3, not 6.

Answer: 33, Example 1's line in disguise.

Example 3

A line passes through (1, 5) and (4, −4). Find its gradient.

  1. Rise: −4−5=−9-4 - 5 = -9.
  2. Run: 4−1=34 - 1 = 3.
  3. m=−93=−3m = \frac{-9}{3} = -3.

Answer: −3-3; the line falls 3 for every 1 to the right.

Example 4

Find the gradient of 4x − 2y + 5 = 0, and the gradient of a line perpendicular to it.

  1. A=4A = 4, B=−2B = -2, so m=−4−2=2m = -\frac{4}{-2} = 2.
  2. Perpendicular: flip and change sign, −12-\frac{1}{2}.
  3. Check: 2×(−12)=−12 \times \left(-\frac{1}{2}\right) = -1.

Answer: 22, and −12-\frac{1}{2} for the perpendicular line.

Example 5

A line makes an angle of 120° with the positive x-axis. Find its gradient.

  1. Use m=tan⁡θm = \tan\theta.
  2. tan⁡120°=−3\tan 120° = -\sqrt{3}.

Answer: −3≈−1.73-\sqrt{3} \approx -1.73.

Example 6

Find the acute angle between y = 2x + 1 and y = −x + 4.

  1. m1=2m_1 = 2 and m2=−1m_2 = -1.
  2. tan⁡θ=∣2−(−1)1+2(−1)∣=3\tan\theta = \left|\frac{2 - (-1)}{1 + 2(-1)}\right| = 3.
  3. θ=tan⁡−13\theta = \tan^{-1} 3.
the angle between two lines found from their gradients
The lines y = 2x + 1 and y = −x + 4 crossing at (1, 3), with the acute angle of 71.6 degrees between them shaded.

Answer: about 71.6°71.6°, at the crossing point (1,3)(1, 3).

Common Mistakes With the Gradient of a Line

Mistake 1: Reading m before rearranging

Where it slips in: Equations not yet in y=mx+cy = mx + c form.

Don't do this: Call the gradient of 2y=6x+102y = 6x + 10 "6".

The correct way: Solve for yy first: y=3x+5y = 3x + 5, so m=3m = 3. The student who memorised "m is the number by x" skips this step.

Mistake 2: Dividing run by rise

Where it slips in: Putting Δx\Delta x on top because xx comes first.

Don't do this: Write x2−x1y2−y1\frac{x_2 - x_1}{y_2 - y_1}, the reciprocal of the gradient.

The correct way: Rise over run, ΔyΔx\frac{\Delta y}{\Delta x}. Check against the picture: a line that climbs 88 over a run of 44 must have a gradient above 11. Misread a "1 in 4" road sign this way and a gentle hill becomes a cliff.

Mistake 3: Dropping the minus sign in −A/B

Where it slips in: The general-form shortcut, used quickly.

Don't do this: Give 3x+4y=03x + 4y = 0 the gradient 34\frac{3}{4}.

The correct way: m=−AB=−34m = -\frac{A}{B} = -\frac{3}{4}, a negative slope. When unsure, solve for yy.

Mistake 4: Only changing the sign for a perpendicular gradient

Where it slips in: Remembering "perpendicular means negative" and stopping.

Don't do this: Give −3-3 as the gradient perpendicular to 33.

The correct way: Flip and change sign: −13-\frac{1}{3}, then check the product is −1-1.

Why the Gradient Matters: "A Single Number for Steepness and Direction"

Every ramp, ski run and railway line carries a number that decides whether it is safe to climb, and that number is a gradient.

  • Safety limits. In the United States, accessible ramps are capped at a running slope of 1 in 12, and railways keep gradients low so trains can climb and brake.
  • Rates. On a straight-line graph the gradient is the rate: speed on a distance–time graph, the average yearly growth on a trend line.
  • Right angles on plans. A road with gradient 12\frac{1}{2} and a cross street with gradient −2-2 meet at right angles, since 12×(−2)=−1\frac{1}{2} \times (-2) = -1.
perpendicular streets on a map have gradients that multiply to −1
A street map with Main Road along y = ½x + 1 and Cross Street along y = −2x + 6 meeting at (2, 2) at a right angle, since ½ × (−2) = −1.

Conclusion

  • The gradient of a line is one constant number, m=ΔyΔxm = \frac{\Delta y}{\Delta x}, the same between any two of its points, and the same thing as the slope.
  • Two points, the equation, a graph and the angle are four routes to the same mm; rearrange to y=mx+cy = mx + c before reading it off.
  • Parallel lines share a gradient, perpendicular gradients multiply to −1-1, and tan⁡θ=∣m1−m21+m1m2∣\tan\theta = \left|\frac{m_1 - m_2}{1 + m_1 m_2}\right| gives every angle in between.

Practise What You Have Learned

  1. State the gradient of y=−4x+7y = -4x + 7.
  2. Rewrite 3y=9x−63y = 9x - 6 as y=mx+cy = mx + c and give its gradient.
  3. Find the gradient of 5x+2y−8=05x + 2y - 8 = 0.
  4. Find the acute angle between y=xy = x and y=3xy = 3x.

Answer to Question 1: −4-4.

Answer to Question 2: y=3x−2y = 3x - 2, so m=3m = 3.

Answer to Question 3: −52-\frac{5}{2}. If it came out positive, reread Mistake 3.

Answer to Question 4: tan⁡θ=24=12\tan\theta = \frac{2}{4} = \frac{1}{2}, so θ≈26.6°\theta \approx 26.6°.

To work through coordinate geometry with a teacher, explore Bhanzu's geometry tutor or math tutoring.

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

Read More

Research Behind This Article

  1. OpenStax, College Algebra 2e, Section 4.1: Linear Functions (slope, parallel and perpendicular lines) (2021). openstax.org
  2. OpenStax, Algebra and Trigonometry 2e, Section 9.2: Sum and Difference Identities (the tangent of a difference) (2022). openstax.org
  3. U.S. Access Board, Guide to the ADA Accessibility Standards, Chapter 4: Ramps and Curb Ramps (1:12 maximum). access-board.gov
  4. OpenStax, Algebra and Trigonometry 2e, Section 7.2: Right Triangle Trigonometry (tangent as opposite over adjacent). openstax.org

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

Is the gradient of a line the same as its slope?
Yes. "Gradient" (UK) and "slope" (US) are the same number, rise over run.
What does the m in y = mx + c stand for?
The gradient. Why the letter mm was chosen is unknown.
Can the gradient of a line be negative?
Yes. A negative gradient means the line falls from left to right, and its angle of inclination is obtuse.
What is the gradient of a vertical line?
It has none. Its run is 00, and division by 00 gives no number; a horizontal line, by contrast, has gradient 00.
Do I need two points to find the gradient?
No. An equation in y=mx+cy = mx + c form shows it, Ax+By+C=0Ax + By + C = 0 gives −AB-\frac{A}{B}, and an angle gives tan⁡θ\tan\theta.
✍️ Written By
Prabhjot Kaur
Prabhjot Kaur
Subject Matter Expert & Curriculum Developer
Prabhjot Kaur is an education professional with 14 years of experience in teaching, curriculum development, content review and teacher training. She taught for six years in the UK and has worked as a Subject Matter Expert for competitive exams, developing and reviewing content for Numerical Ability and Logical Reasoning. She has trained teachers in effective classroom practices and designs activity-based learning experiences that make concepts easy to understand.
LinkedIn
🔬 Reviewed By
Madhukar V
Math Columnist & Analyst
Book a FREE Demo ClassBook Now →