Straight lines: y = mx + c
Drag two points and read the line through them: its gradient as rise over run, where it cuts the axes, and its equation with exact fractions.
Just need the number? Equation Solver
Readouts
What's happening
The gradient m of a straight line is how far it goes up for every 1 across: pick any two points on it and divide the change in y (the rise) by the change in x (the run). Because the line is straight, every pair of points gives the same answer, which is why the gold triangle can sit anywhere on it. The constant c is where the line cuts the y-axis, so y = mx + c reads directly off the picture.
Multiplying out the fractions gives the general form ax + by + c = 0 with whole numbers. Parallel lines share a gradient; perpendicular lines have gradients that multiply to −1, so one is the negative reciprocal of the other. The midpoint of AB averages the coordinates, and the length of AB comes from Pythagoras on the rise and the run.
- Gradientm = (y₂ − y₁) / (x₂ − x₁)
- Line through a pointy − y₁ = m(x − x₁)
- Perpendicular gradientsm₁ × m₂ = −1
- Length of a segmentAB = √((x₂ − x₁)² + (y₂ − y₁)²)
On the syllabus
- GCSE Maths AQA, Edexcel, OCRequation of a straight line, gradient and intercept, parallel and perpendicular lines, midpoint and length of a line segment
- A-Level Mathscoordinate geometry of straight lines
Challenge
Predict first: the line through A(−2, −1) and B(4, 3). What is its gradient, and where does it cross the y-axis? Type the gradient as a decimal in the box, press Check, then move A and B there and read the gradient triangle.
The rise is 3 − (−1) = 4 and the run is 4 − (−2) = 6, so m = 4/6 = 2/3 ≈ 0.667. Then c = −1 − (2/3)(−2) = 1/3, so the line is y = (2/3)x + 1/3, or 2x − 3y + 1 = 0.
Learn this properly
Lessons from GCSE Maths on this topic: worked steps, then exam-style questions with new numbers every time.
- y = mx + cStraight-line graphsFree
- Finding the equation of a lineStraight-line graphsPlus
- Parallel and perpendicular linesStraight-line graphsPlus
See the whole courseThe full course, topic tests and mock papers come with Plus. See Plus
FAQ
How do I find the equation of a line through two points?
Find the gradient m = (y₂ − y₁)/(x₂ − x₁). Then put one point into y − y₁ = m(x − x₁) and rearrange to y = mx + c. For (−2, −1) and (4, 3): m = 4/6 = 2/3, and y + 1 = (2/3)(x + 2) gives y = (2/3)x + 1/3.
How do I tell if two lines are perpendicular?
Multiply their gradients. If the product is −1 they are perpendicular, so a line with gradient 2/3 is perpendicular to any line with gradient −3/2. Vertical and horizontal lines are the one exception: they are perpendicular but a vertical line has no gradient.
What does c mean in y = mx + c?
It is the y-intercept: the value of y where the line crosses the y-axis, because putting x = 0 into y = mx + c leaves y = c.
How do I find the midpoint and length of AB?
The midpoint averages the coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2). The length is √((x₂ − x₁)² + (y₂ − y₁)²), which is Pythagoras on the run and the rise.
How do I find a line parallel or perpendicular to another through a point?
Keep the gradient for the parallel line and use the negative reciprocal for the perpendicular one. For 2x − y + 3 = 0 (gradient 2) through (1, 4): the parallel line is y − 4 = 2(x − 1), so y = 2x + 2, and the perpendicular is y − 4 = −(1/2)(x − 1), so y = −(1/2)x + 9/2. In Solve for, pick Parallel and perpendicular and type a = 2, b = −1, c = 3 and the point.