Do we know what mathematician first considered, and perhaps named, what we call the group $\mathrm O(n)$, or $\mathrm{SO}(n)$, for some $n>3$?


I mean it specifically as group (not Lie algebra) acting on Euclidean $n$-space. For $n=3$ Jordan ([1868](//zbmath.org/?q=an:01.0306.06)) seems a definite upper bound, but for higher $n$ it seems not clear to me that even Cartan ([1894](//archive.org/details/surlastructured00bourgoog/page/n103)) thought in those terms, describing as he does $\mathsf B\_l$ and $\mathsf D\_l$ as “projective groups of a nondegenerate surface of second order in spaces of $2l$ and $2l-1$ dimensions.” Also please disregard any *implicit* occurrence of $\mathrm{SO}(4)$ in quaternion theory.



Emergence of the orthogonal group
Your quote about Cartan thinking of $B\_n$ and $D\_n$ as 'projective groups..." is actually Cartan describing the lowest dimensional *homogeneous space* of these groups (except, of course, for a few exceptional cases such as $D\_2$, which is not simple, and therefore should be left out of the description).


If you go just a little bit further in Cartan's 1894 Thesis, to Chapitre VIII, Section 9, you'll see that Cartan describes *linear* representations as well. For example, of $B\_\ell$, he writes "C'est le plus grand groupe linéare et homogéne de l'espace à $2\ell{+}1$ dimensions qui laisse invariante la forme quadratique
$$
{x\_0}^2 + 2x\_1x\_{1'} +2x\_2x\_{2'} + \cdots + 2x\_\ell x\_{\ell'}"
$$
with a similar description for $D\_\ell$.


In fact, he gives the lowest dimensional representation of each of the simple groups over $\mathbb{C}$, including the exceptional ones and, except for $\mathrm{E}\_8$, he explicitly describes the equations that define the representation. For example, he writes down an explicit homogeneous cubic in 27 variables and states that $\mathrm{E}\_6$ is the the subgroup of $\mathrm{GL}(27,\mathbb{C})$ that preserves this cubic form.


For the summary theorem on the linear representations, see Chapitre VIII, Section 10, where he lists each of the lowest representations and notes the various low dimensional exceptional isomorphisms as well.


**Remark 1:** Cartan continues to refer to groups of type $B$ and $D$ merely as "the largest groups preserving a quadratic form in $n$ variables" or similar terms for a long time. Even in his papers of 1913–1915 classifying the real forms of the complex simple Lie groups, he uses such terminology, though he clearly finds the special case of the compact real forms of special interest.


The first place that Cartan actually refers to 'orthogonal groups' that I can recall are in his 1926–27 papers on the classification of Riemannian symmetric spaces. There, he begins referring to any subgroup of $\mathrm{GL}(n,\mathbb{R})$ that preserves a quadratic form as '*an* orthogonal group' and then, later, finally refers to the maximal group that preserves a positive definite quadratic form as '*the* orthogonal group'. I don't recall when or whether he used any notation such as $\mathrm{O}(n)$ or $\mathrm{SO}(n)$.


Whether the term 'orthogonal group' was original to him, I can't say. By that time, of course, Weyl had already started his research on compact Lie groups, and it may be that Weyl had already used the term 'orthogonal group' well before Cartan.


**Remark 2:** Euler's article (*Problema algebraicum ob affectiones prorus singulares memorabile*, Novi commentarii academiae scientiarum Petropolitanae **15** (1770) 1771, 75–106) discusses the problem of parametrizing the solutions of the equation $A^TA = I\_n$ where $A$ is an $n$-by-$n$ matrix for $n=3$, $4$, and $5$, particularly the *rational* solutions. He does not use the terminology 'orthogonal' or 'group'. Nevertheless his article does contain some remarkable formulae that clearly anticipate the development of the algebra of quaternions.


For example, identifying $\mathbb{R}^4$ with the quaternions $\mathbb{H}$ in the usual way, it is a now-standard fact that every special orthogonal linear transformation $M$ of $\mathbb{R}^4=\mathbb{H}$ can be written, using quaternion multiplication, in the form $M(X) = A\,X\,\bar B$ where $A$ and $B$ are unit quaternions and $X\in\mathbb{H}$. (This is now the usual way that the double cover $\mathrm{Spin}(3)\times\mathrm{Spin}(3)\to\mathrm{SO}(4)$ is introduced.) Meanwhile conjugation $c:\mathbb{H}\to\mathbb{H}$ is orthogonal but has determinant $-1$, so every element of the non-identity component of $\mathrm{O}(4)$ can be written as $$M'(X) = Ac(X)\bar B = A\,\bar X\, \bar B = A\overline{BX} = Ac(BX).$$ Remarkably, Euler gives this formula for parametrizing $\mathrm{O}(4)$ in the form of the product of matrices $L\_A\,c\,L\_B$ (where $L\_P$ denotes left multiplication by the quaternion $P$), many years before the 'official' discovery of quaternions.


