Skip to content

pascal

Pascal matrix — symmetric matrix of binomial coefficients.

A = pascal(n)
A = pascal(n, type)

Returns the n×n symmetric Pascal matrix whose entries are binomial coefficients: A(i, j) = C(i+j-2, i-1). The first row and column are all ones; each interior entry is the sum of the entry above and the entry to the left.

The type argument is reserved for future variants (lower-triangular, transposed); only type = 0 (default symmetric) is currently implemented.

pascal(4) % [1 1 1 1; 1 2 3 4; 1 3 6 10; 1 4 10 20]
sum(pascal(5)) % cumulative diagonal pattern
  • magic — Magic square — square matrix where every row, column, and diagonal sums to the same value.
  • eye — Identity matrix.