Samiksha Jaiswal (Editor)

Iverson bracket

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In mathematics, the Iverson bracket, named after Kenneth E. Iverson, is a notation that generalises the Kronecker delta. It converts any logical proposition into a number that is 1 if the proposition is satisfied, and 0 otherwise, and is generally written by putting the proposition inside square brackets:

Contents

[ P ] = { 1 if  P  is true; 0 otherwise,

where P is a statement that can be true or false.

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

k f ( k ) [ P ( k ) ] = P ( k ) f ( k ) .

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

k f ( k ) [ P ( k ) ] = P ( k ) f ( k ) .

The notation was originally introduced by Kenneth E. Iverson in his programming language APL, 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.

Properties

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

[ P Q ] = [ P ] [ Q ] , [ ¬ P ] = 1 [ P ] . [ k A ] + [ k B ] = [ k A B ] + [ k A B ] . [ m   .   P ( k , m ) ] = m [ P ( k , m ) ] . [ m   .   P ( k , m ) ] = min ( 1 , m [ P ( k , m ) ] ) = 1 m ( 1 [ P ( k , m ) ] ) . # { m m   .   P ( k , m ) } = m [ P ( k , m ) ] .

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:

k A f ( k ) + k B f ( k ) = k f ( k ) [ k A ] + k f ( k ) [ k B ] = k f ( k ) ( [ k A ] + [ k B ] ) = k f ( k ) ( [ k A B ] + [ k A B ] ) = k A B f ( k )   + k A B f ( k ) .

Summation interchange

The well-known rule j = 1 n k = 1 j f ( j , k ) = k = 1 n j = k n f ( j , k ) is likewise easily derived:

j = 1 n k = 1 j f ( j , k ) = j , k f ( j , k ) [ 1 j n ] [ 1 k j ] = j , k f ( j , k ) [ 1 k j n ] = j , k f ( j , k ) [ 1 k n ] [ k j n ] = k = 1 n j = k n f ( j , k ) .

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

ϕ ( n ) = i = 1 n [ gcd ( i , n ) = 1 ] , for  n N + .

Simplification of special cases

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

1 k n gcd ( k , n ) = 1 k = 1 2 n φ ( n )

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

1 k n gcd ( k , n ) = 1 k = 1 2 n ( φ ( 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,

δ i j = [ i = j ] .

The indicator function, often denoted 1 A ( x ) , I A ( x ) or χ A ( x ) , is an Iverson bracket with set membership as its condition:

I A ( x ) = [ x A ] .

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

H ( x ) = [ x > 0 ] , sgn ( x ) = [ x > 0 ] [ x < 0 ] ,

and

| x | = x [ x > 0 ] x [ x < 0 ] = x ( [ x > 0 ] [ x < 0 ] ) = x sgn ( x ) .

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

max ( x , y ) = x [ x > y ] + y [ x y ] and min ( x , y ) = x [ x y ] + y [ x > y ] .

The floor and ceiling functions can be expressed as

x = n n [ n x < n + 1 ]

and

x = n n [ n 1 < x n ] ,

where the index n of summation is understood to range over all the integers.

The ramp function can be expressed

R ( x ) = x [ x 0 ] .

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

[ a < b ] + [ a = b ] + [ a > b ] = 1.

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

d | n μ ( d )   =   [ n = 1 ] .

Formulation in terms of usual functions

In the 1830s, Guglielmo Libri Carucci dalla Sommaja used 0 0 x as a replacement for what would now be written [ x > 0 ] , as well as variants such as ( 1 0 0 x ) ( 1 0 0 x a ) for [ 0 x a ] . Indeed, following the usual conventions, those quantities are equal where defined: 0 0 x is 1 if x > 0, 0 if x = 0, and undefined otherwise.

References

Iverson bracket Wikipedia