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 inmathbb{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