Matrix powers repeat a square matrix's multiplication with itself. They are different from raising every array element to a power, and the zero and negative exponents have their own matrix meanings. A small triangular example makes the distinction visible before any interpretation involving repeated transitions or observations is attached to the calculation.
The NumPy 2.3 matrix_power documentation accepts an integer exponent and square matrix input. For positive integers, it uses matrix multiplications and repeated squaring. A regular ndarray expression A raised to an integer instead applies elementwise power, so the spelling of the operation is part of the numeric definition.
Let fictional A have rows one, one and zero, one. Matrix multiplication gives A squared with rows one, two and zero, one. Multiplying by A again gives A cubed with rows one, three and zero, one. The upper-right entry changes because the matrix product adds contributions from a shared row-column index.

Every entry of the fictional A is zero or one. Cubing each entry separately therefore leaves that array unchanged. Its upper-right entry stays one, whereas the upper-right entry of the matrix cube is three. The two operations return the same two-by-two shape but different numeric values.
Equal output shape is not enough to verify which operation was performed. Nor is one agreeing diagonal entry enough, because both operations happen to preserve the unit diagonal in this example. A transparent check includes an entry whose calculation exposes the shared-index sum.
Applying the matrix to a fictional column vector gives another check. If that vector has entries p and q, one multiplication by A produces p plus q and q. A second multiplication produces p plus twice q and q, and a third produces p plus three times q and q. Starting with two and three therefore yields eleven and three after three applications. Multiplying once by the elementwise-cubed array would instead yield five and three. This checks repeated application to a vector without interpreting p or q as a measured quantity, and it exposes why the two power operations are not interchangeable.
The documented zero-power result is an identity matrix of the same matrix shape. For the fictional example, that is one, zero in the first row and zero, one in the second. It is not an array of all ones. The identity is the neutral element for matrix multiplication, which is the operation being repeated.
This convention applies without requiring an inverse because no negative power is requested. A singular square matrix can therefore have a defined zero-power result under the interface even though its negative powers cannot be obtained through inversion. Zero exponent and invertibility are separate questions.

For negative integers, the interface computes the inverse and raises it to the corresponding positive exponent. The fictional A inverse has rows one, minus one and zero, one. Multiplying A by that matrix produces the identity, which directly checks the inverse claim.
A matrix that cannot be inverted numerically is a different case: the routine raises a linear-algebra error for a requested negative power. It does not define a negative matrix power by taking a reciprocal of each individual element. That would be especially misleading for the zero entry in the fictional matrix.
The original NumPy implementation has direct cases for small exponents and a binary-decomposition loop for larger ones. It successively squares a matrix and includes selected powers according to the exponent's binary digits. This reduces repeated work relative to multiplying by A once for every step.
For the integer thirteen, the relevant powers are one, four and eight because thirteen is eight plus four plus one. Combining A, A to the fourth and A to the eighth gives A to the thirteenth. Powers of this same matrix can be combined in that way without claiming that unrelated matrices commute.
For the triangular fictional A, the resulting thirteenth power has upper-right entry thirteen. This provides another simple arithmetic check of the repeated-product interpretation. It is not a timing benchmark, a model of thirteen real events or a statement about numerical stability for every matrix.
Preserve input dtype, matrix shape and the integer exponent in a reproducible note. Positive integer products can still be affected by finite numeric representation, while inversion introduces its own numerical considerations. Related material appears in the statistical computation section and the technical article archive.