1
$\begingroup$

Sometimes I will see a function being defined and then something like "... where $k$ $\in$ $[1 : n]$, I gathered that it is something along the lines of between 1 and n but why isn't this just written as $1$ $\le$ $k$ $\le$ $n$?

Thanks

  • 2
    I believe that $k \in [1:n]$ means that $k$ is an **integer** between 1 and $n$, but I am **not** sure.2017-01-09
  • 1
    ...sometimes it is $k \in \{1, 2, \ldots, n\}$2017-01-09
  • 1
    First it's $1 \leq k \leq n$. And second $[1 : n]$ is a way to contract the expression $1 \leq k \leq n$. Different notations, same meaning.2017-01-09
  • 2
    @RSerrao: this is correct, you should post it as an answer. $k\in[1,n]\implies k\in\mathbb{Z}$, while $1\leq k\leq n\implies k\in\mathbb{R}$ unless otherwise explicitly stated.2017-01-09

2 Answers 2

1

The notation $k \in [1:n]$ means that $k$ belongs to the set of integers between $1$ and $n$, i.e. $k \in [1:n] \iff k \in \{1, 2, \cdots, n\}$ and therefore implies that $k$ is an integer. Writing $1 \leq k \leq n$ just means that $k$ is a real number between $1$ and $n$. It could be an integer, a rational, an irrational number. As long as it is greater than $1$ and smaller than $n$.

1

They are synonymous, though $[1,n]$ is the more common notation. I prefer $[1..n]$ myself.

Note that there is some ambiguity in notation, as it is unclear whether these are intervals of real numbers or intervals of integers. Usually this meaning can be determined from context.

$[1:n]$ is a set of numbers, and to say that $k \in [1:n]$ means $k$ belongs to the set with a certain property.

That property is that $1 \le k \le n$.

So one is a set and one is a property. But you can define a set as "all elements with a certain property", and you can define a property as "belongs to this set", so they're equivalent.