# What is my line in y = mx + b form?

Finds the slope-intercept form y = mx + b of a line through two points, or through one point with a given slope, in exact fractions, with the point-slope and standard forms.

- Page: https://www.acalculator.org/math/slope-intercept-calculator
- JSON spec: https://www.acalculator.org/math/slope-intercept-calculator.json
- Version: 9560b7fc21b7

## Default answer

Example with the default inputs (I know Two points, x₁ 1, y₁ 3, x₂ 3, y₂ 7): The line is y = 2x + 1.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| given | I know | What you know about the line: two points on it, or its slope and one point. |
| x1 | x₁ | The x coordinate of a point on the line. |
| y1 | y₁ | The y coordinate of the same point. |
| x2 | x₂ | The x coordinate of a second point on the line. |
| y2 | y₂ | The y coordinate of the second point. |
| m | Slope (m) | How much y changes when x goes up by 1. |
| x | x | Optional: an x value at which to read y on the line. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| equation | Slope-intercept form | The line as y = mx + b, with the slope m and the y-intercept b as exact fractions. |
| slope | Slope m | The rise over the run: (y₂ − y₁) ÷ (x₂ − x₁). |
| intercept | y-intercept b | Where the line crosses the y axis: the value of y at x = 0. |
| xIntercept | x-intercept | Where the line crosses the x axis: the value of x at y = 0, which is −b ÷ m. None for a flat line. |
| pointSlope | Point-slope form | The same line as y − y₁ = m(x − x₁), through the first point. |
| standard | Standard form | The same line as Ax + By = C, with whole numbers A, B, C that share no factor. |
| y | y on the line | The y value on the line at the x you typed: mx + b. |

## Method

m = (y₂ − y₁) ÷ (x₂ − x₁) (or the slope as typed), b = y₁ − m × x₁, and the line is y = mx + b; all in exact fractions.

## Assumptions

- Every number is read exactly as typed: 0.1 is 1/10, so the slope and intercept are exact fractions.
- The two points must have different x values. A vertical line, x = c, has no slope-intercept form.
- The point-slope form uses the first point, (x₁, y₁).
- The standard form Ax + By = C uses whole numbers with no common factor, with A ≥ 0.
- y at x is shown when it is at most 10³⁰⁰ in size.

## Worked examples

1. given = points, x1 = 1, y1 = 3, x2 = 3, y2 = 7 gives equation = y = 2x + 1, slope = 2, intercept = 1, xIntercept = -0.5, pointSlope = y − 3 = 2(x − 1), standard = 2x − y = −1. Source: hand calculation in content.mdx: m = (7 − 3) ÷ (3 − 1) = 2, b = 3 − 2 × 1 = 1.
2. given = points, x1 = 3, y1 = 4, x2 = 0, y2 = -3 gives equation = y = (7/3)x − 3, slope = 2.333333, intercept = -3, xIntercept = 1.285714, standard = 7x − 3y = 9. Source: OpenStax College Algebra 2e, section 2.2: the line through (3, 4) and (0, −3) is y = (7/3)x − 3.
3. given = slope, m = -0.5, x1 = 4, y1 = 1, x = 10 gives equation = y = −(1/2)x + 3, intercept = 3, xIntercept = 6, pointSlope = y − 1 = −(1/2)(x − 4), standard = x + 2y = 6, y = -2. Source: hand calculation in content.mdx: b = 1 − (−1/2) × 4 = 3; at x = 10, y = −5 + 3 = −2.
4. given = points, x1 = -2, y1 = 5, x2 = 4, y2 = 5 gives equation = y = 5, slope = 0, intercept = 5, standard = y = 5. Source: hand calculation in content.mdx: equal y values give slope 0, a flat line.
5. given = points, x1 = 0.1, y1 = 0.2, x2 = 0.3, y2 = 0.5 gives equation = y = (3/2)x + 1/20, slope = 1.5, intercept = 0.05. Source: hand calculation in content.mdx: decimals are exact, m = 0.3 ÷ 0.2 = 3/2, b = 0.2 − 0.15 = 1/20.

## FAQ

### How do I find y = mx + b from two points?

First find the slope, m = (y₂ − y₁) ÷ (x₂ − x₁). Then put one point into y = mx + b and solve for b: b = y₁ − m × x₁. For (1, 3) and (3, 7): m = 4 ÷ 2 = 2 and b = 3 − 2 × 1 = 1, so y = 2x + 1.

### What do m and b mean?

m is the slope: how much y goes up when x goes up by 1 (a negative m means the line goes down). b is the y-intercept: the value of y where the line crosses the y axis, at x = 0.

### How do I find the equation from the slope and one point?

Use b = y₁ − m × x₁. With slope −1/2 through (4, 1): b = 1 − (−1/2) × 4 = 3, so y = −(1/2)x + 3.

### Why does the answer show fractions?

Slopes are often not whole numbers. The line through (3, 4) and (0, −3) has slope 7/3, which as a decimal is 2.333… and never ends. The fraction is exact; the decimal slope is shown too.

### What if both points have the same x value?

Then the line is vertical, x = c. Its slope is undefined (the run x₂ − x₁ is 0), so it cannot be written as y = mx + b. The calculator says so instead of giving a number.

### How do I convert y = mx + b to standard form?

Move the x term to the left and clear the fractions. y = (7/3)x − 3 becomes −(7/3)x + y = −3; multiplying by −3 gives 7x − 3y = 9. The calculator shows this form too.

### How do I find the x-intercept?

Set y = 0 and solve: 0 = mx + b gives x = −b ÷ m. For y = 2x + 1 the line crosses the x axis at x = −0.5. A flat line (m = 0) has no x-intercept unless it is the x axis itself.

## Sources

- OpenStax, College Algebra 2e, §2.2 Linear Equations in One Variable (slope formula, point-slope form, slope-intercept form; the line through (3, 4) and (0, −3) is y = (7/3)x − 3; vertical lines x = c have undefined slope). https://openstax.org/books/college-algebra-2e/pages/2-2-linear-equations-in-one-variable
