# $\sin(A)$, where $A$ is a matrix

If $A$ is an $n\times n$ matrix with elements $a_{ij}$ $i=$i'th row, $j=$j'th column. Then $e^A$ is also a matrix as can be seen by expanding it in a power series.Is $e^A$ always convergent and defined for any $n\times n$ matrix? What are the elements $e^A_{ij}$ in terms of $a_{ij}$ ?

$\sin(x)$ for real numbers $x$ can be interpreted easily geometrically by looking at the unit circle. Is there any geometrical interpretation of $\sin(A)$ when $A$ is a matrix? What applications does it have?

Is $\sin(A)$ periodic in any sense, i.e. is there a matrix $B$ not $0$ such that $\sin(A+B)=\sin(A)$ for all matrices $A$?
Does $\sin(A)^2+\cos(A)^2=I$ hold?

And do all the regular rules from algebra transfer, i.e. $e^Ae^B=e^{(A+B)}$ ?
Is there a consistent definition of $M/N$ for matrices $M,N$, such that $e^A/e^B=e^{(A-B)}$ holds?

-
While not geometrical there is one more useful property besides $\small \sin(A)^2+\cos(A)^2= I$ . If you need for one demonstration commuting matrices then $\small \sin(A)$ and $\small \cos(A)$ provide such commuting matrices. Clearly, if you have $\small B = P D P^{-1}$ and $\small C=P E P^{-1}$ where D and E are arbitrary diagonal matrices, then B and C commute as well, and is easier to see and usually to implement - but you need an invertible matrix P first, and with the sin/cos-method the commuting matrices look quite random and innocent... –  Gottfried Helms Nov 10 '11 at 6:46

First, there is no nice direct formula for the entries of the matrix exponential. It gets quite complicated to compute for non-diagonalizable matrices.

Pick your favorite analytic function: $f(x) = \sum\limits_{j=0}^\infty a_jx^j$. Let $A$ be an $n \times n$ matrix and let $\|A\|=\max\limits_{1 \leq i,j \leq n} |a_{ij}|$.

It's not hard to show that $\|A^j\| \leq \|A\|^j$. Thus $\|\sum_{j=0}^k a_jA^j\| \leq \sum_{j=0}^k |a_j|\|A\|^j$ and so if $f(\|A\|) =\sum\limits_{j=0}^\infty a_j\|A\|^j$ is absolutely convergent, then the series for $f(A)=\sum\limits_{j=0}^\infty a_jA^j$ is convergent.

Now we know that the series for $\sin$, $\cos$, $\exp$ are absolutely convergent everywhere, so $\sin(A)$, $\cos(A)$, $e^A$ are defined for all square matrices.

If you only deal with diagonalizable matrices, then life is much simpler. Suppose $P^{-1}AP=D=\mathrm{diag}(\lambda_1,\dots,\lambda_n)$. The given (any) function $f(x)$, you can define $$f(D) = \begin{pmatrix} f(\lambda_1) & 0 & \cdots & 0 \\ 0 & f(\lambda_2) & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & f(\lambda_n) \end{pmatrix}$$ Then define $f(A)=Pf(D)P^{-1}$.

For diagonalizable matrices this definition gives the same results as the series definition for sin, cos, and exp. But it also allows you to define $\sqrt{A}$ (when all eigenvalues are non-negative) and many other such matrix functions.

$\sin^2(A)+\cos^2(A)=I_n$ for diagonalizable matrices. I also think it holds in general, but I can't think of a proof right now.

Functions of matrices are quite important. The matrix exponential appears all over mathematics. It connects Lie algebras and Lie groups. I'm not aware of any obvious uses or geometric interpretation for matrix sine and cosine. I have seen the square root of a matrix appear several times in the context of numerical linear algebra.

-
To conclude that the pythagorean relation works for all matrices you can use the fact that diagonalizable matrices are dense in the space of all complex matrices, and use continuity, or observe that the identity $\sin^2t+\cos^2t=1$ is in fact an identity of formal series, so that it more or less holds in every context where everything appeating in it makes sense (this can be made precise...) –  Mariano Suárez-Alvarez Nov 8 '11 at 22:12
@MarianoSuárez-Alvarez thanks! I left my office and realized that as I got into my car to drive home. –  Bill Cook Nov 8 '11 at 22:27

Yes, $e^A$ always converges for a square matrix $A.$ In practice, $e^A$ is found by writing the Jordan normal form of $A,$ let us call it $J,$ with a basis of characteristic vectors for $A$ written as the columns of another matrix, call it $P.$ Then we have $$J = P^{-1} A \; P.$$ It is possible that $J$ is diagonal, and this is guaranteed if the eigenvalues of $A$ are distinct. Otherwise, there are a few 1's in the diagonal immediately above the main diagonal of $J.$

Oh, before I forget, $$\sin x = \frac{e^{ix}- e^{-ix}}{2 i}$$ and the same formula gives you $\sin A.$

Meanwhile, it is not difficult to find $e^J$ as $J$ is diagonal or, at least, in Jordan form, and the matrix with only the diagonal elements of $J$ commutes with the matrix that has only the off-diagonal elements of $J.$ Then, finally, we use the identity $$e^A = e^{P J P^{-1}} = P \; e^J P^{-1}$$ which follows easily from formal properties of the defining power series.

EDIT: the fundamental fact of life is that, IF $A,B$ commute, then $e^{A+B} = e^A e^B = e^B e^A.$ If $A,B$ do not commute there is no assurance. Meanwhile, for the identity matrix $I$ and a real or complex number $z,$ we do get $e^{zI} = e^z I.$ Put that together, you get $e^{A + 2 \pi i I} = e^A.$ Also, $e^{0I} = I,$ and $e^{-A} = \left( e^A \right)^{-1}.$

-
Is that really how one computes $\exp A$ in practice? –  Mariano Suárez-Alvarez Nov 8 '11 at 22:09
Mariano, I have trained a crew of gerbils to do this. I can understand that other people might use different methods. Once a gerbil understands Jordan normal form, you see the light shine in its tiny little eyes. –  Will Jagy Nov 8 '11 at 22:12
The image of you and the little gerbils with shiny eyes and coffee have had bad consequences on my keyboard! –  Mariano Suárez-Alvarez Nov 8 '11 at 22:13
proofwiki.org/wiki/Putzer_Algorithm_for_Matrix_Exponentials Putzer's Algorithm is popular and probably less trouble than computing the Jordan form...unless you've already got the gerbils :) –  Bill Cook Nov 8 '11 at 22:26
Isn't $2\pi i$ the period for $\exp$ instead of $2\pi$? –  Ｊ. Ｍ. Nov 8 '11 at 22:59

Yes, $e^A$ is always convergent and well-defined. Let $a = \max_{i,j} \{ | a_{i,j}| \}$. Then the maximum possible value of any entry of $A^k$ is $a^k n^{k-1}$ (I'll leave the proof of this to the reader). This increases by at most a constant factor of $an$ for each term in the power series expansion of $e^A$, while the $k!$ term in the denominator decreases by $k$, an increasing amount. It is not difficult to show that the power series therefore must converge. The elements of $e^A$ however are not so easy to determine, unless $A$ is diagonalizable.

As far as I know, $\sin (A)$ has no geometric interpretation.

-

To extend Bill's answer: as I mentioned here, one can use the Jordan decomposition instead of the eigendecomposition when computing the sine of a matrix (or a cosine, or any matrix function, really). One thus needs a method for computing the sine for scalars and Jordan blocks; for the Jordan block

$$\mathbf J=\begin{pmatrix}\lambda&1&&\\&\lambda&\ddots&\\&&\ddots&1\\&&&\lambda\end{pmatrix}$$

with (algebraic) multiplicity $k$ (i.e., $\mathbf J$ is a $k\times k$ matrix), the applicable formula is

$$f(\mathbf J)=\begin{pmatrix}f(\lambda)&f^\prime(\lambda)&\cdots&\frac{f^{(k-1)}(\lambda)}{(k-1)!}\\&f(\lambda)&\ddots&\vdots\\&&\ddots&f^\prime(\lambda)\\&&&f(\lambda)\end{pmatrix}$$

(see here for a proof). Since we have the neat chain of derivatives

$$\sin^{(p)}(x)=\begin{cases}\sin\,x&\text{if }p\bmod 4=0\\\cos\,x&\text{if }p\bmod 4=1\\-\sin\,x&\text{if }p\bmod 4=2\\-\cos\,x&\text{if }p\bmod 4=3\end{cases}$$

or more simply, $\sin^{(p)}(x)=\sin\left(x+p\frac{\pi}{2}\right)$, it is quite easy to compute the sine of a Jordan block.

In inexact arithmetic, the Jordan decomposition is exceedingly difficult to compute stably. One has to employ different methods in this case. One way is to replace the Jordan decomposition with a Schur decomposition; there is a method due to Beresford Parlett for computing matrix functions for general triangular matrices, but I won't discuss that further, and instead concentrate on a different evaluation method. The key is that the sine and cosine satisfy a neat duplication formula:

\begin{align*}\sin\,2x&=2\sin\,x\cos\,x\\\cos\,2x&=2\cos^2 x-1\end{align*}

Thus, just as in the scalar case, one can employ argument reduction: halve the matrix a sufficient number of times until its norm is tiny (and remember the number of times $m$ this halving was done), evaluate some good approximation for sine and cosine at that transformed matrix (either truncated Maclaurin series or Padé does nicely, with a slight edge for Padé approximants), and finally apply the two duplication formulae in tandem $m$ times to arrive at the sine and cosine of the starting matrix. This has more details.

Nick Higham discusses quite a lot on these methods in his book; see that chapter I linked to and the references therein.

-

## First version of the answer

Let $A$ be an $n$ by $n$ complex matrix, let $$M(X)=\prod\ (X-\lambda_j)^{m_j}\ \in\mathbb C[X]$$ be its minimal polynomial (the $\lambda_j$ being distinct and the $m_j$ positive), let $U\subset\mathbb C$ be an open set containing the $\lambda_j$, let $B$ be the $\mathbb C[X]$-algebra of holomorphic functions on $U$.

Then there is a unique continuous $\mathbb C[X]$-algebra morphism from $B$ to $\mathbb C[A]$.

Denote it by $f\mapsto f(A)$.

For each $f$ in $B$, there is a unique polynomial $P(X)\in\mathbb C[X]$ of degree less than $\deg M(X)$ which satisfies $P(A)=f(A)$.

Moreover $P(X)$ is given by the formula $$P(X)=\sum_j\ T_j\left(T_j(f)\ \frac{(X-\lambda_j)^{m_j}}{P(X)}\right)\frac{P(X)}{(X-\lambda_j)^{m_j}}\quad,$$ where $T_j(g)$ or $T_j(g(X))$ denotes the degree less than $m_j$ Taylor polynomial of $g$ at $\lambda_j$, viewed as an element of $\mathbb C[X]$.

The matrix $A$ is diagonalizable if and only if all the $m_j$ are equal to $1$. In this case, we have $$P(X)=\sum_j\ \prod_{k\neq j}\ \frac{X-\lambda_k}{\lambda_j-\lambda_k}\quad.$$

## Same answer with less indices

Let $A$ be an $n$ by $n$ complex matrix, let $$M(X)=\prod_{\lambda\in\Lambda}\ (X-\lambda)^{m_\lambda}\ \in\mathbb C[X]$$ be its minimal polynomial (the $m_\lambda$ being positive), let $U\subset\mathbb C$ be an open set containing $\Lambda$, let $B$ be the $\mathbb C[X]$-algebra of holomorphic functions on $U$.

Then there is a unique continuous $\mathbb C[X]$-algebra morphism from $B$ to $\mathbb C[A]$.

Denote it by $f\mapsto f(A)$.

For each $f$ in $B$, there is a unique polynomial $P(X)\in\mathbb C[X]$ of degree less than $\deg M(X)$ which satisfies $P(A)=f(A)$.

Moreover $P(X)$ is given by the formula $$P(X)=\sum_{\lambda\in\Lambda}\ T_\lambda\left(T_\lambda(f)\ \frac{(X-\lambda)^{m_\lambda}}{P(X)}\right)\frac{P(X)}{(X-\lambda)^{m_\lambda}}\quad,$$ where $T_\lambda(g)$ or $T_\lambda(g(X))$ denotes the degree less than $m_\lambda$ Taylor polynomial of $g$ at $\lambda$, viewed as an element of $\mathbb C[X]$.

The matrix $A$ is diagonalizable if and only if all the $m_\lambda$ are equal to $1$. In this case, we have $$P(X)=\sum_{\lambda\in\Lambda}\ \ \prod_{\mu\in\Lambda\setminus\{\lambda\}}\ \frac{X-\mu}{\lambda-\mu}\quad.$$

-