This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Hilbert matrix

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


linalg::hilbert(n, <R>)


linalg::hilbert(n) returns the n×n Hilbert matrix H = (hi, j)1 ≤ im, 1 ≤ jn defined by .

The entries of Hilbert matrices are rational numbers. Note, however, that the returned matrix is not defined over the component domain Dom::Rational, but over the standard component domain Dom::ExpressionField(). Thus, no conversion is necessary when working with other functions that expect or return matrices over that component domain.

Use linalg::hilbert(n, Dom::Rational) to define the n×n Hilbert matrix over the field of rational numbers.


Example 1

We construct the 3×3 Hilbert matrix:

H := linalg::hilbert(3)

This is a matrix of the domain Dom::Matrix().

If you prefer a different component ring, the matrix may be converted to the desired domain after construction (see coerce, for example). Alternatively, one can specify the component ring when creating the Hilbert matrix. For example, specification of the domain Dom::Float generates floating-point entries:

H := linalg::hilbert(3, Dom::Float)

domtype( H )



The dimension of the matrix: a positive integer


The component ring: a domain of category Cat::Rng; default: Dom::ExpressionField()

Return Values

n×n matrix of the domain Dom::Matrix(R).


Hilbert matrices are symmetric and positive definite.

Hilbert matrices of large dimension are notoriously ill-conditioned challenging any numerical inversion scheme. However, their inverse can also be computed by a closed formula (see linalg::invhilbert).

Was this topic helpful?