How would you define the cosine of a matrix? If you’re trying to think of a triangle whose sides are matrices, you’re not going to get there. Think of power series. If a matrix A is square, you can stick it into the power series for cosine and call the sum the cosine of A.
![]()
For example,
This only works for square matrices. Otherwise the powers of A are not defined.
The power series converges and has many of the properties you’d expect. However, the usual trig identities may or may not apply. For example,
![]()
only if the matrices A and B commute, i.e. AB = BA. To see why this is necessary, imagine trying to prove the sum identity above. You’d stick A+B into the power series and do some algebra to re-arrange terms to get the terms on the right side of the equation. Along the way you’ll encounter terms like A2 + AB + BA + B2 and you’d like to factor that into (A+B)2, but you can’t justify that unless A and B commute.
Is cosine still periodic in this context? Yes, in the sense that cos(A + 2πI) = cos(A). This is because the diagonal matrix 2πI commutes with every matrix A and so the sum identity above holds.
Why would you want to define the cosine of a matrix? One application of analytic functions of a matrix is solving systems of differential equations. Any linear system of ODEs, of any order, can be rewritten in the form x‘ = Ax where x is a vector of functions and A is a square matrix. Then the solution is x(t) = etA x(0). And cos(At) is a solution to x‘ ‘+ A2x = 0, just as in calculus.


{ 1 trackback }
{ 6 comments… read them below or add one }
Ben N 07.14.10 at 20:49
Actually, (A+B)2 = A2 + AB + BA + B2 whether or not A commutes with B, although if they don’t commute this won’t equal A2 + 2AB + B2. The issue here is one of starting with (A+B)n, for all n, and being unable to group terms. Instead of getting a term for each combination of A and B, you get a term for each permutation and there’s just nothing sensible to be done with them that will bear any resemblance to the familiar world of commutative algebra.
human mathematics 11.18.11 at 07:46
Another application is in recommender systems. Cosine distance is one of the ways to compare my library to yours.
John 11.18.11 at 07:50
human mathematics: because inverse cosine is the angle between two unit vectors. See covariance and cosines.
nils 01.16.12 at 10:31
Is the power series the best way to calculate cos(A) or are there other ways? In that case, which are they?
nils 01.16.12 at 10:53
Is the power series the best way to calculate cos(A) or are there other ways? In that case, which are they? Jordanization?
John 01.16.12 at 11:02
Jordan canonical form is useful in exact hand calculations with small or special matrices. It’s unsuitable for numerical calculation because it is discontinuous: the tiniest change to a matrix can change a 0 to a 1 in the JCF.
I imagine power series could be practical, though not always a power series centered at 0. You probably want to start with a nearby matrix that is easy to exponentiate.
Finding the cosine of A is equivalent to solving a system of differential equations. It may be better numerically to solve the differential equations directly.