The Sphere can be isometrically embedded into . Geodesics are always great arcs. Take two points , i.e. both are unit vectors . Assume first, they are not antipodal. Then the plane given by the origin, and is unique and we obtain two ways to get from to in this plane; both are great arcs and the shorter one is the shortest path on from to . This situation in the plane is equivalent to looking at the within this plane.
If and are antipodal and we are on 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 the points , and the origin
lie on a line and any plane yields the situation from the , but
there are also infinitely many such planes.
As a visualization imagine the north pole being and the south pole being . 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 .
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 belongs to the ONB and hence it diagonalizes the curvature tensor along , i.e. the eigenvalues for all , and zero for the first value.
 Add (Gaussian white) wrapped noise

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 , i.e. in of some data this function adds white Gaussian noise (componentwise) to a zero tangent vector and perform an exponential map , where is Gaussian noise on .
 The distance on the sphere

1
% d = dist(p,q) distance between x,y on the manifold Sn.
The distance on the sphere is defined for any , as the length of a shorter segment connecting them of a great circle in a plane containing , 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. there are infinitely many great circles, for any of which both segments we have the length . 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 is isometrically embedded into we obtain the inner product of two tangential vectors 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 is given for and 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 is defined for , not antipodal to , 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 along a geodesic (where uniqueness is determined) by the logarithmic map implementation) by
more