Essays/Hilbert Matrix

From J Wiki
Jump to navigation Jump to search

The Hilbert matrix is a square matrix whose (i,j)-th entry is %1+i+j . It is famously ill-conditioned with a very small magnitude determinant.

   H=: % @: >: @: (+/~) @: i.

   H 5
       1      0.5 0.333333     0.25      0.2
     0.5 0.333333     0.25      0.2 0.166667
0.333333     0.25      0.2 0.166667 0.142857
    0.25      0.2 0.166667 0.142857    0.125
     0.2 0.166667 0.142857    0.125 0.111111

   det=: -/ .*

   det H 5
3.7493e_12
   det H 10
2.1644e_53

The problems with numerical inaccuracy for the Hilbert matrix can be avoided by working in the rational domain. The following assertions can be tested:

  • the determinant of the Hilbert is the reciprocal of an integer
  • the Hilbert matrix is invertible
  • the inverse Hilbert matrix has integer entries
  • the sum of the elements of the inverse Hilbert matrix of order n is n^2
   H 5x
  1 1r2 1r3 1r4 1r5
1r2 1r3 1r4 1r5 1r6
1r3 1r4 1r5 1r6 1r7
1r4 1r5 1r6 1r7 1r8
1r5 1r6 1r7 1r8 1r9

   det H 5x
1r266716800000
   det H 10x
1r46206893947914691316295628839036278726983680000000000

   %. H 5x
   25   _300    1050   _1400    630
 _300   4800  _18900   26880 _12600
 1050 _18900   79380 _117600  56700
_1400  26880 _117600  179200 _88200
  630 _12600   56700  _88200  44100

   +/ , %. H 5x
25

The reciprocal of the determinant is an integer. It is natural to factor an integer as investigation into its nature.

   q: % det H 10x
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 ...
   ~. q: % det H 10x
2 3 5 7 11 13 17 19

   ~. q: % det H 11x
2 3 5 7 11 13 17 19
   ~. q: % det H 12x
2 3 5 7 11 13 17 19 23
   ~. q: % det H 13x
2 3 5 7 11 13 17 19 23
   ~. q: % det H 14x
2 3 5 7 11 13 17 19 23
   ~. q: % det H 15x
2 3 5 7 11 13 17 19 23 29

   ~. q: % det H 30x
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59

The unique prime factors of the reciprocal determinant of the Hilbert matrix of order n , are the primes less than 2*n .

The verb hid implements the formula in OEIS A005249.

hid=: 3 : 0  NB. Hilbert matrix inverse determinant
 k=. i.&.<: n=. x: y
 (^~n) * ((n -&*: k)^(n-k)) %&(*/) *:!k
)

   hid 10
46206893947914691316295628839036278726983680000000000
   % det H 10x
46206893947914691316295628839036278726983680000000000

   0j_10 ": hid 100
2.9673293970e5941

The permanent of the inverse Hilbert matrix is OEIS A111194.

   perm=: +/ .*

   perm %. H 5x
4855173934730716800000



See also


Contributed by Roger Hui.