Intervals

About this exercise

Checking whether a number belongs to a given interval.

Example problems

A few of the problems this exercise asks. The printable worksheet holds ten fresh ones.

  1. Does the number 6 belong to the interval [1, 7]?
  2. Does the number -9 belong to the interval [-10, 14)?
  3. Does the number -2 belong to the interval [0, 11)?
  4. Does the number 6 belong to the interval [5, 10]?

Try it yourself first — open a section below only if you get stuck.

How to solve it

Compare the number with both endpoints, and check whether the interval includes them or not.

Worked example

The number 0 belongs to (-7, 0] because the square bracket includes that endpoint, but it would not belong to (-7, 0).

Common mistake

Ignoring whether the endpoints are included. Open and closed intervals differ exactly there.