Overview
- A Hilbert matrix is an nxn matrix whose elements are given by eij = 1/i+j-1.
- The elements of the Hilbert matrix are Unit fractions. For example, if n=3, the Hilbert matrix is
(1 1/2 1/3
1/2 1/3 1/4
1/3 1/4 1/5)
- Unit fractions have one as their numerator. Unit fractions are of the form 1/n where n is an integer.
- Hilbert matrices have several interesting properties
- They are square matrices and symmetrical.
- Their inverses contain all integer elements
- The anti-diagonal of any Hilbert matrix are constants. i.e, The elements of the anti-diagonal will have the same values.
- Hilbert matrices are ill-conditioned matrices whose condition numbers are very large. A large condition number means a small change in the input to the system of linear equations as represented by a matrix will result in larger changes in the output.
- Hilbert matrices are used in image processing to obtain gray scale images. They are used in cryptography and security applications.
Example
# Example Python program that creates a Hilbert matrix
# using the function hilbert() from the scipy.linalg module
import scipy.linalg as sclg
# A Hilbert matrix of size 6x6
hilbertMatrix = sclg.hilbert(6)
print("Hilbert matrix:")
print(hilbertMatrix)Output
Hilbert matrix:
[[1. 0.5 0.33333333 0.25 0.2 0.16666667]
[0.5 0.33333333 0.25 0.2 0.16666667 0.14285714]
[0.33333333 0.25 0.2 0.16666667 0.14285714 0.125 ]
[0.25 0.2 0.16666667 0.14285714 0.125 0.11111111]
[0.2 0.16666667 0.14285714 0.125 0.11111111 0.1 ]
[0.16666667 0.14285714 0.125 0.11111111 0.1 0.09090909]]