TITLE: What is $\mathrm{O}_q/\mathrm{SO}_q$ if $q$ is a quadratic $\mathbb{Z}$-form which is degenerate?
QUESTION [5 upvotes]: Any binary quadratic $\mathbb{Z}$-form $q$ induces a symmetric bilinear form 
$$ B_q(u,v) = q(u+v) - q(u) -q(v) \ \ \forall u,v \ \in\mathbb{Z}^2  $$
and it is considered non-degenerate (over $\mathbb{Z}$) if its discriminant
$$ \text{disc}(q) := \det(B_q(e_i,e_j)_{1 \leq i,j \leq 2}) $$ 
where $e_1 = (1,0)$ and $e_2 = (0,1)$ is invertible in $\mathbb{Z}$, i.e., equals $\pm 1$:  see (2.1) in: http://math.stanford.edu/~conrad/papers/redgpZsmf.pdf .
Suppose $q$ is degenerate, but still $\text{disc}(q) \neq 0$ (so it is non-degenerate over $\mathbb{Q}$). So its special orthogonal group scheme $SO_q$ defined over $\text{Spec} \ \mathbb{Z}$, does not have to be smooth, but it is flat as $\mathbb{Z}$ is Dedekind (loc. sit. Definition 2.8 and right after), and it is closed in the full orthogonal group $O_q$, whence the quotient $Q:=O_q/SO_q$ is representable.  
My question is: Is $Q$ a finite group of order $2$ over $\text{Spec} \ \mathbb{Z}$ ?
Apparently, when applied to any integral domain $R$ which is an extension of $\mathbb{Z}$, the elements of $O_q(R)$, in some matrix realization, must be of $\det \pm 1$, so we could think of $Q$ as a $\mathbb{Z}$-group of order $2$, but as a functor of points, $O_q$ can be applied to any $\mathbb{Z}$-algebra $R$, for which we may find elements of $O_q(R)$ which are not of $\det = \pm 1$. 
For example, let $q(x,y)=x^2+y^2$. One can verify it is degenerate. 
We get $SO_q = \text{Spec} \ \mathbb{Z}[x,y]/(x^2+y^2-1)$. Consider its matrix realization $$ \left \{ A=\left( \begin{array}{cc}
    x  & -y   \\ 
    y  & x  \\ 
 \end{array}\right): \det(A)=1 \right \}. $$
Then the component of $\det = -1$ elements in $O_q$ is obtained by $\text{diag}(1,-1)SO_q$. 
So apparently, $Q = \mu_2$ (which unlike the other order $2$ group $(\mathbb{Z}/2)_\mathbb{Z}$, it has a double point at the reduction at $(2)$, not two distinct ones).
So far everything is good. But $A=\text{diag}(3,1)$ belongs to $O_q(R)$ where $R=\mathbb{Z}/8$ (as $A^T \cdot A = I_2$ in $R$, where $I_2$ represents $q$), but $\det(A)\neq \pm 1$ in $R$ !
Does it mean that $O_q$ is more than these two connected components ?
I thought to avoid this problem by considering $O_q$ and $SO_q$ as flat sheaves (in the small site of flat extensions of $\mathbb{Z}$, since what I really care is of $H^1_\text{fppf}(\mathbb{Z},O_q)$), but we may still find extensions such as $\mathbb{Z} \times \mathbb{Z}$ containing a square root of unity other than $-1$ ?! 
Could you please help ? 
Thank you ! 
Rony

REPLY [3 votes]: We asked: 
If indeed $\textbf{O}_q = \textbf{O}_q^+ \cup \textbf{O}_q^-$ defined over $\text{Spec} \, \mathbb{Z}$, then applied as a functor of points to some ring $R$ (being a $\mathbb{Z}$-algebra), how could exist a point in $\textbf{O}_q(R)$ which is neither in $\textbf{O}_q^+(R)$ nor in $\textbf{O}_q^-(R)$ ? 
The answer, more generally, is that given a union of schemes $X = X_1 \cup X_2$ 
which is not disjoint, and a ring $R$ which is not a domain (having some zero-divisors), then $X(R)$ should not be equal to $X_1(R) \cup X_2(R)$, because a union of schemes corresponds to the multiplication of their underlined varieties. 
This equality holds for domains, however.  
The simplest example is the group $\mu_2$ defined over $\text{Spec}\,\mathbb{Z}$ 
being the union of the two components whose varieties are $x=1$ and $x=-1$. 
These coincide at the prime $(2)$. The point $3$ belongs to $\mu_2(R=\mathbb{Z}/8)$ though not to any of the components $R$-points, since $(3-1)(3+1) \equiv 0 (\text{mod}8)$. 
This means that not any point of $\mu_2(R)$, considered as a morphism $\text{Spec}\,R \to \mu_2$, can be lifted to a morphism from $\text{Spec} \, R$ to the disjoint union of $\text{Spec} \,\mathbb{Z}[t]/(t-1)$ and $\text{Spec} \,\mathbb{Z}[t]/(t+1)$.  
Since $q$ is assumed to be non-degenerate over $\mathbb{Q}$ and invertible matrices over $\mathbb{Z}$ can only have determinant $\pm 1$, the above union is the all orthogonal group. As $\textbf{O}_q^+$ is a closed flat subgroup, $\textbf{O}_q/\textbf{O}_q^+$ is a finite $\mathbb{Z}$-group of order $2$ (can be either $\mu_2$ or $(\mathbb{Z}/2)_\mathbb{Z}$).   
Thanks to Prof. Joseph Bernstein.