{
  "id": "interval-notation",
  "version": "492a5e16f55c",
  "status": "published",
  "name": "Interval Notation Calculator",
  "question": "How do I write interval notation?",
  "summary": "Writes an inequality such as −2 ≤ x < 6 in interval notation, [−2, 6), and interval notation back as an inequality and in set-builder notation, with the length, midpoint and number-line endpoints.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/interval-notation-calculator",
  "markdown": "https://www.acalculator.org/math/interval-notation-calculator.md",
  "kind": "function",
  "method": "A bracket [ ] includes an endpoint (≤ or ≥), a parenthesis ( ) excludes it (< or >), and ±∞ always takes a parenthesis. Length = right − left; midpoint = (left + right) ÷ 2.",
  "assumptions": [
    "One interval at a time; unions such as (−∞, 2) ∪ (3, ∞) are not read.",
    "In interval notation the comma separates the ends, so numbers there have no thousands separators.",
    "The variable is any single letter; the answer uses the letter you typed (x for interval notation)."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "i": {
        "title": "Inequality or interval",
        "description": "One interval: an inequality such as -2 <= x < 6 or x > 4, or interval notation such as [-2, 6).",
        "type": "string",
        "maxLength": 80
      }
    }
  },
  "outputs": {
    "notation": {
      "label": "Interval notation",
      "description": "The interval with brackets and parentheses.",
      "format": "text"
    },
    "inequality": {
      "label": "Inequality",
      "description": "The same set as an inequality.",
      "format": "text"
    },
    "setBuilder": {
      "label": "Set-builder notation",
      "description": "The same set as {x | …}.",
      "format": "text"
    },
    "kind": {
      "label": "Type of interval",
      "description": "Closed, open, half-open, unbounded, or a single point.",
      "format": "text"
    },
    "graph": {
      "label": "On a number line",
      "description": "How each end is drawn on a number line.",
      "format": "text"
    },
    "length": {
      "label": "Length",
      "description": "Right end minus left end; empty when unbounded.",
      "format": "number"
    },
    "midpoint": {
      "label": "Midpoint",
      "description": "Halfway between the ends; empty when unbounded.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "i": "-2 <= x < 6"
    },
    "outputs": {
      "notation": "[−2, 6)",
      "inequality": "−2 ≤ x < 6",
      "setBuilder": "{x | −2 ≤ x < 6}",
      "kind": "half-open and bounded",
      "graph": "closed (filled) dot at −2; open dot at 6",
      "length": 8,
      "midpoint": 2
    },
    "text": "In interval notation it is [−2, 6)."
  },
  "examples": [
    {
      "given": {
        "i": "-2 <= x < 6"
      },
      "expect": {
        "notation": "[−2, 6)",
        "setBuilder": "{x | −2 ≤ x < 6}",
        "kind": "half-open and bounded",
        "length": 8,
        "midpoint": 2
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (a bracket includes an endpoint, a parenthesis excludes it, infinity always takes a parenthesis; {x | −2 ≤ x < 6} = [−2, 6), {x | x ≤ 1} = (−∞, 1]), https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02)"
    },
    {
      "given": {
        "i": "(-inf, 1]"
      },
      "expect": {
        "inequality": "x ≤ 1",
        "setBuilder": "{x | x ≤ 1}",
        "graph": "arrow toward −∞; closed (filled) dot at 1"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (a bracket includes an endpoint, a parenthesis excludes it, infinity always takes a parenthesis; {x | −2 ≤ x < 6} = [−2, 6), {x | x ≤ 1} = (−∞, 1]), https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02)"
    },
    {
      "given": {
        "i": "-1 < x < 0"
      },
      "expect": {
        "notation": "(−1, 0)",
        "kind": "open and bounded",
        "length": 1,
        "midpoint": -0.5
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (a bracket includes an endpoint, a parenthesis excludes it, infinity always takes a parenthesis; {x | −2 ≤ x < 6} = [−2, 6), {x | x ≤ 1} = (−∞, 1]), https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02)"
    },
    {
      "given": {
        "i": "4 < t"
      },
      "expect": {
        "notation": "(4, ∞)",
        "inequality": "t > 4",
        "kind": "unbounded (a ray), open"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (a bracket includes an endpoint, a parenthesis excludes it, infinity always takes a parenthesis; {x | −2 ≤ x < 6} = [−2, 6), {x | x ≤ 1} = (−∞, 1]), https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02); hand calculation in content.mdx: 4 < t is t > 4"
    },
    {
      "given": {
        "i": "1,000 >= x >= -2.5"
      },
      "expect": {
        "notation": "[−2.5, 1000]",
        "length": 1002.5,
        "midpoint": 498.75
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (a bracket includes an endpoint, a parenthesis excludes it, infinity always takes a parenthesis; {x | −2 ≤ x < 6} = [−2, 6), {x | x ≤ 1} = (−∞, 1]), https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02); hand calculation in content.mdx: read right to left, −2.5 ≤ x ≤ 1,000"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §2.7 Linear Inequalities and Absolute Value Inequalities (interval notation: brackets include an endpoint, parentheses exclude it, infinity always takes a parenthesis; set-builder examples {x | −2 ≤ x < 6} = [−2, 6), {x | −1 < x < 0} = (−1, 0), {x | x ≤ 1} = (−∞, 1]). https://openstax.org/books/algebra-and-trigonometry-2e/pages/2-7-linear-inequalities-and-absolute-value-inequalities (retrieved 2026-10-02)"
  ],
  "related": [
    "absolute-value",
    "midpoint",
    "slope"
  ],
  "changelog": []
}
