J Labs

Binomial Coefficients

(1 of 6) TABLE OR MATRIX

The expression k ! n produces the kth binomial coefficient of order n, and the function bc=: i. !/ i. may be used to produce a table or matrix of binomial coefficients. For example:


In [ ]:
0!5

In [ ]:
1!5

In [ ]:
2!5

In [ ]:
bc=: i. !/ i.

In [ ]:
bc 6

(2 of 6) TABLE OR MATRIX (ctd)

Such a matrix can be used in a variety of interesting ways. For example, its inverse is the matrix of alternating binomials, and its matrix product with a vector of polynomial coefficients (with powers in ascending order) produces the coresponding "expanded" coefficients. For example:


In [ ]:
bct=: bc 6

In [ ]:
bct

In [ ]:
abct=: %. bct

In [ ]:
abct

In [ ]:
X=: +/ . *          NB. The matrix product function

In [ ]:
bct X abct

In [ ]:
c=: 5 1 4 0 2 2

In [ ]:
d=: bct X c

In [ ]:
x=: 0 1 2 3 4 5 6 7

In [ ]:
c p. x              NB. The polynomial with coefficients c

In [ ]:
d p. x

In [ ]:
c p. x+1

(3 of 6) TABLE OR MATRIX (ctd)

The alternating binomial coefficients can be used to produce the inverse of expansion. For example:


In [ ]:
abct X d

In [ ]:
c

In [ ]:
c=abct X d

(4 of 6) MANUAL METHODS OF EXPANSION

If the vector c is written as a column to the right of the matrix bct, the product bct X c is easily computed by hand. Moreover, such computation may be less prone to error than commonly used methods. Try the experiment of expanding the vector c by by this method and by any others you may know.

Finally, it is easy to jot down the table bct of any order, because each row is obtained from the preceding row by adding it to a shift of itself.

It may also be interesting to compute the sums of the columns of bct and abct (+/ bct and +/ abct), particularly since the result of the latter is commonly mis-stated.

(5 of 6) IDENTITIES

It is clear that the product bct X bct contains sums over products of various binomial coefficients. If, therefore, one could spot and articulate the pattern of the elements of the result, it could be used to state a host of identities, provided that the pattern holds for larger tables.

Try to state the pattern in the following results:


In [ ]:
bct X bct

In [ ]:
bct X bct X bct

In [ ]:
bct X bct X bct

In [ ]:
bct X bct X bct X bct

(6 of 6) IDENTITIES (ctd)

Using the fact that M % N denotes the element-by-element division of the matrix M by the matrix N, and the fact that 0%0 is defined to be 0, try to discern the pattern in the following results:


In [ ]:
(bct X bct) % bct

In [ ]:
(bct X bct X bct) % bct

In [ ]:
(bct X bct X bct) % bct

In [ ]:
(bct X bct X bct X bct) % bct

End of Lab


In [ ]: