Posts

  • Math in Movies: The Friendship Games Geometry Problem

    (Very minor spoilers for Friendship Games. Read at your own risk.)

    (Click on any image to see the full size photo.)

    It’s not well known outside the fandom, but My Little Pony: Friendship is Magic has a high school spinoff called Equestria Girls. It’s a movie series that exists only because of the merchandise potential. Reception to the films is mixed, but it’s widely agreed they’re nowhere near as good as the show.

    The most recent entry, Friendship Games, came out September of this year. It’s…well, it’s definitely a movie. The pacing is off, the plot is silly, and the world stretches suspension of disbelief way too much. (Magic is real, humans are growing wings, there’s a portal to an alternate universe, and no one outside the school knows about it despite almost no attempts to hide it. Really?)

    That being said, I still enjoyed it. The animation is excellent, and the songs are catchy. Here’s one of those songs.

    This segment is a ton of fun. It gets so much mileage out of facial expressions and body language, the way good animation should. I’d also like to point out all the badass science and carpentry these girls are doing. Hooray for casually breaking gender stereotypes!

    But, that’s not what this blog post is about. It’s about this frame.

    first scene

    Wait. Is that…

    second scene

    It is.

    third scene

    It’s Euclidean geometry.

    Let me explain why this is the best thing ever.

    I did math contests in high school. My favorite subject was Euclidean geometry. I took a course on Euclidean geometry for math contests. I made honorable mention in Bay Area Math Olympiad because I knew about radical axes. This is an animation of two high school students competing on a geometry problem. THIS WAS ACTUALLY MY LIFE. One huge part of my identity got animated into another huge part of my identity. It’s so wonderful.

    And the animators didn’t half-ass it either. These chalkboards look like valid geometry proofs. There’s no immediate reason to believe they aren’t. I wonder if the proof’s correct…

    Cue the nerdsniping.

    ***

    To investigate this, I first gave the animators the benefit of the doubt and assumed it was real. There’s a good reason to assign a high prior on this. The time travel episode from season 2 of Friendship is Magic included equations from special relativity describing time dilation. The 100th episode had a free body diagram and several equations from Newtonian physics. I give the team a lot of respect on attention to detail. At this point, they could add Fermat’s Last Theorem as an Easter egg and I wouldn’t bat an eye.

    Let’s chase that assumption for a bit. It’s easiest to see the diagram at the start and end of the contest.

    second scene

    ninth scene

    On a closer look, the diagram looked vaguely familiar. Let’s set that aside for now and ask what else we can figure out.

    At the beginning, there’s no text accompanying the diagram, so the problem must require no additional detail. At the end, the writing on the chalkboard only involves lines, triangles, and angles. Notably, no trigonometry and no side lengths. If it is a real problem, then it’s an angle chasing problem. Yet for an angle chasing problem, this is a surprisingly long proof. In my experience, angle chasing is pretty short, but Sunset and Twilight have filled an entire chalkboard with derivations.

    (Again, at this point it’s only likely this is a real proof. What I’m doing here is finding out what a real proof would imply to help narrow down what the problem is. Based on how easy/hard it is to find a problem matching those deductions, I can adjust how likely I believe the proof is real. It’s possible the animators made a new geometry problem just for this movie, but I don’t think they’re crazy enough to do that for 25 seconds of animation.)

    After some searching, I found the World’s Hardest Easy Geometry Problem. It hits all the key details: it uses only angles, requires only basic geometry, and has a difficult solution. I had actually seen this problem several years ago, which explains why the problem looked so familiar. The solution is \(x = 20^\circ\), which matches the answer from the movie.

    side by side answer

    and the given angles match up

    side by side diagram

    and \((180 - 80) / 2 = 50\) shows up in both proofs.

    side by side 50

    Jackpot.

    Verification

    It’s certain this is a real geometry problem and proof. The only question left is to see how accurate the animators were.

    Unfortunately for geometry enthusiasts, the movie spends very little time on the proof. Most of the proof is in this montage.

    gif of proof scene

    Stepping through this frame by frame gives the money shot.

    fifth scene

    This is the clearest shot of the chalkboard in the entire sequence. It’s also only shown for 0.2 seconds. A lot of work, for something that people will barely notice. The text lines up exactly with the second section of the proof.

    middle of proof

    However, it’s not perfect. Neither character draws the parallel to \(AB\) through \(D\), so there’s no point \(F\). Also, neither character draws segment \(AF\), so there’s no point \(G\). They’re both pulling these points out of nowhere. (If curious, click here for the diagram with added lines.) Also, the derivation \(\angle CDF = \angle CAB = 70 + 10 = 80^\circ\) has a small animation error. They accidentally drew \(- 80^\circ\) instead of \(= 80^\circ\).

    The rest of the montage has nothing new. There’s this shot

    sixth scene

    which is a closeup of the top line of the second section, and this shot

    seventh scene

    which is a closeup of the \(\angle DEF = 30 + x = (180 - 80)/2\) line.

    The first section of the proof only appears in the final shot. I had to zoom to see it, so it’s a bit blurry.

    proof start

    It reads

    \[\angle ACB = 180 - (10+70) - (60+20) = 20^\circ\] \[\angle AEB = 180 - 70 - (60+20) = 30^\circ\]

    which again lines up with

    original proof start

    The ending of the proof is best seen in the two closeups

    third scene

    fourth scene

    which gives the final lines

    \[\triangle ACG \cong \triangle CAE\] \[FC - CE = FA - AG = \overline{FE} = \overline{FG}\] \[\overline{FG} = \overline{FD}, \overline{FE} = \overline{FD}\]

    There are some more errors here. Sunset derives \(\angle CDF = \angle CAB = 70+10 = 80^\circ\) after writing \(\overline{FE} = \overline{FG}\); she’s proving things out of order. There’s no way she can justify \(\overline{FC} - \overline{CE} = \overline{FA} - \overline{AG}\) before that line. (Points to Twilight for proving things in the right order. It could be a subtle way to show Twilight is better, but it’s probably an error.)

    Going back to the original proof, both characters skipped stating triangles \(\triangle DFG\) and \(\triangle AGB\) are equilateral. However, that’s reasonable. They’ve shown the angles of \(\triangle DFG\) and \(\triangle AGB\) are all \(60^\circ\), so the equal side lengths are implied. They also skipped justifying \(\overline{FC} = \overline{FA}\) from isosceles \(\triangle FCA\), and didn’t prove \(CG\) is the angle bisector of \(\angle C\), but these are also reasonable skips given the diagram.

    Overall, I’m impressed the animators got as much right as they did. It also shows that Sunset almost, almost solved the problem, since her only error is an arithmetic mistake at the end. Sometimes that’s how these things go. Now that I’ve done all of this, I actually like this scene more. Sunset Shimmer’s fall to villainy was based around a desire to be the best at all costs, and her redemption is about her anxiety at failing to make up for all the damage she caused. With all the self-loathing and setbacks she goes through, it’s easy to forget she’s almost as good as Twilight.

    Nice job team! Now, if only you remembered how to spell…

    spelling gif

    Comments
  • A Proposition For The Formula to Humor

    DISCLAIMER

    Wrote this only to remind myself to keep practicing my writing. Persons criticizing the stodgy language or lack of polish will be prosecuted; persons pointing out the copious bullshit will be banished; persons noticing this disclaimer’s unoriginality will be shot.

    By Order of the Author, Per G.G., Chief of Ordnance

    Also, I am at most 50% serious about all of this.

    Abstract

    Humor and jokes have experienced a great surge in popularity, which can attributed to the creation of more efficient delivery systems, like the Internet. However, the field of humor analysis is still notably underdeveloped. We posit a hypothesis on a formula describing the humor of a joke as a product of factors that depend on the speaker, the joke’s content, and the listener, in the hopes that this will inspire society to think about why it considers something to be funny, instead of taking it as a given. As evidence, we use material from professional comedians, and math puns that have made the rounds in mathematician subculture folklore.

    Clearing Misconceptions

    One common criticism against the field of humor analysis is that explaining a joke ruins the joke. Thus, much like the goto statement, detractors say that analyzing humor should be considered harmful. This misconception is misguided and often forms the bases of most criticism against the field, so we would like to briefly explain away these worries.

    First of all, humor analysis is the study of humor in general. This involves making grand, sweeping statements about why we consider jokes to be funny, without leaking or exposing any information about the jokes themselves, and this indirect analysis is what lets us make progress while minimizing joke destruction.

    Secondly, it is arguable whether explaining a joke is harmful at all. Suppose a listener hears a joke, gets it immediately, then hears an explanation of the joke. That listener’s enjoyment is not ruined by hearing that explanation, because the listener already has an implicit representation of that explanation in their head. Now, suppose a listener hears a joke, and does not get it. Then that listener has so far received zero entertainment from the joke, and hearing an explanation can only increase that entertainment. And in some rare cases, explaining the joke can itself be a joke. This is known as meta humor, and is outside the purview of this post. For further discussion, see [1]

    We admit that this argument for humor analysis is informal, and that there are other complicating factors, To be frank, we will not give a shit, and will proceed with the analysis regardless.

    Notation

    It is a well known fact that including unneeded mathematical notation makes text more persuasive and legitimate. Thus, we formalize some notation that will be used in later sections.

    \(J\) will represent the set of all jokes, and \(j\) will represent a joke from that set. \(P\) will represent the set of all people, and \(p\) represents a person from that set. \(H: P \times J \times P \rightarrow R\) denotes the humor function. We assume humor depends on the person saying the joke, the joke’s content, and the person hearing the joke. This will often be written as \(H(p_s, j, p_l)\), where the subscripts indicate “speaking” and “listening” respectively. The output is a real value, denoting how funny \(p_l\) finds joke \(j\) when it is delivered by \(p_s\).

    Lest people worry about drowning in notation, we have endeavored to explain all further equations with English as well.

    Proposed Humor Formula

    We propose that humor is the product of three factors: the inherent funniness of the joke when delivered by the speaker, the amount of education needed to understand the joke. and the amount of sleep deprivation the listener has.

    More formally, let \(I(j, p_s)\) be the inherent humor joke \(j\) has when delivered by \(p_s\), \(E(j)\) be the amount of education needed, and \(S(p_l)\) be the amount of sleep deprivation the listener has. Then

    \[H(p_s, j, p_l) = I(j,p_s)E(j)S(p_l)\]

    We spend the rest of the post explaining the reasoning behind these terms.

    The Inherent Humor Term, \(I(j,p_s)\)

    Clearly, different people will find different jokes funny. Given the wide variability, it doesn’t seem reasonable to talk about inherent humor. However, professional comedians are a counterexample to this line of reasoning. These people make a living doing stand-up or creating comedy sketches that a wide range of people enjoy. They can do this because most of their jokes are inherently funny. Behind the scenes, show hosts like Jon Stewart and Stephen Colbert spend hours crafting jokes that are likely to work on a wide audience (that have high inherent funniness), then spend more hours rehearsing their material (improved delivery makes a joke funnier. Note this is why this term depends on the speaker as well as the joke.)

    The Education Term, \(E(j)\)

    PhD comics

    Fig 1. Prior work on the link between education and humor. [2]

    Consider the following example jokes from math.

    Q: “What’s purple and commutes?”

    A: “An abelian grape!”

    Q: “What’s sour, yellow, and equivalent to the Axiom of Choice?”

    A: “Zorn’s lemon!”

    The first joke requires knowing abstract algebra, since it is a play on “abelian group”. The second requires knowing some foundational mathematics, as it is a play on “Zorn’s lemma”. Both of these jokes have terrible inherent humor. (Should you disagree, we advise getting a second opinion immediately.) But, because they use obscure concepts from math at the university level, they still demand a chuckle from people “in the know”. We call this the phenomenon privileged shared knowledge. People with privileged knowledge know something that the average person does not know. A group with privileged shared knowledge knows they all know something the average person does not know. When someone delivers a joke, it is implied that person knows the background required to understand the joke as well. Thus, listeners “in the know” have privileged shared knowledge with the speaker. This triggers a deep seated tribal mentality, where the tribe is everyone who knows abstract algebra, or everyone who knows about the Zorn’s Lemma. Once included in this tribe, the listener gives the speaker and joke much more leeway, and will consider what the speaker says to be considerably funnier than it actually is.

    As further evidence, consider this especially extreme case.

    It’s an old joke that a mathematician is a device for turning coffee into theorems. However, it’s also true that a comathematician is a device for turning cotheorems into ffee.

    The first joke is slightly funny on its own, and is further elevated because it mentions “mathematicians” and “theorems” in passing. However, the second joke has no inherent humor at all. It is only funny if you know a little bit of category theory. [3] Then, as if by magic, it suddenly becomes humorous. Not only do you need to know category theory, you need to know that there is an old joke that mathematicians are coffee -> theorem converters. By this point, anyone who has all the requisite background information must find it funny.

    This also explains why people feel “left out” when they “don’t get” a joke. Because they do not have the privileged shared knowledge, they are excluded (or “left out”)) from the tribe. They are forced to rely on the inherent humor, and unfortunately jokes like these math puns have terrible scores in that department.

    As a side note, this observation seems naturally extendable to Internet memes and in-jokes. For memes, the privileged shared knowledge is knowledge of the meme itself. For in-jokes, the privileged shared knowledge is the context in which the in-joke was first created. We leave finding examples of this to the reader, but suggest Reddit threads as a good starting point.

    The Sleep Deprivation Term, \(S(p_l)\)

    The final term we propose is the tiredness of the listener. When especially tired, people are more likely to find things funny than they normally would be. One possible explanation for this is that it is a subcategory of the privileged shared knowledge, where living through the context of no sleep is the common information. However, this does not accurately why a joke that is funny at 3 AM is no longer funny the next morning, as everyone involved should still have the shared context. Somehow, the joke becomes less funny, even when said from the same speaker to the same listener.

    Therefore, humor must depend on some temporal structure. We propose that sleep deprivation makes jokes funnier because the brain is less able to judge a joke due to stress and fatigue. When we are told we are about to hear a joke, our brains start expecting humor, and primes our mental state with a baseline level of funniness. As the brain hears and considers the joke, further adjustments are made to this value, and eventually we decide on the humor level and laugh/facepalm appropriately. When tired, the listener’s brain gets less computation time, giving less time to adjust the baseline value. In this scenario, the final humor output relies more on the primed state, explaining why jokes can be funnier deep into the night; the joke itself was awful, and we simply did not have the time to realize it.

    Note this also suggests that especially good jokes are not as funny when tired, since our brains have less time to adjust the internal humor value upwards. This lines up with our anecdotal experience, and therefore must be true.

    Conclusion

    The great surge in viral videos and memeing, as fueled by the Internet, has made humor analysis an exceptionally useful field. Should the trend continue, we believe considering questions like this one will continue to be useful in the future. We hope this incredibly dumb post inspires future work, which will ideally be much more insightful.

    References

    1. Don’t Explain the Joke - TVTropes
    2. PhD Comics - Your Shrinking Sense of Humor
    3. Joke Explanation of Comathematicians - Math StackExchange
    Comments
  • How An Audio Play About a Time Traveling Pony Turned Me Into a Fanboy

    Life is really unpredictable.

    You know the cliche interview question,

    “Where do you see yourself in five years?”

    There’s the answer you’re supposed to give: “At the same company, but higher up the ladder.” I’ve always wondered about the people who actually answer that both honestly and confidently. How can they be so sure of where their life will lead? People like that actually exist?

    If you has asked me that five years ago, I’d have no idea what to say, but I certainly wouldn’t have told you I’d be writing a post about a MLP x Doctor Who fan series.

    ***

    The Short MLP Primer

    My Little Pony: Friendship is Magic is a cartoon about pastel colored horses living lives with other pastel colored horses.

    The main horse (okay, pony) is Twilight Sparkle, a unicorn prodigy. She’s incredibly smart and hard working, but she’s also a bit socially inept, and is prone to freaking out over small details.

    It’s surprisingly good. Although it takes a while to warm up to it, once you like the characters the show just clicks and becomes a joy to watch. Friendship is Magic starts with Twilight saving the world from eternal darkness, then shifts to slice of life. On rare occasions, it shifts back to adventure, where the main cast have to fight monsters that escaped Tartarus, break up communistic cults, and save kingdoms from totalitarian dictators.

    Yes, really. All of that is canon.

    As for the fandom, the MLP fandom is one of the craziest and most prolific fandoms in the world, and I proudly count myself as a member.

    The Short Doctor Who Primer

    So. I actually haven’t watched any Doctor Who. Everything I know about the show is from Internet osmosis. I’ll say what I know, and apologize in advance for any Doctor Who misrepresentation. (So to any Whovians reading this: please don’t kill me.)

    Doctor Who is a long running show by the BBC. I do mean long. The first episode aired over 50 years ago.

    The eponymous Doctor is a Time Lord who time travels in the TARDIS, which takes the appearance of a London police box. Although he looks human, he’s somewhere around 1000 years old. Whenever he dies, he regenerates into a new form and personality, which keeps the show fresh. (That’s the in-universe explanation. In reality, it’s a way to change the actor.) Together with a companion (a human who’s in on the Doctor’s secret), he travels through time and space, fighting monsters like the Daleks or the Weeping Angels. Or, he resolves the local trouble he sees in this part of the multiverse. Most likely, he’s doing both at the same time, all while being either a little too insane or not insane enough.

    So….Why Are There MLP x Doctor Who Crossovers?

    Some people noticed there was a recurring background pony with hair very similar to David Tennant’s, one of the Doctor’s actors. He also had a cutie mark of an hourglass, meaning his special talent was related to time.

    Comparison of the Doctors

    Left: the pony. Right: the human. Honestly, not a slam dunk case.

    When you combine those two details with the craziness of the MLP fandom, there’s only one reasonable outcome. Fans quickly christened him “Doctor Whooves” and to this day he’s one of the most popular fan characters.

    Companions of Doctor Whooves

    The companions from just the audio plays. Left to right: Tick Tock, Twilight, Trixie, Roseluck, Derpy, Doctor Whooves. Include fanfic and you might as well add the whole cast. (By Lilla Dessert.)

    The Adventure Begins

    Among the sea of fan content was the fanfic “Number 12”, by SqueakAnon. (The name is accurate. Squeak’s gender and real name are both unknown.)

    Squeak’s take was that Doctor Whooves was the 12th Doctor (the show was on the 11th at the moment.) The story starts with the TARDIS crashing into Twilight’s home, and ends with Twilight becoming the Doctor’s companion. It was well received, and that was that.

    A while later, Squeak decided to take it one step further. He or she contacted other members of the fandom, and formed Pony In A Box Productions. Their mission: to create a full-fledged radio play. Their first episode was an adaptation of “Number 12”, and ever since they’ve been releasing new episodes under the banner Doctor Whooves Adventures.

    And now we come to me. Around two years ago, I decided to listen to a few episodes. At first, it was just entertaining, but just like with MLP, at some point I realized Pony in a Box had stolen my heart, locked it away and threw away the key, and I didn’t even care. I love this series so, so much. I actually find it difficult to find things I don’t like about it. Doctor Whooves Adventures is in my favorite works of all time list, and it’s singlehandedly convinced me to watch Doctor Who, as soon as I find time for the inevitable binge.

    Why Should You Watch This Show?

    It’s funny when it wants to be, but isn’t afraid to be sad. The characters are not only well written but well acted. It mixes the two canons well: the overarching themes of death and loss from Doctor Who are tempered by themes of optimism and friendship from My Little Pony. Yet despite taking elements from both, you don’t need to know either My Little Pony or Doctor Who to enjoy this series. Everything is played straight and with few fandom in-jokes, and the cast carries the series on its own.

    Below, I’m going to repeat the above, but in many, many more words. Let’s get to it!

    Production Values

    Normally, you don’t expect fan creations to go through much production, which makes the effort put into Doctor Whooves Adventures all the more surprising. Pony In A Box holds themselves to high standards, and it shows. First, the writing staff (led by Squeak) prepares a script. Then, the voice actors record their lines. Once done, the sound team comes in, adding background music and sound effects. (As someone who has done very minor movie editing, this is both more important and more time consuming than it sounds.) At the same time, the art team creates promotional pictures. Finally, they publish to Youtube and iTunes. Every episode is a huge labor of love, and it shows in the end product. Here’s an excerpt showing this off. It’s from “Bells of Fate”, my favorite episode. In this part, a librarian is recounting the founding of the Green Isles.

    Unfortunately, all that production means each episode takes a long time to finish. I’ve been waiting for the conclusion to “Bells of Fate” for over a year. Still, it’s coming out soon! Meaning, they targeted August of this year and it’s the end of September…but it is happening and I can’t begrudge the team too much. I know how long these things can take.

    The Writing

    The writing and voice acting for this series is top notch. The strength of the vocal cast is a huge asset here, since the way they say the lines often conveys more than the words themselves. Because the writers can trust the voice actors, every line can focus on driving the plot forward without sacrificing characterization. Addtionally, since the characters are well defined, the plots can grow organically from the seeds the writers plant, letting them avoid the “hand of god” problem. (That’s my term for when writers need to add out-of-character moments to railroad the plot.)

    The show also makes a point of having strong female characters and a gender balanced cast. (This is true of most MLP fanwork. When a fandom grows in open defiance of gender stereotypes, people pay a lot of attention to avoiding them. It’s a beautiful part of the community.) Twilight’s a fantastic companion; as one of the smartest ponies in MLP canon, she might be the only character that can keep up with the Doctor. She solves problems and gets herself out of trouble almost as often as the Doctor does, and although the Doctor knows more about the universe than she ever will, Twilight is the one who knows the most about the pony-filled world the Doctor landed in. They get a great teacher-student relationship going, and it’s just fun to see them play off each other.

    There’s plenty of dry, deadpan situational humor as well. From the start of “Wrong Way Backwards”, where Twilight and the Doctor are shopping:

    And although light humor is the standard tone of the show, one of the running themes is that people (or ponies, in this case) are haunted by tragedies from their past. From “Shadows of the Lunar Republic”, the account of a lunar pony:

    However, after lots of struggle, everyone gets past their tragedy and self-loathing, moving on to better lives. That’s my favorite part of the writing. Everyone earns their happy ending, and it all ends well. Sure, maybe that isn’t realistic, but who says it has to be?

    Parting Remarks

    If you do decided to listen to the series, you can do so here. I recommend listening in episode order. Should you get bored, each story arc is only 2-3 episodes long, and there’s little continuity between them, so you’re free to jump to the better episodes. Here’s my short list, with the standard your mileage may vary caveat.

    • Number 12 Part 1 + 2. You absolutely need to start here, no questions. It’s not the best episode, but this introduces all the characterization, so it’s unskippable.
    • Bells of Fate. My favorite episode. Great mythology influences, and the two plots tie together elegantly. (Fun fact: this episode actually got me into Irish music.)
    • Rhapsody in Blue Box. Tugs at the heartstrings more than any other. May be better after listening to the short Cell Mates, but the story is getting told out of order anyways. You’ll be as confused as the rest of us whether you’ve seen the episodes in order or not.
    • Wrong Way Backwards Parts 1 + 2 + 3, then 1 + 2 + 3 to fill the gaps. You’ll see what I mean. Timey wimey, wibbly wobbly, and all around fun. This episode’s construction is the most impressive, but it’s also the longest by far, especially if you listen to both sides.

    The remaining episodes (Shadows of the Lunar Republic, Chords of Chaos, Pony of the Opera) are ranked similarly. They’re fun, but not as strong as the rest.

    ***

    It’s so strange to realize that five years ago, I was still in high school. So much has changed since then. I’d like to think I got a bit smarter, but odds are I’m still just as dumb and don’t know it yet. I’ll look forward to making another rant in a few years about why I was an idiot.

    In five more years from now? Who knows? Maybe my love for this series will fade, but it’s hard to see that happening. Maybe Doctor Whooves Adventures will die a slow death, as the creators lose interest, but I hope that never comes to pass. The only thing I’m certain about is that I’ll never be certain about how my tastes will shift. The best I can do is to stay open to change, and to keep reaching.

    Until next time. In the words of the good Doctor himself,

    Series Logo

    “Onwards and upwards!”

    Comments