# How to generate $2\times 2$ matrix with integer entries and both eigenvalues inside unit disk

I am looking for a method to generate $2\times 2$ matrices whose all elements are integers and whose both eigenvalues lie inside the unit disk.

I realise that I could do so via similar matrices, i.e. take matrix $A$ to be a diagonal one, and then the matrix $B=P^{-1}AP$ will have the same eigenvalues. My question is - how do I ensure that the elements of the matrix $B$ are integers?

EDIT: What I am interested in ultimately is the asymptotic stability of the discrete time linear systems of the type $x(k+1)= Ax(k)$, where $x(k)$ is the state of the system at time step $k$. Asymptotic stability of such a system is equivalent to $A$ having all its eigenvalues inside open unit disk, which is equivalent to the existence of positive definite solution $P > 0$ to the discrete Lyapunov equation $A^TPA-P = -Z$ for some $Z$ positive definite. Hence, what I am actually looking for is a solution $P$ of the above equation with integer or rational elements, and thought initially that $A$ with integer elements might be a way to get there.

• Welcome to math.stackexchange! It's good that you are indicating what you have attempted. Now to your question: Think about the determinant (product of eigenvalues) and the trace (sum of eigenvalues) of such a matrix. They must both be integers. That does not leave a lot of options. – Hans Engler Jan 17 '15 at 14:09
• take a rotation or a reflection matrix and scale the matrix by a factor smaller than one in absolute value. – abel Feb 21 '15 at 0:45

The sum of the eigenvalues is $\operatorname{tr} A$ and their product is $\det A$, and these expressions are of course also integers. Then we conclude $|\det A|\le1$ and $|\operatorname{tr} A|\le 2$ (assuming you consider the closed unit disk). For example, the simplest case $\det A=\operatorname{tr} A= 0$ leads to $A=\begin{pmatrix}a&b\\c&-a\end{pmatrix}$ with $a^2=-bc$; this can be rewritten as $A=\begin{pmatrix}uvd&-u^2d\\v^2d&-uvd\end{pmatrix}$ with $u,v,d\in\mathbb Z$. The other cases lead to similar Diophantine conditions.
This may look confusing, but now we can exploit your idea of similarity. However, $A$ is similar to a diagonal matrix only over $\mathbb C$. You better restrict your $P$ matrices to elements of $SL(2,\mathbb Z)$. This at least allows you to achieve things like e.g. $|c|\le |a|$.
• Isn't it $a^2=-bc$, since the determinant is $-a^2-bc$? – Ian Jan 17 '15 at 14:36
Since your matrix is real, the eigenvalues are real or come in complex conjugate pairs. The real part of the pair is half the trace, and since it must lie strictly within the unit circle, your matrix must have zero trace (similarly, the average of the eigenvalues must be in the unit circle if both are). If both eigenvalues are within the unit circle, then their product is also, so $\det A < 1$. Since the determinant is an integer, then $\det A = 0$. A zero-trace, zero-determinant matrix is highly constrained (and probably trivial for your application), but I will parameterize them anyways. It must be of the form $$\begin{bmatrix} a&b\\c&-a\end{bmatrix}$$ The condition $\det A = 0$ is equivalent to $a^2+bc = 0$. So choose a random integer $a$, compute factorizations of $a^2$, then choose $b$ and $c$ of opposite sign from possible factorizations.