MatrixCalc

Matrix power calculator

Raise a square matrix to an integer power — A², A⁵, A¹⁰ — by repeated multiplication, with every intermediate product shown. Includes A⁰ = I and the reason negative powers need the inverse.

Matrix A
rows: 3
cols: 3
Matrix B
rows: 3
cols: 3
Operations
n (integer ≥ 0):

By default n is capped at 50 for performance.

Result
Pick an operation to see the result here. Errors will show up in this area.

Tips: adjust sizes (max 50×50). For A×B, cols(A)=rows(B). det/inverse/trace/power require square matrices.

React, Tailwind & shadcn/ui. No external math deps. — English

Aⁿ means multiplying A by itself n times. Set the exponent above, press A^n, and the result appears; the steps panel shows each intermediate product, which is usually what you need when checking work by hand.

What powers are used for

Only square matrices can be raised to a power — A·A requires the columns of A to match its own rows. The operation shows up wherever a process repeats: in a Markov chain, if P holds the transition probabilities for one step, then Pⁿ holds them for n steps, and the entry in row i, column j is the probability of moving from state i to state j in exactly n moves.

Adjacency matrices work the same way. If A records which vertices of a graph are connected, the entry (i, j) of Aⁿ counts the walks of length n from i to j. Two conventions catch people out: A⁰ is the identity matrix, not a matrix of zeros, and A¹ is A itself.

Worked example

11
01
² =
12
01
, and generally Aⁿ =
1n
01

Squaring is not entrywise: the top-right entry is 1·1 + 1·1 = 2, not 1² = 1. The calculator uses exponentiation by squaring, so A¹⁶ costs four multiplications rather than fifteen — the reason a large exponent returns as quickly as a small one.

Common mistakes

  • Raising each entry to the power. A² is A·A, not the matrix of squared entries. The two agree only for diagonal matrices.
  • Assuming (A·B)ⁿ = Aⁿ·Bⁿ. True only when A and B commute, which is rare.
  • Expecting A⁰ to be zero. It is the identity, by the same convention that makes x⁰ = 1.
  • Asking for a negative power of a singular matrix. A⁻ⁿ means (A⁻¹)ⁿ, so it exists only when the inverse does.

Frequently asked questions

Can I raise a non-square matrix to a power?
No. A·A is only defined when the number of columns matches the number of rows, which forces the matrix to be square.
What is A to the power of zero?
The identity matrix of the same size — ones on the diagonal, zeros elsewhere.
How do I compute a negative power?
Invert the matrix first, then raise the inverse to the positive power: A⁻³ = (A⁻¹)³. If the determinant is zero there is no inverse and no negative power.
Is there a shortcut for very large exponents?
Diagonalise the matrix. If A = P·D·P⁻¹ with D diagonal, then Aⁿ = P·Dⁿ·P⁻¹, and raising a diagonal matrix to a power just raises each diagonal entry. Start from the eigenvalues.

Want the full explanation? Read the guide: How matrix multiplication works

Other calculators