Last edited 13dec10 by

Surf4D: Exploring Shadows of the Fourth Dimension


This program takes parametric coordinates for a four-dimensional surface and outputs a three-dimensional shadow that can be rotated in any direction.

Creating the Program

Work on my project began during the Mathematica presentation given to us at the beginning of the semester by Bruce Carpenter. While explaining the ParametricPlot3D function to us, Professor Francis remarked that one of the examples was a "very important surface". Deciding it could be useful, I copied down the parametric equations for the surface and plotted it in a Mathematica notebook to be used in the Cube.

After explaining my surface to the Professor, he explained to me and the class that this surface was a shadow of a flat torus. A torus is the surface that results from rotating a circle around another circle. The flat torus is a four-dimensional surface that occurs when rotating a circle in the XY plane around a circle in a plane on the Z axis and the fourth-dimensional axis. I will call this fourth coordinate W, meaning that the second circle is in the ZW plane.

The standard three-dimensional ring torus

The Professor went on to explain that the surface I had plotted was a shadow of this flat torus, because a four-dimensional object casts three-dimensional shadows, just as a three-dimensional object casts two-dimensional shadows. The surface was a projection of a four-dimensional surface. Since we cannot visualize a four-dimensional object very easily, we must find ways to represent it in three dimensions.

The shadow of the four-dimensional flat torus

It took me a while to settle on projection for the topic of my project, but as soon as I did I decided that I should expand beyond projecting only the flat torus. It was then that I conceived of the idea for a program that would take parametric coordinates for a four-dimensional surface and produce its three-dimensional shadow. I quickly realized that the same object could produce several different shadows. I immediately made the assumption that a four-dimensional surface had essentially four different shadows. I thought about shadows of three-dimensional surfaces, like a cone. A cone casts a circular shadow when the light source is directly above or below, but from any of the four sides it casts a triangular shadow. I reasoned that three dimensions meant three basic shadows, and that four dimensions meant four basic shadows.

I decided to do some research into the math that would be required to cast these four shadows. Instead, I stumbled upon a series of videos titled "Dimensions", a series of videos on Mathematics by French mathematician Etienne Ghys. These videos addressed projecting the fourth dimension, and in more ways than just casting shadows. However, my assumption that there were only four shadows to cast was quickly crushed by these videos when I realized that a cube could be rotated to cast a hexagonal shadow. The three "basic" shadows of a cube that I had conceived of were all squares, and yet a hexagonal shadow was possible. I realized that my program would not be sufficient if it merely produced four shadows. It would need to produce a single shadow that could change to represent the four-dimensional surface rotated in any direction. I felt overwhelmed by this task, as creating a shadow that could be changed at will seemed significantly harder than merely producing four solid surfaces.

At this point, the class was expected to give presentations on the topic of their project. I was unsure of how to proceed since I didn't know how to make the shadow that represented every rotation in the fourth dimension, let alone how to make a program that could do this for any surface in the fourth dimension. I decided to use DPGraph for my presentation and to use a lower-dimensional analogy to explain my idea to the class. I decided to cast the shadows of a helix into two dimensions, and then to show different shadows of the flat torus. I made many different plots in DPGraph to cast shadows of both the helix and the flat torus where I had removed a single dimension, and where I had added the fourth dimension to one of the other dimensions. For example, with the helix I took the basic surface and made three separate shadows by setting one of the dimensions equal to zero. These were the basic shadows I had conceived of much earlier. From there I would add the missing dimension onto each of the other dimensions in an effort to simulate rotation. I saved a copy of every possible combination of these changes for both the helix and the flat torus.

The helix I used to demonstrate two-dimensional shadows

During and after the presentation, Professor Francis gave me some feedback on my efforts at rotation. Adding the extra dimension to another dimension was a close attempt, but really I was just squashing the surface. The Professor had me add in coefficients of the sine and cosine of time to one of these surfaces during the presentation and suddenly I was looking at a shadow of a surface rotating in the fourth dimension.

The Professor started me off by explaining how to rotate two dimensions.

The formulas for rotating X and Y

In this case, the coefficient a is the number of radians of rotation. From this beginning, I realized that I could use these equations to rotate surfaces in higher dimensions as well. I would just need to use multiple rotation constants and multiply each of them. In three dimensions, there are three planes of rotation, XY, XZ and YZ. Therefore, I ended up needing three rotation constants, a, b and c. After working with the equations, I arrived at the equations for rotation in three dimensions.

The equatioons for rotating X, Y and Z

I tested these equations in DPGraph by applying them to the helix, replacing the x, y and z in the equations with the parametric equations, and sure enough, using the slider on a, b and c caused the surface to rotate. (I set the slider to rotate from 0 to 2 Pi so that I could cause the plane to rotate all the way around.) After testing it out on a three-dimensional surface, I tried applying it to its shadow by setting Z equal to 0 and keeping the other two equations the same. By using the sliders, the surface produced was the shadow of the three-dimensional surface, and it could be rotated in any direction.

After this success, I began the task of deriving the equations for rotation in four dimensions. There were six planes of rotation to deal with (the previous three, along with XW, YW and ZW) and so I used constants a through f. The task was simple but tedious, and I ended up with the unwieldy equations for rotation in four dimensions.

The equations for rotation in four dimensions

I tested my formulas on the flat torus in DPGraph by setting W to 0, and replacing the X, Y, Z and W with their corresponding parametric equations. The constants that did not rotate one of the W planes successfully caused the visible surface to rotate without changing the shape, while the other constants caused the surface to change as the four-dimensional flat torus rotated. The formulas were successful.

Using these functional formulas, I got to work on the programming aspect of the project. I decided to use Mathematica, seeing as it had all of the tools I needed readily available and it functioned in the Cube. I first used the formulas to recreate the flat torus, but I did it in such a way that the equations for X, Y, Z and W and their ranges could be easily replaced without changing the formulas. I had essentially finished my project at this point. I had created a program that took the parametric equations for a four-dimensional surface and produced fully rotational three-dimensional shadow out of it that would appear in the Cube. The only shortcoming in my project is the lack of control in the Cube. The surface can be rotated in any direction from the computer, but unfortunately the wand user cannot cause the rotations in the fourth dimension himself. I had hoped to add a button that would cause the rotation, but because I used Mathematica the controls are already set. To change the controls one would need to write the program in a different language or edit the Cube Mathematica program itself.

With my project complete, I was able to apply some new math with some help from the Professor and some of the "Dimensions" videos. Specifically, I was able to understand how complex numbers relate to the fourth dimension. A complex number with a single variable, X, can be plotted in two dimensions. For example, the complex number X = 5 + 4i could not be plotted on a one-dimensional number line because of the imaginary term. However, if we add a second axis, we can account for the real X's and the imaginary iX's. Carrying this over, complex numbers with two variables X and Y, can be plotted in four dimensions: X, Y, iX and iY. With this new knowledge, the Professor had me plot several new surfaces to demonstrate this concept. It is my hope that the project will be useful to future Math 198 students who wish to examine the fourth dimension or two complex numbers will be able to put my program to use.


Using Surf4D is simple, especially if you are familiar with Mathematica. First, under the first heading "Defining the Functions" set the parametric equations for X, Y, Z and W of the surface you want to view. Then, set the ranges for u and v. Make sure to evaluate the statements by pressing shift and return.

Under the second heading "Projecting the Shadow", there should be no need to edit anything. Make sure to evaluate all of the statements, and then you will be able to examine and rotate the shadow, using the sliders to rotate in the fourth dimension.


These links will take you to my Surf4D copies of the flat torus, a modified 4D Kuen surface, and a projection using logrithms, along with the cusp, square and monkey saddle created with help from the Professor.
Mathematica is required to use these programs.

This link will take you to the Dimensions website.