Size of an interval Can someone explain to me how I can prove how many elements are there in a given interval? For example, in semi-open interval $[n,m)$, the number of elements in it is equal to $m-n$, and for a closed interval $[n,m]$ it is equal to $m-n+1$?
 A: I’m assuming that $n$ and $m$ are integers, and that you’re counting the integers in these intervals. Suppose that $k$ is an integer. Then $k\in[n,m)$ if and only if $n\le k<m$. Subtract $n-1$ from this inequality to get an equivalent one: $k\in[n,m)$ if and only if $1\le k-(n-1)<m-(n-1)$. In other words, $k\in[n,m)$ exactly when $k-(n-1)$ is one of the integers $1,2,\ldots,m-(n-1)-1$, and there are clearly $m-(n-1)-1=m-n$ of them.
There are really two ideas involved here. First, the map $k\mapsto k-(n-1)$ is a bijection on $\Bbb Z$, so it maps the interval $[n,m)$ to another interval of the same cardinality. And secondly, it’s trivial to count the integers in an interval that starts at $1$. If you’re willing to make the counting just slightly less trivial, you can subtract $n$ instead of $n-1$ and get a nicer inequality: $k\in[n,m)$ if and only if $0\le k-n<m-n$, i.e., if and only if $k-n$ is an integer in the interval $[0,m-n-1]$.
Now see if you can apply the same ideas to the interval $[n,m]$.
