Quaternion order associated to a ternary quadratic form I am a bit puzzled by the discriminant of a ternary quadratic form.
According to Lehman 1992 and another related question, the discriminant of a ternary quadratic form is the half-determinant of its symmetric (Gram) matrix.
(I admit that I find this definition a bit strange, since multiplying a form by a scalar $\lambda$ multiplies its discriminant by the cube of $\lambda$, but why not.)
Over the integers of a number ring (say the rationals, for simplicity), ternary forms correspond to orders in quaternions algebra, the correspondence being given by (quaternion order $\mathcal O$) $\mapsto$ (restriction of the reduced norm form $\mathrm{Nrd}$ to the pure part of $\mathcal O$). The reverse correspondence is given for example in Lemurell 2011 by the Clifford algebra construction; however, I try to make an explicit construction of the quaternion order in an standard quaternion algebra $\left(a,b\over \mathbb Q\right)$.
I am trying to work this out in the case of the form $q := x^2 + xy + y^2 + 2 z^2$ over the integers. According to the above definition, $q$ has discriminant $6$, so the corresponding quaternion order should lie in the quaternion algebra $B_6 = B_{\{2,3\}}$ ramified exactly at $2$ and $3$ over the rationals. A model for $B_6$ is $B_6 \simeq \left(6,5\over \mathbb Q\right)$; in particular, $B_6 \otimes \mathbb Q(\sqrt{6})$ is split.
Now let $\mathcal O$ be the corresponding quaternion order, $B = \mathcal O \otimes_{\mathbb Z} \mathbb Q$, and $K$ be an extension of $\mathbb Q$ which splits $B$, so that $B_K := B \otimes_{\mathbb Q} K = K^{2\times 2}$. I try to explicitly write down the isomorphism, using the elements of $B_K$ corresponding to nilpotent matrices such as $\tiny \begin{pmatrix} 0 & 1\\0 & 0\end{pmatrix}$ or $\tiny\begin{pmatrix} 0 & 0\\1 & 0\end{pmatrix}$:  under this isomorphism they all have trace and norm zero and therefore are $K$-rational points of the conic with equation $q = 0$.
However, we may also see directly that
$$ 6q = (-x+y+2z)^2 + (2x+y+2z)^2 + (-x-2y-2z)^2,$$
which means that the conic $q = 0$ has rational points on every $\mathbb Q_p$ except $p = 2$ and $p = \infty$. This means that $B$ ramifies exactly at the primes $\{2,\infty\}$: it is not the quaternion algebra $B_6$. (In particular, it does not split over $\mathbb Q(\sqrt{6})$, since the equation $u^2 + v^2 + w^2 = 0$ has no non-trivial solution in this field).
This suggests that a “correct” value for the discriminant of $q$ is 2 and not 6.
So, first question: where is the catch ?
 - are the discriminants of $q$ and $\mathcal O$ (and therefore $B$, since in my example $\mathcal O$ should be maximal) not supposed to be the same?
 - did I make a mistake in my computations? (probably, but where?)
 - should I use another definition for the discriminant of q, such as the one I hint above (product of places where the conic has no rational point) ?
OK, so I boldly assume the first case and try  to write down the order $\mathcal O \otimes \mathbb Q(\sqrt{-2})$. The conic $q = 0$ has the rational parametrization $(\sqrt{-2} (1-2t): \sqrt{-2} (t^2-1): t^2-t+1)$. With a bit of linear algebra, I can use this to find the three matrices
$$I = \begin{pmatrix}-2&1\\-1&2\end{pmatrix},
J = \begin{pmatrix}-1&-1\\-2&1\end{pmatrix},
K = \sqrt{-2}\begin{pmatrix}1&-2\\2&-1\end{pmatrix},$$
such that $\det (x I + y J + z K) = -3 q(x,y,z)$. I am however unable to get rid of this $(-3)$ factor. Therefore,
Second question: how to find three matrices $I$, $J$, $K$, defined over a quadratic extension of $\mathbb Q$, such that $\det (x I + y J + z K) = q(x,y,z)$ ?
 A: There is one aspect where i have comments. It is a consequence of the global relation for Hilbert's norm residue symbol that a positive ternary quadratic form is anisotropic in at least one $p$-adic field $\mathbb Q_p.$ The precise reason there is at least one such $p$ is that the count of such (finite primes) $p$ must be odd. In turn, the reason for that is  that the total count for all primes, including $\infty,$ must be even. I recommend CASSELS for this material as well as the expression of a form as an even Clifford algebra.
You have correctly found the primes $(2,\infty).$ However, a little more is possible than isotropy or the lack of it; we can have restrictions modulo some prime without anisotropy. For example, $x^2 + y^2 + 9 z^2$ integrally represents all positive integers except for all $4^k (8n+7)$ and all $9n \pm 3.$ In  your viewpoint, the $9n \pm 3$ is a bit of a throw-away. Still, the obstruction, while mild, is there. Put another way, this obstruction is invisible in $\mathbb Q_3$ but clear enough in its integers $\mathbb Z_3.$

A: OK, I am answering my own question :-)
Splitting the quaternion algebra $B$ over an extension field $K$ is equivalent to computing an isomorphism between the norm forms of $B$ and of $K^{2\times 2}$, or even between their restrictions to trace zero elements.
The determinant restricts to trace zero matrices as the form $-xy-z^2$ (in the basis $\small\begin{pmatrix}0&1\\1&0\end{pmatrix}$, $\small\begin{pmatrix}0&0\\1&0\end{pmatrix}$, $\small\begin{pmatrix}1&0\\0&-1\end{pmatrix}$). To compute the isomorphism, I therefore need to find two (linearly independent) isotropic vectors of the form (and then complete the basis by a vector orthogonal to these two, and then adjust the coefficients).
My mistake was forgetting that the Clifford algebra generators do not have trace zero. In the case of the form $q = x^2 + xy + y^2 + 2 z^2$, the Clifford algebra is generated by elements $f_1, f_2, f_3$ such that $f_1^2 = 2$, $f_2^2 = 2$, $f_1 f_2 = 2 (1 -f_3)$, and $f_1 f_2 + f_2 f_1 = 2$. This implies, among other relations, $f_3^2 - f_3 + 1 = 0$, so that $\mathrm{Tr} f_3 = 1$.
As a basis of trace zero elements, I choose $g_i = 2 f_i - \mathrm{Tr} f_i$, which are in this case $(g_1 = 2 f_1, g_2 = 2 f_2, g_3 = 2 f_3 - 1)$; in this basis, my form becomes $8 x^2 - 8 xy + 8 y^2 + 3 z^2$.
Now, as I previously said, this form is anisotropic at $2$ and $\infty$, so that I choose $K = \mathbb Q(\sqrt{-2})$ as my quadratic extension. In this field, the Legendre theorem construction finds the rational point $(1:2:2\sqrt{-2})$, and then the standard parametrization of the conic is $(t^2+6t-3: 2(t^2-3): 2\sqrt{-2} (t^2+3))$. From this I find that in the basis $(1/4 g_1 + 1/2 g_2 - \sqrt{2}/2 g_3, -1/6 g_1 + 1/6 g_2 - \sqrt{-2}/3 g_3, \sqrt{-2}/2 g_2 - g_3)$, the form becomes $-xy - z^2$. Computing the inverse matrix for this and then recomputing the $f_i$ from the $g_i$, I find that the Clifford algebra is isomorphic to the algebra generated by the three matrices
$$ F_1 = \sqrt{-2}\begin{pmatrix}0&1\\1&0\end{pmatrix},
F_2 = \sqrt{-2}\begin{pmatrix}-1&-1\\0&1\end{pmatrix},
F_3 = \begin{pmatrix}0&-1\\1&1\end{pmatrix},$$
(Note: a change of basis was used to bring all of these to integral coefficients)
 - (We indeed check that $F_1^2 = F_2^2 = F_2 F_1+F_1 F_2 = 2$).
 - In the quaternion algebra $B_2=\left(\frac{-2,-3}{\mathbb Q}\right)$, ramified at $\{2,\infty\}$, where $i^2=-2$, $j^2=-3$, $ij+ji=0$, these are the elements $F_1 = i$, $F_2 = i/2+ij/2$, $F_3 = 1/2+j/2$.
Phew. At the end, it seems that option 1 was partly correct. Namely,
 - the quaternion algebra has discriminant $2$;
 - the quaternion order has discriminant $6$, which is the discriminant of $q$.
(And I mistakenly thought that a form with discriminant $6$ would always correspond to a maximal order in the quaternion algebra $B_6$).
So, the residual question is now: how to determine which forms of discriminant $d$ (square-free) correspond to maximal orders of $B_d$ ?
(Note: maybe this question would have been more appropriate on MO than here? I hesitated).
