Suppose I have a function $f(x) = A^n$ where $A$ is a square matrix, $x$ is a positive real scalar, and $n$ is a natural number.

I would like to calculate the derivative of $f$ with respect to $x$ (each entry in $A$ is a function of $x$).

Is there a simple formula for this in general or do I need to know what $n$ is and use the product rule?

I found this, but I don't understand it (in particular I don't understand what $DS(A)$ or $S(A)$ means).

edit: Each entry in $A$ is differentiable.

  • $\begingroup$ the derivative is zero since $f(x)$ is constant. $\endgroup$ – Tsemo Aristide Oct 9 '17 at 20:51
  • $\begingroup$ Why would $f(x)$ be constant? Each entry in $A$ is a function of $x$ $\endgroup$ – HXSP1947 Oct 9 '17 at 20:53
  • 4
    $\begingroup$ The product rule applies to matrix multiplication, with the caveat that you can't reorder products. Thus $\frac d{dx}(A^n)=\sum_{k=1}^n A^{k-1}(\frac d{dx}A)A^{n-k}$. $\endgroup$ – stewbasic Oct 9 '17 at 20:56
  • $\begingroup$ Possible duplicate of Is there a general form for the derivative of a matrix to a power? $\endgroup$ – mfl Oct 8 '18 at 19:20

There are two cases.

Case 1. $A$ is diagonalizable and you know explicitly $D$ diagonal, $P$ invertible s.t. $A^n=PD^nP^{-1}$.

Then $(A^n)'=P'D^nP^{-1}+nPD^{n-1}D'P^{-1}-PD^nP^{-1}P'P^{-1}$.

Case 2. Otherwise

$(A^n)'=A'A^{n-1}+AA'A^{n-2}+\cdots+A^{n-1}A'$ (sum of $n$ matrices) where $A'=[{a_{i,j}}']$.

There are no simplifications.


In general, taking square matrices to integer powers is done by finding diagonal matrix $D$ and matrices $P$ and $P^{-1}$ such that $A=P^{-1}DP$.

This is because $A^n=P^{-1}D^nP$, and because $D$ is diagonal, one can simply raise each element of $D$ to the $n$ to get $D^n$. This way, we can relatively easily find a closed form for $A^n$.

If all entries of $A$ are differentiable, it should be easy to differentiate once you have this closed form of $A^n$.

This said, it may be very hard to find the eigenvalues of this function-valued matrix to find $P$ and $D$.

If $A$ be an $m\times m$ matrix: To find $P$ and $D$, first find $m$ linearly independent eigenvalues $\lambda_1, \lambda_2, \cdots, \lambda_m$ and corresponding eigenvectors $v_1, v_2, \cdots, v_m$. $P$ is the matrix $[v_1, v_2, \cdots, v_m]$ and $D=I\begin{bmatrix}\lambda_1\\\lambda_2\\\vdots\\\lambda_m\end{bmatrix}$.

  • 1
    $\begingroup$ The issue here is that even when the matrix $A$ is diagonalizable, $P$ and $D$ are not pleasant functions of the entries of $A$, even in the simplest case when $A$ has a full set of distinct eigenvalues. @stewbasic's formula will be better in practice for moderate $n$. $\endgroup$ – user7530 Oct 10 '17 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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