# linalg::hilbert

Hilbert matrix

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```linalg::hilbert(`n`, <`R`>)
```

## Description

`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.

## Examples

### 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 )`

## Parameters

 `n` The dimension of the matrix: a positive integer `R` The component ring: a domain of category `Cat::Rng`; default: `Dom::ExpressionField``()`

## Return Values

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

## Algorithms

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`).