Let $H$ be a quaternionic algebra over ${\bf Q}$, and let $R$ denote a maximal ${\bf Z}$order in $H$. Is there a theorem on the structure of the units in $R$ analogous to the Dirichlet unit theorem? Is there an analogous theorem for the $S$units?

1$\begingroup$ The unit group will be, in general, noncommutative. So what definition do you suggest for the rank? Or are you just passing to the abelianization? $\endgroup$ – Pete L. Clark Apr 13 '11 at 3:32

$\begingroup$ Chapter V, section 1 of Vigneras? $\endgroup$ – Junkie Apr 13 '11 at 4:00

$\begingroup$ @akula, if you yourself are not sure what you meant... $\endgroup$ – Mariano SuárezÁlvarez Apr 13 '11 at 5:42

$\begingroup$ Another reference is Hull (1939): "On the Units of Indefinite Quaternion Algebras" jstor.org/stable/2371505 This is also Miyake's book Chapter 5 (Modular Forms) that does some parts as Fuchsian groups springerlink.com/content/v8r7212w353331r4 $\endgroup$ – Junkie Apr 14 '11 at 10:30
If $H$ is definite, then the group of units of $H$ is finite. If $H$ is indefinite, then the group of units is a pretty chunky group; it embeds as a cocompact discrete subgroup of $SL(2, R)$, and the rank of its abelianization (which, if I remember correctly, can be interpreted geometrically as twice the genus of an associated modular curve) can be arbitrarily large.
All of this follows from general theorems on arithmetic subgroups of algebraic groups; this is a classical theory going back to Borel, HarishChandra and Ono in the 60s, and there is a nice summary in Gross's paper "Algebraic modular forms".
EDIT: You asked about Sunits. Let S be a set of finite primes. If $H$ is definite, then the group of Sunits in H will be a discrete cocompact subgroup of
$\prod_{p \in S} (H \otimes \mathbb{Q}_p)^\times$.
If every place in $S$ is ramified in $H$, then the kernels of the reduced norm maps $(H \otimes \mathbb{Q}_p)^\times \to \mathbb{Q}_p^\times$ are compact, so this group above maps with finite kernel to a discrete subgroup of $\prod_{p \in S} \mathbb{Q}_p^\times$ and hence its abelianization has rank equal to the size of S. This argument can be pushed substantially further: you can show that if H is a quaternion algebra over a totally real field F which is totally definite (i.e. definite at every infinite place of F), then the map from Sunits of H to Sunits of F has finite kernel and cokernel, so the abelianization of the Sunits of F has rank $S + [F : \mathbb{Q}]  1$.
My favourite case, though, is when $F = \mathbb{Q}$, $H$ is definite, and $S$ consists of a single finite place $p$ which is not ramified in $H$. Then the Sunits of $H$ embed into $GL(2, \mathbb{Q}_p)$ as a discrete cocompact subgroup $\Gamma$, and the space of continuous functions on the quotient $GL(2, \mathbb{Q}_p) / \Gamma$ gives a representation of $GL(2, \mathbb{Q}_p)$ with many fascinating properties (it is an example of one of Matt Emerton's completed cohomology spaces).

$\begingroup$ @David Loeffler: Thanks. The finiteness of the unit group in the definite case must be easy  following just by looking at the norm form. Your explanation of the the indefinite easy really explains what is going on. Do you have anything to add about Sunits? $\endgroup$ – akula Apr 13 '11 at 14:28

$\begingroup$ Should it be twice the genus? I'm not sure, but that seems right to me, since the abelianization of $\pi_1$ of a genus $g$ curve has rank $2g$. $\endgroup$ – David E Speyer Apr 13 '11 at 17:29

$\begingroup$ @akula: I've added some remarks on Sunits. @David Speyer: Yes, I am sure you are right. $\endgroup$ – David Loeffler Apr 14 '11 at 7:45

$\begingroup$ @David Loeffler: Could you expand a bit on your "favourite case"? Does this description give the rank of the abelianization of the unit group in this case? $\endgroup$ – akula Apr 23 '11 at 19:08