Equation of a line calculator: y = mx + c
Free TutorAura tool · no sign-up · Updated
Enter two points, or one point and the gradient, and the calculator writes the equation of the straight line in the form:
where is the gradient (how steep the line is) and is the y-intercept (where it crosses the y-axis). In the US this is often written .
Method: from two points
- Find the gradient: .
- Substitute one point into and solve for .
- Write the equation.
Example: and . . Then , so . The line is .
From a point and the gradient
Through with gradient 3: , so and the line is .
Through with gradient : the point is on the y-axis, so straight away: .
Parallel and perpendicular lines
A line parallel to has gradient 3 too. A line perpendicular to it has gradient , because perpendicular gradients multiply to . To find a perpendicular line through a point, use that gradient with the point method above.
Other forms
Equations may be given as , like . Rearrange to to read the gradient and intercept: , so the gradient is and it crosses the y-axis at 8. To find where a line crosses the x-axis, set .
Common mistakes
- Using the wrong way round when substituting.
- Getting the sign of wrong when moving terms.
- Writing : just write .
Practise with our straight-line graphs questions, and find the gradient alone with the gradient calculator.
Exam tips
- Check your equation with the second point: it should work for both.
- If the question asks for the form , rearrange at the end and use whole numbers.
- On the SAT, lines are often written : same idea.
Checking points and intercepts
- Is a point on the line? Substitute its x-coordinate. For , the point is on the line because , but is not.
- x-intercept: set . For , gives .
- Where two lines cross: set their equations equal and solve, or use our simultaneous equations calculator.
Frequently asked questions
How do you find the equation of a line from two points?
Find the gradient (change in y ÷ change in x), substitute one point into y = mx + c to find c, then write y = mx + c.
What does c mean in y = mx + c?
The y-intercept: the value of y where the line crosses the y-axis (when x = 0).
What is the gradient of a perpendicular line?
The negative reciprocal: if a line has gradient m, a perpendicular line has gradient −1/m.
Is anything I type sent to a server?
No. The calculation runs in your browser and nothing is stored.
Sources
- GCSE mathematics: subject content and assessment objectives. Department for Education.
- Cambridge IGCSE Mathematics 0580 syllabus. Cambridge International.
Keep reading
Straight line graphs (y = mx + c) questions and answers
8 GCSE and IGCSE questions with worked answers, checked as you type.
Gradient calculator from two points
The gradient (slope) of the line through two points, with the working shown.
Online graphing calculator
Plot up to five graphs, trace them, and find roots, intercepts and intersections.
Linear functions and straight-line graphs
Interpret gradient (slope) and intercept, find equations of lines, and use parallel and perpendicular lines.