Iverson Bracket
Get Iverson Bracket essential facts below. View Videos or join the Iverson Bracket discussion. Add Iverson Bracket to your PopFlock.com topic list for future reference or share this resource on social media.
Iverson Bracket

In mathematics, the Iverson bracket, named after Kenneth E. Iverson, is a notation that generalises the Kronecker delta, which is the Iverson bracket of the statement x = y. It maps any statement into a function of the free variables in it, that takes the value one for the values of the variables for which the statement is true, and takes the value zero otherwise. It is generally denoted by putting the statement inside square brackets:

${\displaystyle [P]={\begin{cases}1&{\text{if }}P{\text{ is true;}}\\0&{\text{otherwise.}}\end{cases}}}$

In the context of summation, the notation can be used to write any sum as an infinite sum without limits: If ${\displaystyle P(k)}$ is any property of the integer ${\displaystyle k}$,

${\displaystyle \sum _{k}f(k)\,[P(k)]=\sum _{P(k)}f(k).}$

Note that by this convention, a summand ${\displaystyle f(k)[{\textbf {false}}]}$ must evaluate to 0 regardless of whether ${\displaystyle f(k)}$ is defined. Likewise for products:

${\displaystyle \prod _{k}f(k)^{[P(k)]}=\prod _{P(k)}f(k).}$

The notation was originally introduced by Kenneth E. Iverson in his programming language APL,[1][2] though restricted to single relational operators enclosed in parentheses, while the generalisation to arbitrary statements, notational restriction to square brackets, and applications to summation, was advocated by Donald Knuth to avoid ambiguity in parenthesized logical expressions.[3]

## Properties

There is a direct correspondence between arithmetic on Iverson brackets, logic, and set operations. For instance, let A and B be sets and ${\displaystyle P(k_{1},\dots )}$ any property of integers; then we have

{\displaystyle {\begin{aligned}[][P\land Q]&=[P][Q],\qquad [\neg P]=1-[P].\\[1em][P\lor Q]&=[P]+[Q]-[P][Q].\\[1em][k\in A]+[k\in B]&=[k\in A\cup B]+[k\in A\cap B].\\[1em][x\in A\cap B]&=[x\in A][x\in B].\\[1em][\forall m\ .\ P(k,m)]&=\prod _{m}[P(k,m)].\\[1em][\exists m\ .\ P(k,m)]&=\min {\Big (}1,\sum _{m}[P(k,m)]{\Big )}=1-\prod _{m}\left(1-[P(k,m)]\right).\\[1em]\#\{m\mid P(k,m)\}&=\sum _{m}[P(k,m)].\end{aligned}}}

## Examples

The notation allows moving boundary conditions of summations (or integrals) as a separate factor into the summand, freeing up space around the summation operator, but more importantly allowing it to be manipulated algebraically.

### Double-counting rule

We mechanically derive a well-known sum manipulation rule using Iverson brackets:

{\displaystyle {\begin{aligned}\sum _{k\in A}f(k)+\sum _{k\in B}f(k)&=\sum _{k}f(k)\,[k\in A]+\sum _{k}f(k)\,[k\in B]\\&=\sum _{k}f(k)\,([k\in A]+[k\in B])\\&=\sum _{k}f(k)\,([k\in A\cup B]+[k\in A\cap B])\\&=\sum _{k\in A\cup B}f(k)\ +\sum _{k\in A\cap B}f(k).\end{aligned}}}

### Summation interchange

The well-known rule ${\displaystyle \textstyle \sum _{j=1}^{n}\,\sum _{k=1}^{j}f(j,k)=\sum _{k=1}^{n}\,\sum _{j=k}^{n}f(j,k)}$ is likewise easily derived:

{\displaystyle {\begin{aligned}\sum _{j=1}^{n}\,\sum _{k=1}^{j}f(j,k)&=\sum _{j,k}f(j,k)\,[1\leq j\leq n]\,[1\leq k\leq j]\\&=\sum _{j,k}f(j,k)\,[1\leq k\leq j\leq n]\\&=\sum _{j,k}f(j,k)\,[1\leq k\leq n]\,[k\leq j\leq n]\\&=\sum _{k=1}^{n}\,\sum _{j=k}^{n}f(j,k).\end{aligned}}}

### Counting

For instance, the Euler phi function that counts the number of positive integers up to n which are coprime to n can be expressed by

${\displaystyle \phi (n)=\sum _{i=1}^{n}[\gcd(i,n)=1],\qquad {\text{for }}n\in \mathbb {N} ^{+}.}$

### Simplification of special cases

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

${\displaystyle \sum _{1\leq k\leq n \atop \gcd(k,n)=1}\!\!k={\frac {1}{2}}n\varphi (n)}$

is valid for n > 1 but is off by for n = 1. To get an identity valid for all positive integers n (i.e., all values for which ${\displaystyle \phi (n)}$ is defined), a correction term involving the Iverson bracket may be added:

${\displaystyle \sum _{1\leq k\leq n \atop \gcd(k,n)=1}\!\!k={\frac {1}{2}}n(\varphi (n)+[n=1])}$

### Common functions

Many common functions, especially those with a natural piecewise definition, may be expressed in terms of the Iverson bracket. The Kronecker delta notation is a specific case of Iverson notation when the condition is equality. That is,

${\displaystyle \delta _{ij}=[i=j].}$

The indicator function, often denoted ${\displaystyle \mathbf {1} _{A}(x)}$, ${\displaystyle \mathbf {I} _{A}(x)}$ or ${\displaystyle \chi _{A}(x)}$, is an Iverson bracket with set membership as its condition:

${\displaystyle \mathbf {I} _{A}(x)=[x\in A]}$.

The Heaviside step function, sign function,[1] and absolute value function are also easily expressed in this notation:

{\displaystyle {\begin{aligned}H(x)&=[x\geq 0],\\\operatorname {sgn}(x)&=[x>0]-[x<0],\end{aligned}}}

and

{\displaystyle {\begin{aligned}|x|&=x[x>0]-x[x<0]\\&=x([x>0]-[x<0])\\&=x\cdot \operatorname {sgn}(x).\end{aligned}}}

The comparison functions max and min (returning the larger or smaller of two arguments) may be written as

${\displaystyle \max(x,y)=x[x>y]+y[x\leq y]}$ and
${\displaystyle \min(x,y)=x[x\leq y]+y[x>y]}$.

The floor and ceiling functions can be expressed as

${\displaystyle \lfloor x\rfloor =\sum _{n}n\cdot [n\leq x

and

${\displaystyle \lceil x\rceil =\sum _{n}n\cdot [n-1

where the index ${\displaystyle n}$ of summation is understood to range over all the integers.

The ramp function can be expressed

${\displaystyle R(x)=x\cdot [x\geq 0].}$

The trichotomy of the reals is equivalent to the following identity:

${\displaystyle [ab]=1.}$

The Möbius function has the property (and can be defined by recurrence as[4])

${\displaystyle \sum _{d|n}\mu (d)\ =\ [n=1].}$

## Formulation in terms of usual functions

In the 1830s, Guglielmo dalla Sommaja used the expression ${\displaystyle 0^{0^{x}}}$ to represent what now would be written ${\displaystyle [x>0]}$; dalla Sommaja also used variants, such as ${\displaystyle \left(1-0^{0^{-x}}\right)\left(1-0^{0^{x-a}}\right)}$ for ${\displaystyle [0\leq x\leq a]}$.[3] Following one common convention, those quantities are equal where defined: ${\displaystyle 0^{0^{x}}}$ is 1 if x > 0, is 0 if x = 0, and is undefined otherwise.

## References

1. ^ a b Kenneth E. Iverson (1962). A Programming Language. Wiley. p. 11. Retrieved 2016.
2. ^ Ronald Graham, Donald Knuth, and Oren Patashnik. Concrete Mathematics, Section 2.2: Sums and Recurrences.
3. ^ a b Donald Knuth, "Two Notes on Notation", American Mathematical Monthly, Volume 99, Number 5, May 1992, pp. 403-422. (TeX, arXiv:math/9205211).
4. ^ Ronald Graham, Donald Knuth, and Oren Patashnik. Concrete Mathematics, Section 4.9: Phi and Mu.