Ask Your Question

Symbolic matrices and "integrity" of their inverse

asked 2011-10-17 05:44:30 -0500

Jesustc gravatar image

updated 2011-10-17 22:46:11 -0500

I have to solve the following problem:

Does a matrix $G\in GL(n,\mathbb{Z})$ exists such that $$ G\times A\times G^{-1}=B $$ being $A,B$ given matrices in $\mathbb{Q}$?

Doing everything by hand, I finally find myself with a bunch of symbolic matrices. Now I have to check if they can lay inside $GL(n,\mathbb{Z})$, i.e. if there are integer values for the variables in the matrix such that the matrix is integer, invertible and with integer inverse.

E.g.: $$\left(\begin{array}{cc}x & 0 \\ 0 & y\end{array}\right)$$ does the trick only for $x=y=1$.

Is there a quick method within Sage to solve that last problem?


edit retag flag offensive close merge delete


An integer matrix is in GL(n,Z) (i.e., invertible with integer inverse) if and only if its determinant is 1 or -1 (from wikipedia: a square matrix over a commutative ring is invertible if and only if its determinant is a unit in that ring.) This might help you...

parzan gravatar imageparzan ( 2011-10-18 01:28:07 -0500 )edit

It does help me indeed, thanks! I should have known that... My main concern now is how to find out whether a polynomial equation (det=+/-1) has integer roots or not. "assume()" does not the trick :(

Jesustc gravatar imageJesustc ( 2011-10-18 04:51:33 -0500 )edit

This is in general an undecidable question - see However, for specific cases you might be able to find a solution.

parzan gravatar imageparzan ( 2011-10-18 05:08:40 -0500 )edit

"Integrality" would be a better word than "integrity".

John Palmieri gravatar imageJohn Palmieri ( 2011-10-18 06:55:10 -0500 )edit

Thanks a lot for the comments, Parzan and Palmieri! What do you think about erasing the question? I don't think it is useful for anybody.

Jesustc gravatar imageJesustc ( 2011-10-28 04:22:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-26 11:14:35 -0500

tmonteil gravatar image

A direct approach (not using symbolic solving) could be:

sage: A = matrix(QQ,[[3,1],[2,4]]) ; A
[3 1]
[2 4]
sage: B = matrix(QQ,[[2,4],[0,5]]) ; B
[2 4]
[0 5]
sage: A.is_similar(B)                       
sage: T = A.is_similar(B,transformation=True)[1] ; T
[ 1.000000000000000?             0.?e-18]
[0.2500000000000000? 0.2500000000000000?]
sage: T.change_ring(QQ)
[  1   0]
[1/4 1/4]
sage: G = T.change_ring(QQ)/det(T) ; G
[4 0]
[1 1]
sage: G * A * G^(-1) == B

See A.is_similar? for details.

edit flag offensive delete link more


That's a good one, thanks!

Jesustc gravatar imageJesustc ( 2013-08-03 05:26:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-10-17 05:44:30 -0500

Seen: 420 times

Last updated: Jun 26 '13