Distances between points on a sphere determine them up to isometry This is a self-answered question.
Let $v_i,w_i \in \mathbb{S}^n \subseteq \mathbb{R}^{n+1}$, $i=1,\dots,k$ be points on the sphere. Suppose that the Euclidean distances $\|v_i-v_j\|=\|w_i-w_j\|$ for all $i<j$.
How to prove that there exist an isometry $Q \in \text{O}(n)$ such that $Qv_i=w_i$?

This question is similar to this one, but here I do not assume independence, the number of points is arbitrary, and they lie on a sphere, so the mapping isometry is actually linear, not just affine.
Alternative solutions are welcome. In particular, I think that it's possible to reduce this question to the mentioned question above in a neat way.
 A: A matrix-theoretic proof is probably easier in this case, although it is conceptually more opaque. Given two real (tall, square or fat) matrices $V$ and $W$ of the same size, if $V^TV=W^TW$, we want to show that $QV=W$ for some orthogonal matrix $Q$.
Clearly $V$ and $W$ have the same rank $r$. Suppose $r>0$. By singular value decomposition, we can construct two rank factorisations $V=U_1R_1^T$ and $W=U_2R_2^T$ such that each $U_i$ has $r$ orthonormal columns and each $R_i$ has full column rank. From $V^TV=W^TW$ we obtain $R_1R_1^T=R_2R_2^T$. Therefore $R_1$ and $R_2$ have the same column space. Hence $R_1=R_2X$ for some invertible matrix $X$ and $R_2XX^TR_2^T=R_2R_2^T$. Since $R_2$ has full column rank, it has a left inverse. Therefore $XX^T=I$, i.e., $X$ is orthogonal. Pick any orthogonal matrix $Q$ such that $Q(U_1X^T)=U_2$. Then
$$
QV=QU_1R_1^T=QU_1(R_2X)^T=Q(U_1X^T)R_2^T=U_2R_2^T=W.
$$
A: The assumption implies $$\langle v_i,v_j \rangle=\langle w_i,w_j \rangle. \tag{1}$$
Let $\{v_i \,|\, i \in I\}$ be a maximal linearly independent set, where $I \subseteq [k]:=\{1,\dots,k\}$.
Since $\{v_i \,|\, i \in A\}$ is linearly independent if and only if $\{w_i \,|\, i \in A\}$ is linearly independent (as for any $A \subseteq [k], \|a^iw_i\|=\|a^iv_i\|$), $\{w_i \,|\, i \in I\}$ also a maximal linearly independent set.
Define
$$
Q:\text{span}\{v_i\,|\,\,i \in I\} \to \text{span}\{w_i\,|\,\,i \in I\}
$$
by setting $Qv_i=w_i$. $Q$ is an isometry.
Let $j \in \{1,\dots,k\}\setminus I$: Then for any $i \in I$,
$$
\langle Qv_j,w_i \rangle=\langle Qv_j,Qv_i \rangle=\langle v_j,v_i \rangle=\langle w_j,w_i \rangle. \tag{2}
$$
Note that $v_j,w_j$ belong to $\text{span}\{v_i\,|\,\,i \in I\}, \text{span}\{w_i\,|\,\,i \in I\}$ respectively (due to their maximality). Thus $Qv_j,w_j$ both belong to the independent set $\text{span}\{w_i\,|\,\,i \in I\}$, so equation $(2)$ implies that $Qv_j=w_j$. (This is because the distance to a linearly independent vectors on the sphere determines a point uniquely).
Since $\text{span}\{v_i\,|\,\,i \in I\}=\text{span}\{v_i\}_{1\le i \le k}$, we actually constructed an isometry
$$
Q:\text{span}\{v_i\}_{1\le i \le k} \to \text{span}\{w_i\}_{1\le i \le k}
$$
satisfying $Qv_i=w_i$ for every $1 \le i \le k$. Now it is easy to extend $Q$ to an isometry on all $\mathbb{R}^n$ as required.
