Angles in an integral lattice Let $d\geq 1$ be a fixed integer, and $\mathbb{Z}^d$ be the lattice of all integers; consider the set $A_d \subset [-1,1]$ defined by
$$ \alpha \in  A_d  \ \iff \  \alpha=\frac{v \cdot w}{\|v\| \|w\|}  \mbox{ for some } \ v,w \in \mathbb{Z}^d $$
Of course $A_d$ is a set of quadratic irrationals and $\overline{A_d}=[-1,1]$.
Question: is it possible to caracterize all values that belong to $A_d$?
In other words, can one caracterize all angles which occour between two integer vectors?
For instance: are there two integer vectors in the plane which form an angle of $\pi/3$?
PS: this problem comes from the question of a collegue, who wants to cook different versions of a linear algebra test for undergraduate students in such a way that computations are different, but equally simple (I guess the question has already been raised and solved - but I am not an expert). 
 A: The proof that $\pi/3$ is not a lattice angle is due to Lucas, while the proof that an $n$-gon does not embed in $\mathbb Z^d$ is due to Schoenberg, and has a nice proof by Scherrer. There is a AMM article on the topic you ask about "Triangles with vertices on lattice points", which has some history and references, too.  Also, note that except for the Euclidean approach, there is another geometric approach to lattice angles related to continued fractions. Oleg Karpenkov has some nice notes on this.
A: Let C, D be integers with C^2 < D, then C/sqrt(D) is realized in five dimensions.  Hint: let w = (1,0,0,0,0) and v have first component C.  There may be a way to take this down to 4 dimensions, but I am tired.  Anyway, a number-theoretic characterization should not be far away for lower dimensions.
UPDATE 2011.02.07 In d <= 4 dimensions, a similar construction works, for all 
positive integers C and k (given k is the sum of at most (d-1) squares) for C/sqrt(k + C^2),  and in dimension d = 4 it is possible to cover many of the remaining cases with
w = (1,1,0,0) or (1,1,1,0).  Perhaps Will Jagy can tell us which quadratic irrationals stay out of A_4 ?
Gerhard "Ask Me About System Design" Paseman, 2011.01.25
A: Louis J. Mordell showed in 1930 that the matrix equation
$$
\left(  \begin{array}{rrrr}
  p & q & r & s\\\
  t & u & v & w 
\end{array} 
  \right) 
\; \cdot \;
\left(  \begin{array}{rr}
  p & t \\\
  q & u \\\
  r & v  \\\
  s & w  
\end{array} 
  \right) =  \; \;\; \; 
 \left(  \begin{array}{cc}
  A & B \\\
  B & C  
\end{array} 
  \right)  
, $$
all quantities integers, while the right hand side is positive definite, is possible if and only if the determinant
$A C - B^2$ is  the sum of three squares, that is not of shape $4^k ( 8 n + 7).$
We are interested in the possible  lattice angles in $\mathbf R^4,$ which we write with positive integers $F,G,$ (such that $F^2 < G$)  as
$$ \cos \theta = \frac{\pm F}{\sqrt{G}}.   $$ The main demand we make is that if $F$ is even, we require
that $G$ is not divisible by 4. We ask whether it is possible to realize this angle on the lattice.
When $F$ is odd, this is possible if and only if $G \neq 0 \pmod 8.$
When $F \equiv 2 \pmod 4,$ (so $G \neq 0 \pmod 4$),  this is possible if and only if $G \neq 3 \pmod 8.$
When $F \equiv 0 \pmod 4,$ (so $G \neq 0 \pmod 4$),  this is possible if and only if $G \neq 7 \pmod 8.$
Whenever possible, the solution is given by the 2 by 2 matrix above, with $B = F$ and $ A C = G.$
Then, as we have $G - F^2 \equiv 1,2,3,5,6 \pmod 8,$ once we select our favorite $A$ and $C,$ there are in fact integral vectors $P = (p,q,r,s)$ and $T = (t,u,v,w)$ such that
$$P \cdot P = A, \; \; \; P \cdot T = B, \; \; \; T \cdot T = C.$$
Note that we can actually take $A = 1, \; B = F, \; C = G, \; \; P = (1,0,0,0), \; \; T = (F,u,v,w)$ by demanding $u^2 + v^2 + w^2 =  G - F^2.$
Also note that some rational values are ruled out. While
$ \cos \theta = 1/2$ is easy, if we have odd $m$ and any $j,$ ($j$ can be odd or even) then
$$ \cos \theta = \frac{m}{4j}  = \frac{m}{\sqrt{16 j^2}}   $$
cannot be arranged with $\theta$ a lattice angle in  $\mathbf R^4.$
L. J. Mordell, "A new Waring's problem with squares of linear forms," Quarterly Journal of Mathematics (1930), pages 276-288. Seems to be volume 1.
A: The lattice angles in $\mathbf R^3$ are the same as those in $\mathbf R^4.$ This seems to be what Michael Beeson is saying in the first page of his 1992 article (link in Gjergji's answer), I have not seen the rest of the article yet.
Using the symbols of Gerhard "Fluid Mechanics Have Side Effects" Paseman, we are attempting to find a lattice angle $\theta$ such that $$ \cos \theta = \frac{ C}{\sqrt{C^2 + k}},$$
with integers $C,k$ and $k >0.$
In $\mathbf R^5,$ this is always possible.
In $\mathbf R^2,$ this is possible if and only if $k$ is a square, in which case $\theta$ is the angle between
vectors $$ P_2 = (1,0), \; \; T_2 = (C,\sqrt{k}). $$
In $\mathbf R^4,$ this is possible if and only if $k$ is the sum of three squares. Taking
$$ k = u^2 + v^2 + w^2,$$  $\theta$ is the angle between
vectors $$ P_4 = (1,0,0,0), \; \; T_4 = (C,u,v,w). $$
In $\mathbf R^3,$ this is also possible if and only if $k$ is the sum of three squares; this comes from simple tricks with integral quaternions. However, we can no longer take one vector as fixed, or bound its length ahead of time. Taking
$ k = u^2 + v^2 + w^2,$ and requiring that $u,v$  not both be $0,$ we find $\theta$ is the angle between
vectors $$ P_3 = (u,v,0), \; \; T_3 = (C u - v w, C v + u w   , u^2 + v^2   ). $$
