# How do I write interval notation?

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.

- Page: https://www.acalculator.org/math/interval-notation-calculator
- JSON spec: https://www.acalculator.org/math/interval-notation-calculator.json
- Version: 492a5e16f55c

## Default answer

Example with the default inputs (Inequality or interval -2 <= x < 6): In interval notation it is [−2, 6).

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| i | Inequality or interval | One interval: an inequality such as -2 <= x < 6 or x > 4, or interval notation such as [-2, 6). |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| notation | Interval notation | The interval with brackets and parentheses. |
| inequality | Inequality | The same set as an inequality. |
| setBuilder | Set-builder notation | The same set as {x \| …}. |
| kind | Type of interval | Closed, open, half-open, unbounded, or a single point. |
| graph | On a number line | How each end is drawn on a number line. |
| length | Length | Right end minus left end; empty when unbounded. |
| midpoint | Midpoint | Halfway between the ends; empty when unbounded. |

## 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).

## Worked examples

1. i = -2 <= x < 6 gives 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).
2. i = (-inf, 1] gives 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).
3. i = -1 < x < 0 gives 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).
4. i = 4 < t gives 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).
5. i = 1,000 >= x >= -2.5 gives notation = [−2.5, 1000], length = 1,002.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).

## FAQ

### How do I write an inequality in interval notation?

Write the left end, a comma, and the right end. Use a bracket [ or ] where the end is included (≤ or ≥) and a parenthesis ( or ) where it is not (< or >). −2 ≤ x < 6 becomes [−2, 6).

### Does infinity get a bracket or a parenthesis?

Always a parenthesis, because infinity is not a number the interval can include. x ≤ 1 is (−∞, 1], and x > 4 is (4, ∞).

### What is set-builder notation?

It describes a set by the rule its members follow: {x | −2 ≤ x < 6} reads "the set of x such that x is at least −2 and less than 6". It is the same set as the interval [−2, 6).

### What do open and closed dots mean on a number line?

A closed (filled) dot means the end is included, matching a bracket. An open dot means it is not, matching a parenthesis. An end at infinity is drawn as an arrow.

### What is a half-open interval?

One end included and the other not, such as [−2, 6) or (3, 7]. A closed interval includes both ends, [a, b]; an open interval includes neither, (a, b).

### Can I type x ≠ 3 or a union?

Not yet: the page reads one interval at a time. x ≠ 3 is the union of two intervals, (−∞, 3) ∪ (3, ∞); type each part on its own.

## 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)
