# Completing a matrix in $SL_n(\mathbb{Z})$

Given $k\in\mathbb{Z}^n$ is there some way to decide when we can construct a matrix $A\in SL_n(\mathbb{Z})$ s.t the first row of $A$ is $k$?

For instance when $n=2$ and $k=(a,b)$ this is just when $a$ and $b$ are relatively prime.

One can construct such a matrix if and only if the gcd of the entries of $k$ is $1$.

The necessity is obvious, the sufficiency not quite so. Given $k$ one can do elementary column operations over $\Bbb Z$ to reduce it to $(1,0,0,\ldots,0)$. Thus there is a matrix $A$ in $\text{GL}_2(\Bbb Z)$ with $kA=(1,0,0,\ldots,0)$ (this is basically the Euclidean algorithm). Then the top row of $A^{-1}$ is $k$.

The determinant of $A^{-1}$ may be $-1$, but I'll leave you to fix that.

• And this is precisely the algorithm for the Smith normal form, which generalizes to this: math.stackexchange.com/questions/1412649 – punctured dusk Oct 22 '17 at 7:59
• "the necessity is obvious" when you think to expand the determinant wrt the first row and see that you find the Bezout relationship... (note added for those who aren't acquainted with these issues) – Jean Marie Oct 22 '17 at 8:07