Bounded intervals
We will call interval the set of numbers included between two given limits.
If $$a$$ and $$b$$ are two real numbers such that $$a\leq b$$, the interval of endpoints $$a$$ and $$b$$ is the segment $$\overline{ab}$$, or, also, the set of numbers included between $$a$$ and $$b$$.
If we consider that the endpoints $$a$$ and $$b$$ belong to the interval, we will say that it is a closed interval and will denote it as $$[a,b]$$.
If $$x$$ is a real number that belongs to $$[a,b]$$, the point that represents $$x$$ on the line is on the right of $$a$$ and on the left of $$b$$; this means that $$a < x < b$$, and since $$a$$ and $$b$$ belong to the interval as well, it is possible that $$x=a$$ or $$x=b$$, so a real number $$x$$ belongs to the closed interval $$[a,b]$$ if $$a \leq x \leq b$$. We will write this algebraic definition in the following way: $$$[a,b]=\{x \in \mathbb{R} | a \leq x \leq b\}$$$
If the endpoints do not belong to the interval, we call it an open interval and we will denote it as $$(a,b)$$. If $$x$$ is a real number that belongs to $$(a,b)$$, it is necessary that $$a < x < b$$, and we will write it in algebraic language as: $$$(a,b)=\{x \in \mathbb{R} | a < x < b\}$$$
If only one of the endpoints belongs to the interval we say that it is a semiopen interval and we will denote it as $$(a,b]$$ or $$[a,b)$$, depending on which endpoint belongs to the interval:
$$$(a,b]=\{x \in \mathbb{R} | a < x \leq b\}$$$ $$$[a,b)=\{x \in \mathbb{R} | a \leq x < b\}$$$
In any kind of interval, $$a$$ is the lower endpoint , and $$b$$ the upper endpoint. And $$|b-a|$$ is the length of the interval.
The point $$C$$ at the same distance from $$a$$ to $$b$$, we will call center of the interval. We will call the distance between the center of the interval and the endpoints the radius .
The center of an interval of endpoints $$a$$ and $$b$$ is the point $$\dfrac{a+b}{2}$$; in fact:
$$$d\Big(a,\dfrac{a+b}{2}\Big)=\Big|\dfrac{a+b}{2}-a\Big|=\Big|\dfrac{a+b-2a}{2}\Big|=\dfrac{b-a}{2}$$$
$$$d\Big(\dfrac{a+b}{2},b\Big)=\Big|b-\dfrac{a+b}{2}\Big|=\Big|\dfrac{2b-a-b}{2}\Big|=\dfrac{b-a}{2}$$$
On the other hand, the points of an interval of endpoints $$a$$ and $$b$$ can be defined in terms of the distance to the center of the interval.
If $$x\in [a,b]$$, the distance of $$x$$ to the center is less than or equal to the radius of the interval, and as $$d(x,C)=|C-x|$$, we have: $$$[a,b]=\{x \in \mathbb{R} \ | \ |C-x|\leq r \}$$$ where $$r$$ represents the radius of the interval $$(r=d(a,b))$$, and, similarly, for open intervals: $$$(a,b)=\{x \in \mathbb{R} \ | \ |C-x| < r \}$$$
To determine the endpoints of an interval given the center and the radius, we apply the properties of the absolute value:
$$$|C-x| < r \Rightarrow |x-C| < r \Rightarrow$$$ $$$-r < x-C < r \Rightarrow -r+C < x < r+C$$$
Therefore the endpoints of an interval of center $$C$$ and radius $$r$$ are $$C-r$$ and $$C+r$$.
The length of an interval is equal to the distance between its two endpoints: $$$long([a,b])=d(a,b)$$$ And as it depends on the endpoints, the length is the same whether the interval is open or closed: $$$long((a,b))=long([a,b])=long((a,b])=long([a,b))$$$
Let's observe that the length of an interval depends on the distance used when calculating it, so, continuing with the previous notation, if we use the p-adic distance to calculate the length of an interval, we will denote it as: $$$long_p((a,b))=d_p(a,b)$$$
The interval $$\Big[\dfrac{1}{3},\dfrac{2}{5}\Big]$$ is a closed interval bounded by lower endpoint $$\dfrac{1}{3}$$ and upper endpoint $$\dfrac{2}{5}$$.
The center of the interval is a point $$C$$: $$$C=\dfrac{a+b}{2}=\dfrac{\dfrac{1}{3}+\dfrac{2}{5}}{2}=\dfrac{5+6}{15\cdot 2}=\dfrac{11}{30}.$$$
And the radius is: $$$d(a,C)=\Big|\dfrac{11}{30}-\dfrac{1}{3}\Big|=\Big|\dfrac{11}{30}-\dfrac{10}{30}\Big|=\dfrac{1}{30}.$$$
The length of this interval is: $$$long\Big(\Big[\dfrac{1}{3},\dfrac{2}{5}\Big]\Big)=d\Big(\dfrac{1}{3},\dfrac{2}{5}\Big)=\Big|\dfrac{1}{3}-\dfrac{2}{5}\Big|=\Big|\dfrac{5-6}{15}\Big|=\dfrac{1}{15}$$$
Unbounded intervals
If we consider an interval that does not have lower endpoint or upper endpoint, we obtain a set of the kind: $$$\{x\in \mathbb{R} \ | \ x \leq b\}, \ \mbox{or} \ \{x\in \mathbb{R} \ | \ a \leq x\} $$$
Graphically, these sets are represented as all those that are on the left of $$b$$, or on the right of $$a$$, respectively.
We call these sets unbounded intervals and to denote them we use the infinity symbol $$\infty$$ as an endpoint. Although $$\infty$$ is not a number, we will use $$-\infty$$ to denote that it is less than any number and $$+\infty$$ to denote that it is greater than any number, in such a way that a lower unbounded interval is denoted by:
$$(-\infty,a)=\{x\in\mathbb{R} \ | \ x < a\}$$
if it is opened, whereas if it is closed:
$$(-\infty,a]=\{x\in\mathbb{R} \ | \ x \leq a\}$$
If the interval does not have upper endpoint, we call it an unbounded upper, and we write it as:
$$(a,+\infty)=\{x\in\mathbb{R} \ | \ a < x\}$$
if it is opened, and
$$[a,+\infty)=\{x\in\mathbb{R} \ | \ a \leq x\}$$
if it is closed.
$$[5, +\infty)=\{x\in\mathbb{R} \ | \ 5 \leq x\}$$
$$\Big(-\infty,\dfrac{\sqrt{2}}{3}\Big)=\Big\{ x \in \mathbb{R} \ \Big| \ \dfrac{\sqrt{2}}{3} < a \Big\}$$