{
  "id": "slope-intercept",
  "version": "9560b7fc21b7",
  "status": "published",
  "name": "Slope Intercept Form Calculator",
  "question": "What is my line in y = mx + b form?",
  "summary": "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.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/slope-intercept-calculator",
  "markdown": "https://www.acalculator.org/math/slope-intercept-calculator.md",
  "kind": "function",
  "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."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "given": {
        "title": "I know",
        "description": "What you know about the line: two points on it, or its slope and one point.",
        "type": "string",
        "enum": [
          "points",
          "slope"
        ]
      },
      "x1": {
        "title": "x₁",
        "description": "The x coordinate of a point on the line.",
        "type": "number"
      },
      "y1": {
        "title": "y₁",
        "description": "The y coordinate of the same point.",
        "type": "number"
      },
      "x2": {
        "title": "x₂",
        "description": "The x coordinate of a second point on the line.",
        "type": "number"
      },
      "y2": {
        "title": "y₂",
        "description": "The y coordinate of the second point.",
        "type": "number"
      },
      "m": {
        "title": "Slope (m)",
        "description": "How much y changes when x goes up by 1.",
        "type": "number"
      },
      "x": {
        "title": "x",
        "description": "Optional: an x value at which to read y on the line.",
        "type": "number"
      }
    }
  },
  "outputs": {
    "equation": {
      "label": "Slope-intercept form",
      "description": "The line as y = mx + b, with the slope m and the y-intercept b as exact fractions.",
      "format": "text"
    },
    "slope": {
      "label": "Slope m",
      "description": "The rise over the run: (y₂ − y₁) ÷ (x₂ − x₁).",
      "format": "number"
    },
    "intercept": {
      "label": "y-intercept b",
      "description": "Where the line crosses the y axis: the value of y at x = 0.",
      "format": "number"
    },
    "xIntercept": {
      "label": "x-intercept",
      "description": "Where the line crosses the x axis: the value of x at y = 0, which is −b ÷ m. None for a flat line.",
      "format": "number"
    },
    "pointSlope": {
      "label": "Point-slope form",
      "description": "The same line as y − y₁ = m(x − x₁), through the first point.",
      "format": "text"
    },
    "standard": {
      "label": "Standard form",
      "description": "The same line as Ax + By = C, with whole numbers A, B, C that share no factor.",
      "format": "text"
    },
    "y": {
      "label": "y on the line",
      "description": "The y value on the line at the x you typed: mx + b.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "given": "points",
      "x1": 1,
      "y1": 3,
      "x2": 3,
      "y2": 7,
      "m": 2
    },
    "outputs": {
      "equation": "y = 2x + 1",
      "slope": 2,
      "intercept": 1,
      "xIntercept": -0.5,
      "pointSlope": "y − 3 = 2(x − 1)",
      "standard": "2x − y = −1"
    },
    "text": "The line is y = 2x + 1."
  },
  "examples": [
    {
      "given": {
        "given": "points",
        "x1": 1,
        "y1": 3,
        "x2": 3,
        "y2": 7
      },
      "expect": {
        "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"
    },
    {
      "given": {
        "given": "points",
        "x1": 3,
        "y1": 4,
        "x2": 0,
        "y2": -3
      },
      "expect": {
        "equation": "y = (7/3)x − 3",
        "slope": 2.3333333333333335,
        "intercept": -3,
        "xIntercept": 1.2857142857142858,
        "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"
    },
    {
      "given": {
        "given": "slope",
        "m": -0.5,
        "x1": 4,
        "y1": 1,
        "x": 10
      },
      "expect": {
        "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"
    },
    {
      "given": {
        "given": "points",
        "x1": -2,
        "y1": 5,
        "x2": 4,
        "y2": 5
      },
      "expect": {
        "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"
    },
    {
      "given": {
        "given": "points",
        "x1": 0.1,
        "y1": 0.2,
        "x2": 0.3,
        "y2": 0.5
      },
      "expect": {
        "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"
    }
  ],
  "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"
  ],
  "related": [
    "interpolation",
    "midpoint"
  ],
  "changelog": []
}
