# Identity matrix (identity_matrix)

Identity matrix of a given size.

## How to write it

### identity_matrix(n)

**n**

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

## Examples

- $\displaystyle \operatorname{identity\_matrix}(3) = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}$

  `identity_matrix(3)`

  In the solver, `identity_matrix(3)` gives `[[1, 0, 0], [0, 1, 0], [0, 0, 1]]`.

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

## Related functions

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

  Hilbert matrix of a given size: the entry in row i and column j is 1/(i + j - 1).
- [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/identity_matrix
