# hilbert_matrix function

Hilbert matrix of a given size: the entry in row i and column j is 1/(i + j - 1).

## How to write it

### hilbert_matrix(n)

**n**

The number of rows and columns. Takes a whole number.

## Examples

- $\displaystyle \operatorname{hilbert\_matrix}(2) = \begin{pmatrix} 1 & \frac{1}{2} \\ \frac{1}{2} & \frac{1}{3} \end{pmatrix}$

  `hilbert_matrix(2)`

  In the solver, `hilbert_matrix(2)` gives `[[1, 1/2], [1/2, 1/3]]`.

  [Open in the solver](https://hilberon.com/?q=hilbert_matrix%282%29)

## Related functions

- [identity_matrix](https://hilberon.com/library/identity_matrix)

  Identity matrix of a given size.
- [diagonal_matrix](https://hilberon.com/library/diagonal_matrix)

  A matrix with the given list on its diagonal and zeros elsewhere.
- [matrix_exp](https://hilberon.com/library/matrix_exp)

  Exponential of a square matrix.
- [matrix_function](https://hilberon.com/library/matrix_function)

  A function of a square matrix.
- [matrix_log](https://hilberon.com/library/matrix_log)

  Logarithm of a square matrix.
- [matrix_power](https://hilberon.com/library/matrix_power)

  A square matrix to a whole power.

---
Source: https://hilberon.com/library/hilbert_matrix
