Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a matrix $M$ where various elements may be in the form of $x/y$. If I use the decimal form of that number, I lose precision if I raise $M$ to a large power.

My question: is it possible to do two exponentiations? One for the numerator only, and then one for the denominator, and then somehow combine the results?

share|cite|improve this question
Do you know about diagonalization? – NECing Mar 17 '13 at 1:22
Why not factor the the denominators out of the matrix so that you are dealing with an integer matrix, and then raise that to a power. (If you are familiar with linear algebra topics like eigendecomposition then approaches in the answers below can help too.) – Maesumi Mar 17 '13 at 4:08

I'd go like Shu: diagonalize first.

If you insist on raw computations, take $d$ a common multiple of all the denominators and put $A = d M$. Then A has only integer coefficients and $M^n = A^n /d^n$ with $d$ integer.

share|cite|improve this answer

Here is the most general way of computing a power of a matrix.

If the eigenvalues $\lambda_1,..,\lambda_n$ of your matrix $A$ are distinct, you can diagonalize it to the form $$A=PBP^{-1},\text{where }B=\begin{pmatrix}\lambda_1&0&\dots&0\\0&\lambda_2&\dots&0\\\dots\\0&\dots&0&\lambda_n\end{pmatrix}$$ It is easy to see that $A^m=(PBP^{-1})^m=P(B^m)P^{-1}$. Computing $B^m$ is easy, $$B^m=\begin{pmatrix}\lambda_1^m&0&\dots&0\\0&\lambda_2^m&\dots&0\\\dots\\0&\dots&0&\lambda_n^m\end{pmatrix}$$ If you are not that lucky, you may not be able to diagonalize your matrix. The best you can do is make it into Jordan form, which is not important for you at this stage I guess.

share|cite|improve this answer

You want to transform the matrix to a nicer form, either diagonal or Jordan normal form. The transformation is $M=PDP^{-1}$ for diagonal or $M=PJP^{-1}$ The nice thing is that powers of these are easy to compute: $M^2=PDP^{-1}PDP^{-1}$ and the central $P$'s multiply to the identity, so $M^2=PD^2P^{-1}$. Both diagonal and Jordan matrices are easy to raise to powers, and diagonal ones are easy to take roots of. The Jordan matrices are sensitive to roundoff. There are packages available for this, which are highly recommended because 1)why reinvent the wheel and 2)there are numeric pitfalls to avoid.

share|cite|improve this answer
@user2175923: You can see an explicit diagonalization at Wolfram Alpha. You can then verify that $M^4=SJ^4S^{-1}$ I'm not sure that will help your understanding. Any linear algebra text will have a section on diagonalizing matrices. – Ross Millikan Mar 17 '13 at 5:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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