$\DeclareMathOperator{\arccosh}{arccosh} \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator{\Exp}{Exp} \newcommand{\geo}{\gamma_{\overset{\frown}{#1,#2}}} \newcommand{\geoS}{\gamma} \newcommand{\geoD}{\gamma_} \newcommand{\geoL}{\gamma(#2; #1)} \newcommand{\gradM}{\nabla_{\M}} \newcommand{\gradMComp}{\nabla_{\M,#1}} \newcommand{\Grid}{\mathcal G} \DeclareMathOperator{\Log}{Log} \newcommand{\M}{\mathcal M} \newcommand{\N}{\mathcal N} \newcommand{\mat}{\mathbf{#1}} \DeclareMathOperator{\prox}{prox} \newcommand{\PT}{\mathrm{PT}_{#1\to#2}#3} \newcommand{\R}{\mathbb R} \newcommand{\SPD}{\mathcal{P}(#1)} \DeclareMathOperator{\Tr}{Tr} \newcommand{\tT}{\mathrm{T}} \newcommand{\vect}{\mathbf{#1}}$

# The Sphere $\mathbb S^n$

The Sphere $\mathbb S^n$ can be isometrically embedded into $\mathbb R^{n+1}$. Geodesics are always great arcs. Take two points $x,y\in\mathbb S^n\subset\mathbb R^n$, i.e. both are unit vectors $\lVert x\rVert=\lVert y\rVert=1$. Assume first, they are not antipodal. Then the plane given by the origin, $x$ and $y$ is unique and we obtain two ways to get from $x$ to $y$ in this plane; both are great arcs and the shorter one is the shortest path on $\mathbb S^n$ from $x$ to $y$. This situation in the plane is equivalent to looking at the $\mathbb S^1$ within this plane.

If $x$ and $y$ are antipodal and we are on $\mathbb S^1$ then we have two great arc that span exactly a half circle, so both are of same length and both are geodesics. For the general sphere $\mathbb S^n$ the points $x$, $y$ and the origin lie on a line and any plane yields the situation from the $\mathbb S^1$, but there are also infinitely many such planes.
As a visualization imagine the north pole being $x$ and the south pole being $y$. Then any longitudal great arc is a geodesic.

Since the embedding is isometric, the metrics in the tangential spaces are directly given by the metric on $\mathbb R^{n+1}$.

### Functions

The orthonormal basis in a tangent space
1
% xi = TpMONB(x,y) compute an ONB in TpM, with first pointing to q


This function computes an ONB where the $\xi_1=\log_x y$ belongs to the ONB and hence it diagonalizes the curvature tensor along $\geo{x}{y}$, i.e. the eigenvalues $1$ for all $\xi_k$, $k>1$ and zero for the first value.

1
% fn = addNoise(f,sigma) add Gaussian tangential noise to f w/ deviation sigma


Add noise to the data, which is done by adding Gaussian noise and “wrapping” it to the $\mathbb S^n$, i.e. in $T_x\M$ of some data $x\in\M$ this function adds white Gaussian noise (componentwise) to a zero tangent vector and perform an exponential map $x_{\text{noisy}} = \exp_x(\eta)$, where $\eta$ is Gaussian noise on $\mathbb R^n$.

The distance on the sphere
1
% d = dist(p,q) distance between x,y on the manifold Sn.


The distance on the sphere $\mathbb S^n$ is defined for any $x,y\in\mathbb S^n$, $x$ as the length of a shorter segment connecting them of a great circle in a plane containing $x,y$, and the origin. This circle is unique (and so is the shorter segment) if the two points are not antipodal. If they are antipodal, i.e. $x=-y$ there are infinitely many great circles, for any of which both segments we have the length $\pi$. Hence the length and therefore the distance is always uniquely determined. The formula reads

The inner product on the sphere
1
% ds = dot(x,xi,nu) inner product of two tangent vectors in T_xSn


Since the manifold $\mathbb S^n$ is isometrically embedded into $\mathbb R^{n+1}$ we obtain the inner product of two tangential vectors $\xi,\nu\in T_x\mathbb S^n\subset\mathbb R^{n+1}$ from the embedding space.

The exponential map on the sphere
1
% y = exp(x,xi) exponential map at x with direction xi in TxM


The exponential map on the sphere $\mathbb S^n$ is given for $x\in\mathbb S^n$ and $\xi\in T_x{\mathbb S^n}$ by the formula

The logarithmic map on the sphere
1
% xi = log(x,y) logarithmic map at x of y.


The logarithmic map on the sphere $\mathbb S^n$ is defined for $x,y\in\mathbb S^n$, $x$ not antipodal to $y$, by

The parallel transport the sphere
1
% eta = parallelTransport(x,y,xi) transport xi from TxM parallel to TyM


This function parallel transports a vector $\xi\in T_x\mathbb S^n$ along a geodesic $\geo{x}{y}$ (where uniqueness is determined) by the logarithmic map implementation) by

more