TITLE: Determining if a matrix is orthogonal
QUESTION [13 upvotes]: Let g be an element of $GL_n(\mathbb C)$. We know that there are orthogonal groups $O(\beta)=\{X\in GL_n(\mathbb C) \mid X^t\beta X=\beta\}$ for any $\beta$, invertible symmetric matrix. Though these groups are conjugate since all symmetric bilinear forms over $\mathbb C$ are equivalent. In literature one can find a way to determine when a matrix $X$ satisfies $X^tX=I$ thus an element of the orthogonal group $O(I)$. 
My question is as follows: Is there a way to determine if an invertible matrix X belongs to $O(\beta)$ for some $\beta$. To me it seems that I have to check for all conjugates. Sure enough there will be an easier way out!  
More precisely I want to know the following: Given $X$ an invertible matrix how to determine $\beta$, an invertible symmetric matrix, so that $X^t\beta X=\beta$?

REPLY [12 votes]: There is a complete characterization of matrices that belong to at least one
orthogonal group. It reads as follows over any arbitrary field $\mathbb{F}$
with characteristic different from $2$ (with algebraic closure denoted by $\overline{\mathbb{F}}$:

Given a matrix $M \in \mathrm{GL}_n(\mathbb{F})$, there exists an
  invertible symmetrix matrix $\beta$ such that $M^T \beta M=\beta$ if
  and only if, for every $\lambda \in \overline{\mathbb{F}} \setminus \{0,1,-1\}$ and 
  every positive integer $k$, one has
  $\mathrm{rk}(M-\lambda I_n)^k=\mathrm{rk} (M-\lambda^{-1} I_n)^k$ and,
  for each one of the (possibly absent) eigenvalues $1$ and $-1$ and
  every positive integer $k$, there is an even number of Jordan cells of
  size $2k$ in the Jordan reduction of $M$. 

Moreoever, if you have access to the Jordan reduction of $M$ and the above conditions
are satisfied, then coming up with an explicit solution $\beta$ is not difficult.
This characterization has been known for a very long time. See my preprint http://arxiv.org/abs/1008.4458 for a recent account using elementary methods.