Intersection of Three Cylinders

Puzzle books I had as a kid often asked what the intersection of three cylinders looked like.  Even looking at the answer in the back, I still had trouble seeing it.  Making this video helped a lot.   The Sketch Up file that I used is available in the 3D Warehouse.

Cube Intersected by a Moving Plane

This is my first Sketch Up video.  It is surprising how many shapes the cross-section of a cube can take on, and how hard they are to visualize (for most of us).   The Sketch Up file I used is in the 3D Warehouse.

Polyhedral Waltz

Here is a new video Polyhedral Waltz.  I made the animation, and Maurice Page composed the music.   The video shows how Platonic Solids (regular polyhedra) inscribed in the same sphere fit together. If you click on the “cc” button on the player, you can see captions which show the name(s) of what you’re looking at (black with white background looks better than the default).

I’ve always liked polyhedra and been especially fascinated by the compounds, where several of the same Platonic solids intersect in symmetrical and pleasing ways:

Compounds of Five Cubes, Octahedra, and Tetrahedra

Compounds of Five Cubes, Five Octahedra, and Five Tetrahedra

Physical models of the compounds are hard to build — I made a model of the compound of five cubes from a kit and a less sturdy model of the tetrahedra from origami — but mostly I’ve seen them in museums and in flat pictures in books. I was amazed when I found out from the Geometricks books by Bonnie Roskes that it isn’t that hard to create a compound in Google (now Trimble) Sketchup; after some preliminaries, one “rotate-copy” command can turn one cube into the above compound of five cubes.

I was curious how different polyhedra that are the “same size,” meaning they can be inscribed in the same sphere, intersect. I knew, for example, that  cubes fit inside a dodecahedron,

One cube and Five Cubes in a Clear Dodecahedron

One cube and Five Cubes in a Clear Dodecahedron

but what about octahedra? I knew they peeked out from the sides of the cubes,

Cube and Octahedron, 5 cubes and 5 Octahedra

Cube and Octahedron, 5 cubes and 5 Octahedra

but did they also peek out from the dodecahedron?  Turns out they do.

Five Octahedra and Dodecahedron (Clear and Opaque)

Five Octahedra and Dodecahedron (Clear and Opaque)

I wanted to build all the Platonic Solids centered at the origin, with the same radius (of the circumscribed sphere) and then show and hide different combinations. I knew the results would have a lot of symmetry, and thus were likely to be pretty. Here are a few of my favorite combinations:

Blue = Icosahedron, Red = Five Cubes, Yellow = Five Octahedra

Blue = Icosahedron, Red = Five Cubes, Yellow = Five Octahedra

The model is in the Sketchup Warehouse (search for dborkovitz).   A lot is lost in seeing the static pictures; it’s more fun to rotate, hide, and show polyhedra yourself.

Two mathematically interesting issues came up in making the video. The first involved the tetrahedra. Two different tetrahedra can be inscribed in a cube. They are dual to each other, and together are called the stella octangula.

Stella Octangula

Stella Octangula

Since there are five different cubes that can be inscribed in the dodecahedron, and two different tetrahedra that can be inscribed in each cube, there are ten tetrahedra that can be inscribed in the dodecahedron.   The tetrahedra form two different compounds of five tetrahedra, whose intersection is the compound of ten tetrahedra.

Two different sets of five tetrahedra and their intersection

Two Different Compounds of Five Tetrahedra and Their Intersection

To make the model on the right, I “exploded” the intersection and repainted it by hand.  When I first let Sketchup intersect the model itself,  the model flickered back and forth between triangles in the two shades of purple, creating a headache inducing disco ball effect during the animation.  The circled “pentagon” below shows one of the areas where the flickering happened.

10 tetra with marked area

The Circled Area Flickered Between Colors

For quite a while I was convinced that the problem was either with Sketchup itself or with my inexperience in using Sketchup. Finally I asked for help on a Sketchucation forum,  and I found that what was happening was a common issue in 3D modeling called “z fighting:” Sketchup couldn’t decide which color to paint the areas, because I was telling it to paint the same planes two different colors.

The issue was mathematical, not technical — the dark purple areas are common to both sets of tetrahedra.   In retrospect, I see that my doubts about my Sketchup abilities muddled some basic mathematical thinking  — there are five planes in the circled region, and it looked like they “should” alternate between the two colors, but five is an odd number, so such alternation is impossible.

To avoid the flicker, I painted the intersecting areas a darker color; here is what the region looks like by itself.

Intersection of the Two Sets of Five Tetrahedra

Intersection of the Two Sets of Five Tetrahedra

(I am relying on the accuracy of Sketchup and of my model to claim that this is what the intersection looks like. )

The second mathematically interesting issue was deciding how to rotate the model in the animation.  At the end of each scene the polyhedra in that scene are in a different place than they were at the beginning, so if I wanted to introduce a new polyhedron in the next scene, I had to first rotate it into position.  I could have avoided the problem by using 360 degree rotations, but then the video would have either been too long or too fast. I decided that 90 degree rotations showed the features of the polyhedra well, and these rotations were also simple to do in Sketchup, as they used the built-in axes.

A sequence of six 90 degree rotations about the axes in the order green-red-blue-green-red-blue brings everything back to the start — this is the equivalent of rotating a cube twice about an axis through the midpoints of opposite edges.   I represented each rotation as a permutation of the four long diagonals of the cube, and worked things out algebraically.

I made the video in sets of six rotations.  For each scene change within a set,  I rotated all the polyhedra that appeared in any of the six scenes and then hid the polyhedra that weren’t in the next scene. This procedure was more efficient than rotating everything for every scene and then hiding most of the polyhedra (the model includes twenty-seven layers, where the visibility of each layer has to be checked or unchecked).


Some Technical Details:

I used the Keyframe Animation plugin, which was the only software I paid for in making the animation. Originally I used the built in Sketchup animation, which only animates the camera. With such symmetrical figures, keeping the figure still and rotating the camera looks like rotating the figure itself, so the native animation could have worked, but it was jerky and things kept getting shifted in ways I didn’t want. The keyframe animation gave me more control.   I also am planning to make some videos that show the polyhedra growing and shrinking, and the built in animation can’t do that.

I made all the 83 scenes in one sketch, which was too big to export without crashing my laptop, so I broke that sketch into six smaller files. I exported each file into a set of 1280 x 720 png files. I had seen on many forums that putting together stills made higher quality animation than exporting to an avi file directly from Sketchup, which did seem to be the case. I used FastStone Photo Resizer to rename the files so they were numbered correctly.

I used VirtualDub to make the stills into a video, with the XVid compression algorithm and running at 30 frames per second. It took a while to figure out how to get the individual parts of the video to fit together correctly, and I made some mistakes and had to run some patches. One big mistake was leaving VirtualDub open while I was running FastStone to add in 30 frames. FastStone kept the old file for the frame that was open and then after that every 30 frames had the wrong file. Fortunately the mistake was near the end of the video, so I could fix it by hand (there were over 12,000 image files, so I worked with the originals rather than keeping backups, which would have taken a long time to copy).

Initially I was unhappy with the visual quality of the video on YouTube — the video looks much better on my computer and on DropBox than on YouTube. I asked for help on Sketchucation, and got some suggestions, but they didn’t help that much. I asked Tessil Collins, who teaches video courses at my college, and he pretty much said that the video looked great for YouTube, so I mostly stopped worrying about the quality. The video looks much better with the lighter colors; the sides of the blue icosahedron are not as distinct, but I liked the blue enough to keep it.

I made the subtitles with Aegisub, which was straightforward to use. I made a style that looked nice on my computer, but then found that YouTube gives the user control over the font, color, and size of the subtitles, which makes sense for how subtitles are regularly used. I liked the idea of being able to turn the captions on and off, and didn’t want to embed them in the video directly, so I also stopped worrying about getting them to look as I preferred. With the names as captions rather than embedded in the video, they can also be more easily translated into other languages.

I made the introductory frames and credits using illustration software (I have Xara, but there are free alternatives) and used VirtualDub to copy the frames and export to an avi, and then to string together the pieces.

I showed an earlier draft of the video to my Fall 2012 Math 245: Geometry class, and they suggested some color changes, which I adopted. They also encouraged me to pursue including music with the video.

I asked Maurice Page, who also teaches math at my college, and who is involved in many musical pursuits, if he’d be interested in composing music for the video. He was cautious, saying that we’d probably need four or five iterations to get something we both liked, but I loved the first thing he sent me — which somehow was both not at all what I was expecting and also more-or-less perfect. I think the music makes the animation several orders of magnitude better. Maurice used imovie to put the score and animation together on his computer, and then later sent me an MP3 with just the music, which I added to the video using VirtualDub.

We debuted the music video at a math faculty meeting a few weeks ago, and the others there came up with the title; my working title, “Platonic Solids Inscribed in the Same Sphere,” was not very catchy.

Almost all the technical things I used in making this video were new to me — I learned to use Keyframe Animation, VirtualDub, FastStone, and Aegisub. I had tried to make the Sketchup model several years ago, but I couldn’t get it to be accurate enough, and enough time had passed that I needed to redo all the tutorials on how to make the polyhedra.

The video took a lot longer than I’d hoped (sigh, how often do we say this?) but I am very pleased with the result, and sometimes a bit amazed that I learned how to make a video like this.

Pick a Number Between 0 and 1 — with Fractions!

This applet is a pick a number game, where the secret number is a fraction between 0 and 1. Enter a numerator and denominator and the computer will tell you if your fraction is too high or too low, until you guess the Secret Fraction and win.

Your previous high and low guesses are listed on the page (unless you hide the list), and there is a number line that graphs the guesses. You can change the number of divisions in the number line; the labels update automatically.

The game has several levels. Level 1 uses only fractions with denominators 2, 4, and 8, whereas Level 6 uses denominators from 2 to 16.

The applet doesn’t fit well on the page with my website theme, so you can open a new window and try it here. (Note: if you don’t see a fraction in the pink box, go to the bottom of the page and choose, “View as Java Applet,” which is what I wrote this applet as.  It does not seem to have converted correctly to HTML 5).

This applet was the most challenging to write of all the GeoGebra applets I’ve written to date — I wasn’t sure it was possible to create this game using GeoGebra, so it was quite satisfying when it came together. Here were some of the tricky parts (you can download my original file here):


The Tangent is a Tangent!

In my post Trigonometry Yoga, I discussed how defining sine and cosine as lengths of segments in a unit circle helps develop intuition for these functions.

I learned the circle definitions of sine and cosine in my junior year of high school, in the class that would now be called pre-calculus (it was called “Trig Senior Math”). Two years earlier, I’d learned the triangle definitions of sine, cosine, and tangent in geometry class. I don’t remember any of my teachers ever mentioning a circle definition of the tangent function.

The geometric definition of the tangent function, which predates the triangle definition, is the length of a segment tangent to the unit circle. The tangent really is a tangent! Just as for sine and cosine, this one-variable definition helps develop intuition. Here is the definition, followed by an applet to help you get a feel for it:


\(k^x-x^k\) Slider and \(x^y=y^x\) graph

Use the slider to change the value of k, and to see dynamically how the graph of \(h(x)=k^x-x^k\) changes. Negative values have \(x^k>k^x\). Which value of k gives a graph that is never negative? Why?

Here is a very pretty graph of \(x^y=y^x\) with areas where \(x^y < y^x\) shaded in green and areas where \(x^y > y^x\) shaded in purple.

I am working on an article about some problems related to these equations, including The Biggest Product Problem. There’s a lot of interesting stuff here!

Farey Fraction Visual Patterns

The Farey Sequence, \(F_{n}\) is the list of all simplified fractions between \(\dfrac{0}{1}\) and \(\dfrac{1}{1}\) with denominator less than or equal to \(n\). For example,

  \( \large F_{5}=\dfrac{0}{1},\dfrac{1}{5},\dfrac{1}{4},\dfrac{1}{3},\dfrac{2}{5},\dfrac{1}{2},\dfrac{3}{5},\dfrac{2}{3},\dfrac{3}{4},\dfrac{4}{5},\dfrac{1}{1}\)

Duals of Platonic Solids Videos

After building the model I used to make the Polyhedral Waltz animation, I wanted to use it for other things.  I was particularly interested in trying the scaling feature of the Keyframe Animation plugin that I had not yet used.

One of my colleagues commented on seeing Polyhedral Waltz that the video showed dual polyhedra in a way that was more helpful than a static model, and I thought that with scaling, videos could show duality even better.

A dual is formed from a polyhedron by creating a vertex at the center of each face, and then connecting vertices on adjacent faces. This process is hard for most people to visualize without a model, and even with a static model, it can still seem abstract.

Here are three videos, in the order I made them: cube and octahedron, icosahedron and dodecahedron, and tetrahedra. These videos show pairs of dual polyedra, growing or shrinking one-at-a-time to fit inside or to surround the other. Read more >>

Linear Transformations with Graphics

I made this video when I was thinking about ways to teach the basics of linear transformations and matrices by illustrating their connections to computer graphics.  I wanted to show the actual matrix calculations that lead to the graphics, as well as a slider to show the graphics dynamically.  Since I made the video, GeoGebra added a spreadsheet, and it’s actually much easier and more versatile to do the same thing in GeoGebra (I’ll post that link soon).  However, it was a fun challenge to figure out how to push Excel to do graphics in this dynamic way.  To date, this is my most popular video on youtube.   Spreadsheet used in the video.

Pool Table Math with Excel (includes a Video)

This is a classic problem solving activity that I first saw many years ago in Mathematics: A Human Endeavor.   The NCTM has a nice applet to test cases one at a time.  

Since I like playing with Excel and trying to extend what it can do, I wrote a spreadsheet to represent the problem.  The end result is much better than expected — this representation uses a slider to show many cases in a short period of time, and with it I noticed patterns that I never had before (e.g. if you start at (1,0) on a rectangle whose sides have GCD=2, you get a loop that goes through all squares). Read more >>