Explicit equation of Dickson invariant / quasideterminant / special orthogonal group over the integers Consider $2n$ coordinates $x_1,\ldots,x_n,y_1,\ldots,y_n$ and the quadratic form $q = \sum_{i=1}^n x_i y_i$.  Now call $O(q,A)$ (orthogonal group of $q$) the group of $(2n)\times(2n)$ matrices, with coefficients in a commutative ring $A$, which preserve $q$.  (This is an algebraic group over $\mathop{\mathrm{Spec}}\mathbb{Z}$.)  When $A$ is a field of characteristic $\neq 2$, the determinant restricted to $O(q,A)$ takes its values in $\{\pm 1\}$, its kernel $O(q,A) \cap SL(2n,A)$ defines a subgroup $SO(q,A)$ of index $2$.  When $A$ is a field of characteristic $2$, the determinant is identically $1$ on $O(q,A)$ but there is still a subgroup of index $2$, which one might still denote $SO(q,A)$, defined by the so-called "Dickson invariant", also known as quasideterminant or pseudodeterminant, and it is relatively straightforward to give an explicit polynomial in the coefficients of $A$ which defines an equation of $SO(q,A)$ inside $O(q,A)$ (see, Dickson's book, Linear Groups, theorem 205 on page 206).
Now for an arbitrary ring $A$, there is still a subgroup $SO(q,A)$ of $O(q,A)$, which is the kernel of a morphism $\deg$ of $O(q,A)$ to the group $(\mathbb{Z}/2\mathbb{Z})(A)$ of idempotents of $A$ (so, when $A$ is connected, $SO(q,A)$ is a subgroup of order $2$) natural in $A$ and which coincides with $\frac{1}{2}(1-\det)$ when $2$ is invertible in $A$ and with Dickson's invariant when $2$ is zero in $A$.  This is due to H. Bass ("Commutative Algebras and Spinor Norms over a Commutative Rings", Amer. J. Math. 96 (1974), 156–206).
Concretely, this means that there exists a polynomial $\deg$ in $4n^2$ variables over $\mathbb{Z}$ such that, modulo the ideal $I$ of relations defining $O(q,A)$, we have $\deg^2 = \deg$ and $\det = 1-2\deg$.  And $I_0 := I+(\deg)$ is the ideal defining $SO(q,A)$.
My question is: can one give an explicit expression of $\deg$ (as a polynomial in $4n^2$ variables), or perhaps an explicit set of equations of $SO(q,A)$ (e.g., Gröbner basis of $I_0$ for some term order)?  (At least for the particular quadratic form $q = \sum_{i=1}^n x_i y_i$ if not in general.)
 A: Hi Gro-Tsen ! The following is the outcome of a discussion with Olivier Taïbi.
Let V be the free module of rank $2n$ over $\mathbb{Z}$ with basis $f_1,\dots,f_n,g_1,\dots,g_n$ and  equipped with the split quadratic form $q=\sum_{i=1}^nx_iy_i$. Let $C(V,q)$ be the Clifford algebra of $(V,q)$ and $C^+(V,q)$ be its even part. The orthogonal group $O(V,q)$ acts on both. Moreover, $C^+(V,q)$ is the product of two matrix algebra, hence an element of the orthogonal group either preserves these factors or exchanges them. This gives a morphism $\deg:O(V,q)\to \mathbb{Z}/2\mathbb{Z}$ that is precisely the Dickson invariant we want to compute. [For all these facts, see for instance Conrad's notes http://math.stanford.edu/~conrad/252Page/handouts/O(q).pdf, Lemma 1.4 and around.]
Now, $C^+(V,q)$ has two non-trivial projectors (one on each factor), so that an element of the orthogonal group will have Dickson invariant $0$ (resp. $1$) if and only if it preserves these projectors (resp. it exchanges them). When $n=1$, it is not difficult to compute these projectors: one is given by $e=f_1g_1\in C^+(V,q)$ (and the other is $1-e$). It is then possible to compute inductively these projectors, using for instance the formula [SGA7 II Exp. XII (1.10.1)]. When $n=2$, one of the projectors is given by $e=f_1g_1+f_2g_2+2f_1f_2g_1g_2$ (and the other is $1-e$). By induction, it is possible to give a closed formula as follows. If $I=\{i_1<\dots <i_k\}$, let $f_I:=f_{i_1}\dots f_{i_k}$ and $g_I:=g_{i_1}\dots g_{i_k}$. Then one of the projectors is given by: $$e=-\sum_{k\geq 1}(-1)^{\frac{k(k+1)}{2}}2^{k-1}\sum_{I\subset\{1,\dots,n\},|I|=k}f_Ig_I.$$
To obtain a formula for the Dickson invariant of $u\in O(V,q)$, compute $u(e)$ in $C(V,q)$. By the above, it is equal to $e$ if $\deg(q)=0$ and $1-e$ if $\deg(q)=1$. Hence, it suffices to write down $u(e)$ in the basis $(f_Ig_J)$ of $C(V,q)$: the coefficient of $Id=f_{\varnothing}g_{\varnothing}$ will be $\deg(u)$. This gives an explicit polynomial expression for $\deg(u)$ in the matrix coefficients of $u$. 
In characteristic $2$, the fact that $e=\sum_{i=1}^nf_ig_i$ allows to recover the very simple expression of the Dickson invariant in characteristic $2$. When $n=2$, it is not difficult to use this to write down by hand an expression for the Dickson invariant over $\mathbb{Z}$. If $a,b,c,\dots, n,o,p$ are the matrix coefficients of $u$ from left to right then up to bottom (sorry for the poor notations), the Dickson invariant $\deg(u)$ is given by: $$ic+mg+jd+nh+2[(ib+mf)(kd+oh)+(id+mh)(jc+ng)-(jd+nh)(ic+mg)].$$
It is also possible to obtain a (probably not very useful) closed formula from the procedure above by understanding how the $f_Ig_I$ term in the formula above contributes to the coefficient of $Id$ in $u(e)$. To write it down, let me introduce the following notation. If $I\subset\{1,\dots, n\}$ has $k$ elements, $\tilde{I}=I\cup(n+I)$ and $P_I$ is the set of partitions of $\tilde{I}$ into $k$ pairs. To every such partition $P\in P_I$, it is possible to associate a natural sign $\varepsilon(P)$. Then:
$$\deg(u)=-\sum_{k\geq 1}(-1)^{\frac{k(k+1)}{2}}2^{k-1}\sum_{I\subset\{1,\dots,n\},|I|=k}\bigg(\sum_{P\in P_I}\varepsilon(P)\prod_{\{i<j\}\in P}\sum_{k=1}^n u_{n+k,i}u_{k,j}\bigg).$$
A: In fact, in order to define $\deg=\frac{1}{2}(1-\det)$ it is enough that $2$ be a nonzerodivisor in $A$. In particular, since the orthogonal groups are defined over $\mathbb{Z}$ i.e. come from the orthogonal groups over $\mathbb{Z}$ by the base change $\mathbb{Z}\to A$, it is ok to define $\deg$ when $A=\mathbb{Z}$.
This may also be phrased, more cleanly in my opinion, in terms of 'dilatations'. You may have a look at section 4.1.2 in the paper On the adjoint quotient of Chevalley groups over arbitrary base schemes joint with Pierre-Emmanuel Chaput.
