Question: Matrix determinant

I originally was trying to verify that the determinant of an nxn matrix of binomial coefficients is zero if n is a multiple of 6. A description of the coefficients is shown in my program below under Row 1, Row 2 etc, using the old fashioned notation for binomial coefficients nCr=n!/r!/(n-r)!    I came across this in the interesting book 'Single Digits: in praise of small numbers' by Marc Chamberland. page 167.

   My pathetic attempt is below.  I tried to create a 5 x 5 matrix of binomial coeffs.  There is a procedure shft which attempts to create the rows of the matrix: the rows are just shifted along.  I've been successful in obtaining two rows, then after that gave up:-(  Thinking I'd try something easier, I thought I'd find the determinant of the matrix using the determinant command in the linear algebra package - without success.

  Any help would be most appreciated. 

 

 restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Matrix program - intro to learn matrices

# The proc shft shifts the elements of an array one to the right and the

# first becomes the last

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

#with(linalg);

with(LinearAlgebra);

#a:=array([1, 2, 3, 4, 5]);

#Row 1   1 nC1  nC2  nC3…    …nC(n-1)

#Row 2   nC(n-1)  1  nC1…      …nC(n-2)

#Row 3  nC(n-2)  nC(n-1)  1…  …nC(n-3)

#...

#Row n  nC1  nC2 nC3…        …1

n:=5:

a:=array([seq(binomial(n,i), i=0..n-1)]);

acopy:=array([seq(binomial(n,i), i=0..n-1)]);

 

#shift := (f::procedure) -> ( x->f(x+1) ):

#shift(a[1]);

shft := proc(a::array)

local i, b::array:

global n:

#printf("n=%d\n",n);

for i from 1 to n do

#printf("n=%d\n",n);

b[i]:=a[i]:

end do:

#nn:=n-1:

for i from 1 to n-1 do

if i<>n-1 then

a[i+1]:=b[i]:

      else

a[1]:=a[5]:

a[n]:=b[n-1]:

end if:

printf("In loop a[%d}=%5.3f\n", i, a[i]);

end do:

end proc:

 

shft(a);

for i from 1 to n do

#printf("n=%d\n",n);

   bnew[i]:=a[i];

printf("bnew[%d]=%d\n",i,bnew[i]);

end do:

bmatrix:=array(1,n,[seq(bnew[i], i=1..n)]);

 

#for m from 2 to n do

   #shft([seq(bmatrix[1,kk], kk=1..m)],[seq(bmatrix[1, k], k=1..n-m)]);

    shft(bmatrix);

printf("In for loop:  bnew[%d}=%5.3f\n", m, bnew[m]);

#end do:

#s:={seq((1,j)=eval(A[1,j]), j=1..n), (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

s:={(1,1)=1,(1,2)=5,(1,3)=10,(1,4)=10,(1,5)=5, (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

 

SSs:=Matrix(5,5,s);

determinant(SSs);

simplify(evalf @(determinant(SSs)));

Determinant(SSs,method=float);

 

#A := Matrix(2,2,[[9,9],[1,2]]);

print(`Printing matrix`);

#A[3,3]:=1;

A := Matrix(m,5,[[seq(acopy[i], i=1..5)],[seq(bnew[j], j=1..5)]]);

#end do;

for i from 1 to n do

  printf("a[%d}=%5.3f\n", i, a[i]);

end do:

 

Please Wait...