# Matrix power (matrix_power)

A square matrix to a whole power.

## How to write it

### matrix_power(matrix, n)

**matrix**

A square matrix. Takes a matrix, written as a list of rows.

**n**

The power. Takes a whole number.

## Examples

- $\displaystyle \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}^{5} = \begin{pmatrix} 8 & 5 \\ 5 & 3 \end{pmatrix}$

  `matrix_power([[1, 1], [1, 0]], 5)`

  In the solver, `matrix_power([[1, 1], [1, 0]], 5)` gives `[[8, 5], [5, 3]]`.

  [Open in the solver](https://hilberon.com/?q=matrix_power%28%5B%5B1%2C%201%5D%2C%20%5B1%2C%200%5D%5D%2C%205%29)

## Related functions

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

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

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

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

  Identity matrix of a given size.
- [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.

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