Is $O_n({\bf Q})$ dense in $O_n({\bf R})$? I am wondering if the orthogonal group $O_n({\bf Q})$ is dense in $O_n({\bf R})$?
It is easily checked for $n = 2$ but I think that there is a general principle concerning compact algebraic groups underneath.
 A: There's an easy argument based on the Cayley transform:  If $a$ is a skew-symmetric $n$-by-$n$ real matrix, then $I_n+a$ is invertible (since $(I_n-a)(I_n+a)=I_n-a^2$ is a positive definite symmetric matrix and hence invertible), and
$$
A = (I_n-a)(I_n+a)^{-1}
$$
is orthgonal (i.e., $AA^T = I_n$).  Note that $(I_n+A)(I_n+a) = 2I_n$, so $I_n+A$ is invertible.  Conversely, if $A$ is an orthogonal $n$-by-$n$ matrix such that $I_n+A$ is invertible, one can solve the above equation uniquely in the form
$$
a = (I_n+A)^{-1}(I_n-A) = -a^T.
$$
This establishes a rational 'parametrization' (known as the Cayley transform) of $\mathrm{SO}_n(\mathbb{R})$.  Plainly, $a$ has rational entries if and only if $A$ has rational entries.
The density of $\mathrm{O}_n(\mathbb{Q})$ in $\mathrm{O}_n(\mathbb{R})$ follows immediately.
A: By Cartan-Dieudonné's theorem, every element of $O_n({\bf R})$, resp. $O_n({\bf Q})$ is a product of at most n hyperplane reflections $\sigma_u$ for u in ${\bf R}^n$, resp. u in ${\bf Q}^n$. Now it suffices to remark that a reflection is a limit of rational reflections.
A: Yes, here'a a proof by induction, granted the $n=2$ case (which is the only one where [basic] arithmetic occurs).
Let $G$ be the closure. I first claim that $G$ acts transitively on the sphere. Indeed, let $x=(x_1,\dots,x_n)$ be on the sphere. Using the case $n=2$ on the last two coordinates, we see that $x$ is in the orbit of some $y=(y_1,\dots,y_n)$ with $y_n=0$. Using the case in dimension $n-1$, we deduce that $y$ is in the orbit of $e_1=(1,0,\dots,0)$.
Now let $g$ be in $\mathrm{O}(n)$. By the claim, there exists $h\in G$ such that $g(e_1)=h(e_1)$. So $g^{-1}h$ fixes $e_1$, hence belongs to the copy of $\mathrm{O}(n-1)$ acting on the last $n-1$ coordinates. By induction, $g^{-1}h\in G$. So $g\in G$.
A: This answer doesn't really add much, but I already wrote it offline, so whatever. The idea is the same as in the answer of Name, except that I only use Cartan-Dieudonné over $\mathbb{R}$, where I think it is trivial. This is based on my favorite proof for the density of $\mathbb{Q}^2$ on the unit circle, so based on coudy's comment on Robert Bryant's answer, this is possibly also related to that one.
Let $R$ be a subfield of $\mathbb{R}$, and write $M_{n,m}(R)$ for all $n$-by-$m$ matrices with entries in $R$, $\mathrm{GL}_n(R)$ for invertible $n$-by-$n$ matrices, $O''_{n,m}(R)$ for $n$-by-$m$ matrices with linearly independent columns, $O'_{n,m}(R)$ for $n$-by-$m$ matrices with orthogonal columns, $O_n(R)$ for orthonormal matrices.
First we have Gram-Schmidt orthogonalization.

Lemma. Let $A \in O''_{n,m}(R)$. Then there is a matrix $B \in O'_{n,m}(R)$ such that for all $k \leq m$, the first $k$ columns of $B$ have the same column span as those of $A$.

Now we simply write any matrix as a product of reflections and approximate them, observing that the approximations, while not orthonormal, still give orthonormal reflections.

Lemma. Let $A \in O''_{n,n-1}(R)$, $V$ the codimension $1$ subspace spanned by the columns of $A$. Then the matrix $X_A$ that reflects around $V$ is in $O(R)$. Furthermore, $X_A$ is continuous in $A$.

Proof. Complete $A$ to a matrix in $O''_{n,n}(R)$ by adding an $n$th column, and apply the previous lemma to obtain $B \in O'_{n,n}(R)$ such that the first $n-1$ columns have span $V$. Now $X_A = B C B^{-1}$ works, where $C$ is the identity matrix except $C_{n,n} = -1$, i.e. in basis $B$ we just have to flip the sign of the last coordinate. Continuity of reflection in the spanning vectors is obvious by geometry, or by analyzing the formulas. Square.

Theorem. $O_n(R)$ is dense in $O_n(\mathbb{R})$.

Proof. Any $D \in O_n(\mathbb{R})$ can be written as a composition of $t \leq n$ reflections over some codimension $1$ subspaces $U_1, U_2, ..., U_t$ spanned by matrices $D^i \in O_{n,n-1}(\mathbb{R})$, i.e. $D = X_{D^t} \circ \cdots \circ X_{D^1}$. If $A^i \in O''_{n,n-1}(R)$ is close to $D^i$, the matrix $A = X_{A^t} \circ \cdots \circ X_{A^1}$ is close to $D$ by continuity. Square.
