This site is supported by donations to The OEIS Foundation.

Iverson bracket

The Iverson bracket, named after Kenneth E. Iverson, is a notation that denotes a number that is 1 if the condition in square brackets is satisfied, and 0 otherwise. More exactly,

$[P] = \begin{cases} 1 & \mbox{if } P \mbox{ is true,} \\ 0 & \mbox{otherwise.} \end{cases} \,$

where $\scriptstyle P \,$ is a predicate (i.e. a [‍first-order logic‍] statement that can be true or false). This notation was introduced by Kenneth E. Iverson in his programming language APL[1][2] (named after the book A Programming Language[3]), while the specific restriction to square brackets was advocated by Donald Knuth to avoid ambiguity in parenthesized logical expressions.[4]

Uses

The notation is useful in expressing sums or integrals without boundary conditions. For example

$\sum_{1 \le i \le 10} i^2 = \sum_{i} i^2 \, [1 \le i \le 10]. \,$

In the first sum, the index $\scriptstyle i \,$ is limited to be in the range 1 to 10. The second sum is allowed to range over all integers, but where $\scriptstyle i \,$ is strictly less than 1 or strictly greater than 10, the summand is 0, contributing nothing to the sum. Such use of the Iverson bracket can permit easier manipulation of these expressions.

Another use of the Iverson bracket is to simplify equations with special cases. For example, the formula

$\sum_{1 \le k \le n \atop (k,n) = 1} \!\! k = \frac{n \, \varphi(n)}{2}, \,$

which is valid only for $\scriptstyle n \,>\, 1, \,$ may be written

$\sum_{1 \le k \le n \atop (k,n) = 1} \!\! k = \frac{n \, (\varphi(n) + [n = 1])}{2}, \,$

which is valid for all positive integers $\scriptstyle n \,$.

Special cases

The Kronecker delta notation is a specific case of Iverson notation when the condition is equality

$\delta_{ij} = [i = j]. \,$

The indicator function $\scriptstyle \mathbf{I}_A(x) \,$ (or characteristic function $\scriptstyle \chi_A(x) \,$) of a set $\scriptstyle A \,$, another specific case, has set membership as its condition

$\mathbf{I}_A(x) = \chi_A(x) = [x \in A]. \,$

The sign function and Heaviside step function are also easily expressed in this notation

$\sgn(x) = [x > 0] - [x < 0], \,$
$H(x) = [x > 0] + \frac{1}{2} [x = 0]. \,$

And the trichotomy of the reals can be expressed

$[a < b] + [a = b] + [a > b] = 1. \,$

Notes

1. Ronald Graham, Donald Knuth, and Oren Patashnik. Concrete Mathematics, Section 2.2: Sums and Recurrences.
2. Graham, Ronald L.; Knuth, Donald E.; Patashnik, Oren (1994). Concrete Mathematics (2nd ed.). Reading, MA: Addison-Wesley Publishing Company. pp. xiii+657. ISBN 0-201-55802-5.
3. Iverson, Kenneth E. (1962). A Programming Language. Wiley. ISBN 0-471-43014-5.
4. Graham, Knuth, and Patashnik (1994).

References

• Donald Knuth, "Two Notes on Notation", American Mathematical Monthly, Volume 99, Number 5, May 1992, pp. 403–422. (TeX, arXiv:math/9205211)
• Kenneth E. Iverson, "A Programming Language", New York: Wiley, p. 11, 1962.