16
$\begingroup$

My understanding is that by definition, the 0-th power of any square matrix is the identity matrix. This is what the mathworld entry for matrix powers and answers to a math.SE question assert.

Yet when I ask Mathematica to compute the 0-th power of a singular matrix,

MatrixPower[{{1, 1}, {1, 1}}, 0]

I get the following error message and the unevaluated input back out.

MatrixPower::sing: Matrix {{1,1},{1,1}} is singular.

Obviously I can fix this by unprotecting MatrixPower and defining:

Unprotect[MatrixPower]
MatrixPower[m_?SquareMatrixQ, 0] := IdentityMatrix[Length[m]]
Protect[MatrixPower]

But I'd like to understand this properly. Is there some reason that a non-singular matrix might be thought not to have a 0-th power? Can someone explain what is going on?

$\endgroup$
3
  • 5
    $\begingroup$ Well, that depends on the definition... what would you say $0^0$ is? $\endgroup$
    – ilian
    Commented Sep 23, 2016 at 20:21
  • 1
    $\begingroup$ Recommend that you use MatrixPower[m_?SquareMatrixQ, 0]:= ... $\endgroup$
    – Bob Hanlon
    Commented Sep 23, 2016 at 22:11
  • $\begingroup$ @BobHanlon Good point. Thank you, and fixed. $\endgroup$
    – Corvus
    Commented Sep 23, 2016 at 22:37

1 Answer 1

17
$\begingroup$

Consider a general $2\times 2$ matrix, and its general power $n$:

f[a_, b_, c_, d_, n_] := FullSimplify @ MatrixPower[{{a, b}, {c, d}}, n]

MatrixForm @ f[a, b, c, d, n]

enter image description here

The denominator is $\sqrt{4bc+(a-d)^2}$, so it looks like there's no problem with it for a matrix like {{1,1},{1,1}}. Let's simplify things:

MatrixForm @ f[1, 1, 1, 1, n]

enter image description here

There's the culprit: for n=0 an indeterminate form $0^0$ occurs, hence the error.

There's no problem with non-singular matrices, e.g.

f[1, 1, 1, 0, 0]

{{1,0},{0,1}}

Finally,

Limit[f[a, b, c, d, n], n -> 0]

and

Limit[f[1, 1, 1, 0, n], n -> 0]

both give

{{1, 0}, {0, 1}}

but

Limit[f[1, 1, 1, 1, n], n -> 0]

{{1/2, 1/2}, {1/2, 1/2}}

$\endgroup$
5
  • 4
    $\begingroup$ Thank you! This makes sense in terms of what Mathematica is trying to do, I guess. But is it correct in doing so? I thought that by definition the 0-th power of any square matrix, including a singular matrix, is the identity matrix of the same size. E.g. from mathworld: mathworld.wolfram.com/MatrixPower.html Or from SE: math.stackexchange.com/questions/699740/… $\endgroup$
    – Corvus
    Commented Sep 23, 2016 at 20:33
  • 3
    $\begingroup$ Oddly, Limit[MatrixPower[{{1, 1}, {1, 1}}, n], n -> 0] evaluates to {{1/2, 1/2}, {1/2, 1/2}} $\endgroup$
    – Bob Hanlon
    Commented Sep 23, 2016 at 21:56
  • 2
    $\begingroup$ @BobHanlon Makes some sense from the point of view of syntax: Limit[0^n + 2^n, n -> 0] seems to take $0^n=0$ and then proceed with the rest of the limit. Can the fact that MatrixPower[{{1, 1}, {1, 1}}, 0] does not return an identity matrix be considered a bug? $\endgroup$
    – corey979
    Commented Sep 23, 2016 at 22:03
  • 3
    $\begingroup$ It's not a bug. $\endgroup$ Commented Sep 25, 2016 at 21:03
  • 1
    $\begingroup$ @DanielLichtblau, it may follow a spec, but it is mathematically weird… Maybe the doc for MatrixPower should be explicit about this? $\endgroup$ Commented May 17, 2023 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.