Google Classroom
GeoGebraGeoGebra Classroom

Total Ellipse of the Heart

Here's an ellipse for you. Play with the focus A. (Its twin moves automatically.) These two foci belong to a whole bunch of ellipses, but point B selects just one of them. Play with point B. The line through B and the ellipse's center splits the ellipse in half. The slider flips one of those halves. Play with the slider.
Motivated by Howie Hua.

How was this made?

I often use GeoGebra to build interactive visual demonstrations of mathematical ideas. The mathematics required to make one of these gadgets is usually more complicated than the mathematics being demonstrated, and that's certainly the case here. I'm not even sure I had a mathematical demonstration in mind, beyond the ideas that
  1. An ellipse is a curve that is a little bit like a circle, and its construction has something to do with "foci";
  2. If you cut an ellipse the right way and flip one half over, you sometimes get a heart (the icon, not the organ--wouldn't THAT be neat!).
But what mathematics went into the production? The main technical challenge is that GeoGebra (at least version 5.0, which I'm using) doesn't have a command to make a filled half-ellipse. A filled half-ellipse is something people very rarely need, but I absolutely needed one if I was to build this toy. What GeoGebra does have is a few tools for making parts of circles. (Apparently I really like italics today.) It can also apply a matrix transformation to many shapes. So, I did about a page of algebra by hand in order to compute the matrices of a few linear transformations to do the following:
  1. Given the foci of an ellipse centered at the origin, transform that ellipse into the unit circle centered at the origin. (Also see where a given point on that ellipse goes, so I can relate any half of the ellipse to the corresponding half of the circle.)
  2. Given half of the unit circle, transform it back to fill the corresponding half of the original ellipse.
  3. Repeat #2, but include a parameter (controlled by the slider) in order to smoothly transition from exactly #2 to a version of #2 that is reflected across a line perpendicular to the indicated line.
It's been a minute since I last worked with ellipses. There might be a nifty shortcut that I've forgotten or never knew, but what I used was the idea that an ellipse is the set of all points whose total distance from the two foci is a given constant. My algebraic work was maybe 70% chewing on the distance formula (not "autopilot algebra", but not at all difficult after I recovered from one wrong turn, and there were more serendipitous cancellations than I'd expected) and 30% matrix algebra (this part was made a little easier by knowing the shortcut for inverting a 2x2 matrix, and a lot easier by thinking in terms of a change of basis). I think this is a project that a student could do by the end of a first course in linear algebra. The technical subtlety that gave me the best tickle was the fade effect. I have two overlapping filled half-ellipses. Both are visible before one of them gets flipped, but the stationary one fades out of view by the end of the flip. I want their combined opacity to match an unaltered half-ellipse at the start and end of the flip. I won't tell you how I did this, but you can take a look for yourself. If you want to look under the hood, here's what you do:
  1. Open a desktop installation of GeoGebra.
  2. Download my applet (or any GeoGebra applet, for that matter) from the Details screen (off the drop-down menu from the three dots in the top right corner, I think).
  3. Open the downloaded .ggb file in GeoGebra.
  4. Explore however you like, but I especially recommend that you use the Construction Protocol view to see the parts in the order in which they were built.
I'd like to close with a special thanks to Bonnie Tyler, without whom none of this would have happened. If you don't know what I'm talking about...please. The source material is from 1982. The song, aptly described by its composer as "an onslaught of sound and emotion", also has a music video that reaches epic levels of WHAT.