Equations Describing the Surface of an N-dimensional Hypersphere


Years ago, I opened a book to refresh my knowledge of the mathematics of general relativity and the foundations of quantum computing (same math, different domains). Unfortunately, the book suffered from the poor organization and opaque writing that characterizes many textbooks. If you already know the material, these books can serve as useful reference sources. If you are learning the material for the first time, they usually make the learning process much more difficult than it has to be.

The first page of the book in question introduced a set of variables using superscripts instead of subscripts, with no explanation other than for reasons which will appear later. Why not explain the reasons right there? Or perhaps the authors could have postponed the introduction of superscript notation instead of confusing the reader with what appears to be exponentiation in the subsequent exercises. A page or two later, for no apparent reason, the book presented a set of parametric equations defining an unspecified hypersurface and asked the reader to unparameterize the equations and determine the location of two points in relation to the hypersurface. Even though I understood the material, I thought the lack of exposition (not even a single picture) and disorganized presentation would confuse a new student of the subject. Because I needed something to write about for an experiment in producing math content in HTML5 and PDF from the same source, I decided to write a better-developed, but doubtless imperfect, presentation of the exercise.

Prerequisites. A knowledge of the Pythagorean theorem and trigonometric functions is rquired to understand the material.

Revision History
Revision 1.0.22022-01-01 

Elaborated footnote on V as a mnemonic.

Revision 1.0.12022-01-01 

Added missing spherical coordinates to Figure 2 despite the clutter.

Revision 1.0.02021-12-29 

First (very rough!) draft.

PDF version of article

Equations Describing the Surface of an N-dimensional Hypersphere

Daniel F. Savarese
(Version: 1.0.2, 2022-01-01)

We introduce the concept of an N-dimensional space and define a surface as a subset of points in that space that divides the space into two parts. We generalize the parametric equations of a circle in two dimensions and a sphere in three dimensions to those of the surface of an N-dimensional hypersphere. Finally, we unparameterize the equations, reducing them to a single multivariable equation of the form F(x1,x2,,xN), and show that F>0 corresponds to the region outside of the hypersphere, F<0 corresponds to the interior of the hypersphere, and F=0 corresponds to the surface of the hypersphere.

copyright: ©2021 Daniel F. Savarese

1. N-dimensional Spaces

Coordinates are variables grouped together for analytical purposes. We most often relate coordinates to two- or three-dimensional physical spaces, such as when noting the locations of chess pieces on a chess board or using GPS (Global Positioning System) coordinates to navigate aircraft. But coordinates need not represent physical locations. Any function of one or more variables may be plotted as a set of points in a coordinate system. Nor must coordinates be limited to two or three dimensions. If we were to track the position of an object in three-dimensional space through time, we would require four coordinates: (x1,x2,x3,t), where the first three coordinates identify the position in space and t the position in time.

Visualizing a function in two or three dimensions helps us analyze its properties. Although it may not be possible to do the same in higher dimensions, we can project higher-dimensional artifacts onto a lower-dimensional space to help our visually-oriented brains reason about them. Alternatively, we can reason about a higher-dimensional artifact by analyzing its lower-dimensional analogues. For example, a square has a surface (i.e., its perimeter) formed by line segments equal in length and corners formed by the meeting of two line segments at right angles. A cube has a surface formed by squares equal in area and corners formed by three line segments meeting at right angles to each other. A four-dimensional hypercube has a surface formed by cubes equal in volume and corners formed by four line segments meeting at right angles to each other.

To fully generalize the analysis of multivariable systems, we do not restrict ourselves to a specific number of dimensions. Instead, we work with an unspecified positive integral number of dimensions, denoted by N. We notate the variables of the system as a set of coordinates, (x1,x2,,xN). A particular set of values for the coordinate variables is a point and the universe of possible points in the system comprises an N-dimensional space. The range of coordinate values may be finite or infinite. In either case, we represent a space with VN.111We could choose any letter, but V works as a mnemonic for either vector—as in vector space—or volume—as in if a surface VN-1 is an analogue of area, then a space VN is an analogue of volume.

2. A Degenerate Case: The Circle

Before describing the surface of an N-dimensional hypersphere, we will examine the degenerate case of the surface of a two-dimensional sphere, commonly known as a circle. The surface of a circle is the set of all points a constant distance—called the radius—from a central point. The circle itself is comprised of the surface and all the points inside the surface. Therefore, the surface divides space into two regions: points inside of the surface and points outside of the surface. You may notice we made no reference to the number of dimensions. It so happens that the definition applies to any hypersphere of two or more dimensions. For the circle, we will work with only two dimensions.

Figure 1. The geometry behind the parametric equations of a circle.

Looking at Figure 1, another way to think of a circle is that it traces out every possible right triangle with a hypotenuse equal to the length of the radius. The hypotenuse of each triangle extends from the center of the circle to a point (x1,x2) on the circle’s circumference, forming an angle θ with the x1 axis. From the trigonometric definitions of sine and cosine and a visual analysis of the figure, we can see the following relationships:


Solving for the coordinates in terms of the angle yields the parametric equations of a circle,

x1=rcosθandx2=rsinθ. (1)

We can use the Pythagorean theorem to arrive at the algebraic equation of a circle directly,

x12+x22=r2. (2)

But let us derive it from the parametric equations so that we can benefit from the approach later. Recognizing that sin2θ+cos2θ=1—an identity resulting from the Pythagorean thereom—we simplify as follows:


Although Equations 1 and 2 should be obvious to a middle- or high-school student who has taken a course in analytic geometry, we reviewed them to make clear their relationship to the equations of a fully generalized N-dimensional hypersphere in Section 4.

Before moving on, observe that for all points inside the circle, x12+x22<r2 must be true; and for all points outside the circle, x12+x22>r2 must be true. If we rewrite Equation 2 as

x12+x22-r2=0, (3)

we can re-express the division of space in terms of the values taken on by the resulting function,

F(x1,x2)=x12+x22-r2{<0is inside of the circle;=0is on the surface of the circle;>0is outside of the circle. (4)

It should be clear that for a point to lie inside of the circle, the distance from the center of the circle to the point, x12+x22, must be less than the radius of the circle. Likewise, the distance must be greater than the radius for the point to lie outside of the circle. The distance is equal to the radius for points lying on the surface of the circle.

3. A Special Case: The Sphere

Having analyzed the equations of a circle, we can make a similar geometric analysis to arrive at the equations for the surface of a sphere. Whereas a point on a circle can be located with two parameters—a radius r and an angle θ—a point on a sphere requires three parameters—a radius r and two angles, θ1 and θ2. The coordinate system of a circle is known as a polar coordinate system and the coordinate system of a sphere is known as a spherical coordinate system. We will parameterize the Cartesian coordinates of a point on a sphere in terms of spherical coordinates before rewriting them as a single algebraic function.

Figure 2. The geometry behind the parametric equations of a sphere.

Figure 2 shows the spherical and Cartesian coordinates of a point P on a sphere. By combining visual inspection with geometric and trigonometric identities, we can express (x1,x2,x3) in terms of (r,θ1,θ2). First, we look at the right triangle formed by the origin, the point P, and the projection of P onto the x2x3 plane. The spherical radius r forms the hypotenuse of the triangle and x1 is its height. The angle formed at point P is equal to θ1, being the alternate interior angle formed by the x1 axis and the side of the triangle parallel to it. Thereby we arrive at our first equation,

cosθ1=x1r,which impliesx1=rcosθ1.

The base of the triangle must then have a length equal to rsinθ1. This forms the hypotenuse of the right triangle in the x2x3 plane, allowing us to write

cosθ2=x2rsinθ1,which impliesx2=rsinθ1cosθ2.

Finally, the side opposite θ2 is equal to x3, giving us

sinθ2=x3rsinθ1,which impliesx3=rsinθ1sinθ2.

We now have the parametric equations of a sphere,

x1=rcosθ1;x2=rsinθ1cosθ2;x3=rsinθ1sinθ2. (5)

As with the circle, we can either use the Pythagorean theorem directly to express the distance between two points—the origin and P—in three dimensions, or we can derive an expression from the parametric equations. Using the approach we used to arrive at Equation 3, we can eliminate the angles as follows:


This allows us to write the spherical equivalent of Equation 4 as

F(x1,x2,x3)=x12+x22+x32-r2{<0is inside of the sphere;=0is on surface of the sphere;>0is outside of the sphere. (6)

4. The General Case: An N-dimensional Hypersphere

Based on the circle and the sphere, we can infer that a point on the surface of an N-dimensional hypersphere can be located with a radius r and N-1 angles, written as (r,θ1,θ2,,θN-1). Alternatively, one can use N coordinates corresponding to the position along N mutually perpendicular axes, written as (x1,x2,,xN). The angles and perpendicular axes create the same trigonometric relationships as in the lower-dimensional cases. For example, a four-dimensional hypersphere’s coordinates can be written as (r,θ1,θ2,θ3) or (x1,x2,x3,x4), producing the following equations:

x1=rcosθ1;x2=rsinθ1cosθ2;x3=rsinθ1sinθ2cosθ3;x4=rsinθ1sinθ2sinθ3. (7)

These can be generalized to N dimensions as follows:

x1=rcosθ1;x2=rsinθ1cosθ2;x3=rsinθ1sinθ2cosθ3;=;xN-1=rsinθ1sinθ2cosθ3sinθN-2cosθN-1;xN=rsinθ1sinθ2cosθ3sinθN-2sinθN-1. (8)

Using the same technique we used to arrive at Equations 4 and 6, we eliminate the angles, producing

x12+x22+x32++xN-12+xN2 =r2(cos2θ1+sin2θ1(cos2θ2+
x12+x22+x32++xN-12+xN2 =r2.

We can now write the general equation for the surface of an N-dimensional hypersphere as

F(x1,x2,,xN)=i=1Nxi2-r2{<0is inside of thehypersphere;=0is on the surface of thehypersphere;>0is outside of thehypersphere. (9)

Throughout this presentation we have assumed the origin of the coordinate system is the center of the hypersphere. In order to account for the center being located at an arbitrary point (x10,x20,,xN0), we can further generalize the equation for the surface of a hypersphere as

F(x1,x2,,xN)=i=1N(xi-xi0)2-r2=0. (10)