A straight line in the plane can be written in several equivalent ways, and each one is handy for a different job. This equation of a line calculator takes whatever you know — two points, one point and the slope, the slope and the y-intercept, or a general equation — and returns all the usual forms at once: slope-intercept , point-slope , general form with whole-number coefficients and standard form .
It also gives the slope as a decimal and as a fraction, the x- and y-intercepts, the angle the line makes with the x-axis, and the value of for any you choose — which is simply evaluating the linear function .
Whole-number inputs are kept exact: a slope of stays a fraction rather than turning into a rounded decimal, and the general form is reduced to coprime integers. Vertical lines, which have no slope, are recognised and written as . To study the steepness itself (angle, percent grade, distance and midpoint), see the slope calculator and the distance between two points calculator.
How to use this calculator
- Choose what you know: two points, a point and the slope, the slope and the intercept, or the coefficients , , of .
- Type the numbers. Negative values and decimals are accepted; with whole numbers every result stays an exact fraction.
- Optionally enter an value to read the matching on the line.
- Read the slope-intercept form at the top, then the other forms and the intercepts below. Copy the form your teacher or software expects.
- Open the steps to follow the slope and intercept computations.
The formula
Through two points and with , the slope is
and the y-intercept is . The four forms of the same line are:
| Form | Equation |
|---|---|
| Slope-intercept | |
| Point-slope | |
| General | |
| Standard |
From the general form with : and . The x-intercept solves , i.e. when . If the line is vertical, , and has no slope.
Worked example
Two points. Take and . The slope is , and .
- Slope-intercept: y = −(3/2)x + 5/2
- Point-slope (through the first point): y − 4 = −(3/2)(x + 1)
- General form: 3x + 2y − 5 = 0; standard form: 3x + 2y = 5
- x-intercept: x = 5/3 ≈ 1.6667; at the line passes through y = −5.
Point and slope. Through with slope 3: y = 3x − 7, or 3x − y − 7 = 0.
General form. reduces to x − 2y + 4 = 0, i.e. y = (1/2)x + 2.
Linear functions: f(x) = mx + b
Every non-vertical line is the graph of a linear function (also called an affine function) . The slope is the rate of change — how much increases when increases by 1 — and is the starting value. For y = 2x − 3, f(4) = 5 and the function crosses zero at x = 1.5.
Typical real-world examples: a taxi fare with a fixed pickup charge plus a price per kilometre, a phone plan with a monthly fee plus a cost per gigabyte, or a temperature conversion such as . Knowing two data points is enough to rebuild the whole function with the two-point mode.
Parallel, perpendicular, horizontal and vertical lines
Two non-vertical lines are parallel when they have the same slope and perpendicular when their slopes multiply to . A horizontal line has slope 0 and an equation ; a vertical line has an undefined slope and an equation , which is why only the general and standard forms can describe every line in the plane. For intersections of two lines, solve the system — for example with the matrix calculator.
Frequently asked questions
How do I find the equation of a line through two points?
Compute the slope m = (y₂ − y₁) / (x₂ − x₁), then the intercept b = y₁ − m·x₁, and write y = mx + b. Through (−1, 4) and (3, −2) you get m = −3/2, b = 5/2, so y = −(3/2)x + 5/2.
What is the difference between general form and standard form?
Both put x and y on the same side. General form sets everything equal to zero, Ax + By + C = 0; standard form keeps the constant on the right, Ax + By = C. Textbooks usually ask for integer coefficients with A positive, which is what the calculator returns.
Why does a vertical line have no slope-intercept form?
On a vertical line every point has the same x, so the run x₂ − x₁ is zero and the slope cannot be computed. Its equation is x = k, and y is not a function of x.
How do I convert Ax + By + C = 0 to y = mx + b?
Isolate y: By = −Ax − C, then divide by B. The slope is −A/B and the intercept −C/B. For 2x − 4y + 8 = 0, y = (1/2)x + 2.
How do I find the x- and y-intercepts?
Set x = 0 to get the y-intercept and y = 0 to get the x-intercept. A horizontal line other than the x-axis never meets the x-axis, so it has no x-intercept.
Sources
- OpenStax, College Algebra 2e — §4.1 Linear Functions
- OpenStax, College Algebra 2e — §2.2 Linear Equations in One Variable (equations of lines)
- Weisstein, Line — Wolfram MathWorld
Last updated: