How to calculate $f'(t)$, where $f:I\to\mathbb{R}^{n^2}$ is given by $f(t)=X(t)^k$? Let $I$ be a interval, $\mathbb{R}^{n^2}$ be the set of all $n\times n$ matrices and $X:I \to\mathbb{R}^{n^2}$ be a differentiable function. Given $k\in\mathbb{N}$, define $f:I\to\mathbb{R}^{n^2}$ by $f(t)=X(t)^k$. How to calculate $f'(t)$ for all $t\in I$?
Thanks.
 A: 
$$f'(t)=\sum_{k=1}^nX(t)^{k-1}X'(t)X(t)^{n-k}$$

Proof: Compute $X(t+h)^k-X(t)^k$ using the Ansatz $X(t+h)\approx X(t)+hX'(t)$.
A: Here's how I would proceed:  first, note that for matrix products $A(t)B(t)$, we have a generalized Leibniz rule for derivatives, viz.,
$(A(t)B(t))' = A'(t)B(t) + A(t)B'(t)$;
this is in fact quite easy to prove by looking at the  formula for the $ij$ entry of $AB$ (from here on out I'm dropping the explicit functional notation $A(t)$ etc. in favor of the implicit usage; thus $A(t)$ becomes simply $A$ and so forth):
$(AB)_{ij} = \sum_k A_{ik} B_{kj}$,
and then taking $t$-derivatives:
$(AB)'_{ij} = \sum_k (A'_{ik}B_{kj} + A_{ik}B'_{kj})$,
and now the right-hand side is easily seen to be
$(A'B)_{ij} + (AB')_{ij}$,
thus establishing the requisite formula
$(AB)' = A'B + AB'$.
The rest is a simple induction on $k$, starting with
$(X^2)' = X'X + XX'$,
which itself follows from our formula for $(AB)'$.  Making the inductive hypothesis that
$(X^k)' = X'X^{k-1} + XX'X^{k - 2} + . . . + X^{k - 1}X'$,
and noting that the Leibniz rule implies
$(X^{k + 1})' = X'X^k + X(X^k)'$,
then using the previous formula yields
$(X^{k + 1})' = X'X^k + XX'X^{k - 1} + X^2X'X^{k - 2} + . . . + X^kX'$,
the general term being of the form $X^lX'X^{k - l}$, $0 \le l \le k$.  It is easily seen that, based on this induction, that the general form of the solution is
$(X^n)' = \sum_{l = 0}^{l = n - 1}X^lX'X^{n - l - 1}$,
which holds for $n \ge 2$.  Since we can't assume $XX' = X'X$, that's as far as it goes.  This general formula, incidentally, is quite widely used.  I have spoken . . . er, I mean, written . . . that is to say, typed.  With one finger, on my 'droid . . . ;)
