Zalgorithm

Open versus closed intervals

What’s the difference between open and closed intervals?

Related to notes/ Range — the difference between maximum and minimum values of a sequence.

Closed intervals #

The notation for closed intervals is [start, end]. In closed intervals, the endpoints are included.

For example [2,2][-2, 2] represents all values from 2-2 to 22, including 2-2 and 22. It can also be written as 2x2-2 \leq x \leq 2.

Open intervals #

The notation for open intervals is (start, end). In open intervals the endpoints are excluded.

For example, (2,2)(-2, 2) represents all values between 2-2 and 22, but not including 2-2 and 22. It can also be written as 2<x<2-2 \lt x \lt 2.

Mixing open and close interval notation #