Skip to content
Brainlag

Theme

Colour

← All simulations

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.

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.

m = (y₂ − y₁) / (x₂ − x₁)y − y₁ = m(x − x₁)m₁ × m₂ = −1AB = √((x₂ − x₁)² + (y₂ − y₁)²)

GCSE Maths (AQA, Edexcel, OCR): equation of a straight line, gradient and intercept, parallel and perpendicular lines, midpoint and length of a line segment. A-Level Maths: coordinate geometry of straight lines.

Work through the numbers with Graphing Calculator and Fractions and Percentages.

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.

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.