In elementary algebra, an **interval** is a set that contains every real number between two indicated numbers, and possibly the two numbers themselves. For example, the interval "(10,20)" stands for all real numbers between 10 and 20, not including 10 or 20. On the other hand, the interval "[10,20]" includes every number between 10 and 20 *along with* the numbers 10 and 20. Other possibilities are listed below.

In higher mathematics, a formal definition is the following: An **interval** is a subset *S* of a totally ordered set *T* with the property that whenever *x* and *y* are in *S* and *x* < *z* < *y* then *z* is in *S*.

As mentioned above, a particularly important case is when *T* = **R**, the set of real numbers.

Intervals of **R** are of the following eleven different types
(where *a* and *b* are real numbers, with *a* < *b*):

- (
*a*,*b*) = {*x*|*a*<*x*<*b*} - [
*a*,*b*] = {*x*|*a*≤*x*≤*b*} - [
*a*,*b*) = {*x*|*a*≤*x*<*b*} - (
*a*,*b*] = {*x*|*a*<*x*≤*b*} - (
*a*,∞) = {*x*|*x*>*a*} - [
*a*,∞) = {*x*|*x*≥*a*} - (-∞,
*b*) = {*x*|*x*<*b*} - (-∞,
*b*] = {*x*|*x*≤*b*} - (-∞,∞) =
**R**itself, the set of all real numbers - {
*a*} - the empty set

Intervals of type (1), (5), (7), (9) and (11) are called **open intervals** (because they are open sets) and intervals (2), (6), (8), (9), (10) and (11) **closed intervals** (because they are closed sets).
Intervals (3) and (4) are sometimes called **half-closed** (or, not surprisingly, **half-open**) intervals.
Notice that intervals (9) and (11) are both open *and* closed, which is not the same thing as being half-open and half-closed.

Intervals (1), (2), (3), (4), (10) and (11) are called **bounded intervals** and intervals (5), (6), (7), (8) and (9) **unbounded intervals**.
Interval (10) is also known as a **singleton**.

The **length** of the bounded intervals (1), (2), (3), (4) is *b*-*a* in each case. The **total length** of a sequence of intervals is the sum of the lengths of the intervals. No allowance is made for the intersection of the intervals. For instance, the total length of the sequence {(1,2),(1.5,2.5)} is 1+1=2, despite the fact that the union of the sequence is an interval of length 1.5.

Intervals play an important role in the theory of integration, because they are the simplest sets whose "size" or "measure" or "length" is easy to define (see above). The concept of measure can then be extended to more complicated sets, leading to the Borel measure and eventually to the Lebesgue measure.

Intervals are precisely the connected subsets of **R**. They are also precisely the convex subsets of **R**.
Since a continuous image of a connected set is connected,
it follows that if *f*: **R**→**R** is a continuous function and *I* is an interval, then its image *f*(*I*) is also an interval.
This is one formulation of the intermediate value theorem.

For a partially ordered set we can define for *a* ≤ *b*:

[*a*,*b*] = { *x* | *a* ≤ *x* ≤ *b* }

= Interval arithmetic =

Interval arithmetic has been discovered in 1956 by M. Warmus. It defines a set of operations which can be applied on intervals :

T · S = { *x* | ∃ y ∈ T, ∃ z ∈ S, *x* = *y* · *z* }

- [
*a*,*b*] + [*c*,*d*] = [*a*+*c*,*b*+*d*] - [
*a*,*b*] - [*c*,*d*] = [*a*-*d*,*b*-*c*] - [
*a*,*b*] * [*c*,*d*] = [min (*ac*,*ad*,*bc*,*bd*), max (*ac*,*ad*,*bc*,*bd*)] - [
*a*,*b*] / [*c*,*d*] = [min (*a/c*,*a/d*,*b/c*,*b/d*), max (*a/c*,*a/d*,*b/c*,*b/d*)]

These operations are commutative, associative and sub-distributive (*X* ( *Y* + *Z* ) *⊆* *XY* + *XZ*)