# Matrix to Diag(1,ab) form

I know this may be a simple question but, aside from row and column operations (with which I have had no luck), is there a clear way to convert a 2x2 matrix Diag(a,b) to the form Diag(1,#)?

Thanks much, Eva

-
What do you mean by "convert"? – Qiaochu Yuan May 2 '11 at 23:08
well I have it as it was (actually it was a matrix like w,x\\ y,z) and I got it into Diag(a,b) form. Since the elements (original ones) are all relatively prime I need to show that it can be in the form Diag(1,#) – eva stokes May 2 '11 at 23:19
The way you've phrased it ("aside from row and column operations") seems to rule out their use, although you then say you "had no luck" with them. Of course you could multiply the first row by $a^{-1}$ and "convert" Diag(a,b) to Diag(1,b). – hardmath May 2 '11 at 23:31
We're having trouble answering your question because your question isn't clear. You want to convert a matrix from one form to another without losing any information - but just what information are you talking about? What information is conserved in going from the original matrix to the diagonal? – Gerry Myerson May 2 '11 at 23:54
Well, so this matrix is a relations matrix between a column vector of generators and a column vector of basis elements. By putting it into a Smith normal form, Diag(#1,#2), it now relates new generators to a new set of basis elements. (The generators are for a submodule of a free Z-module). – eva stokes May 3 '11 at 0:02

Given that $$\gcd(a,b) = 1,$$ and so there are integers $p,q$ such that $$a p + b q = 1,$$ your final task is given by the identity 
$$\left( \begin{array}{cc} p & q \\ -b & a \end{array} \right) \; \cdot \; \left( \begin{array}{cc} a & 0 \\ 0 & b \end{array} \right) \; \cdot \; \left( \begin{array}{cc} 1 & - b q \\ 1 & 1 - b q \end{array} \right) = \; \;\; \; \left( \begin{array}{cc} 1 & 0 \\ 0 & a b \end{array} \right)$$
Hello, Eva. I just experimented until it worked, multiplied by determinant 1 matrices on either the right or the left, then I mushed them together to post here. Note the determinants on both the left and right are 1. Note also that this will fail unless the gcd of these a,b is 1. It will not then be possible to force a 1 entry anywhere.  In your original post on Math Overflow, it was never clear whether you meant your four letters w,x,y,z pairwise relatively prime ( a strong restriction) or that the gcd of all four was 1. It matters. – Will Jagy May 3 '11 at 6:15