魔法少女まどか☆マギカ[新編]数学の物語

         
         It's been forever since I wrote a post! I've thought about stuff to write, but I've been incredibly busy with different projects and it's only now that I'm working from home because of the whole COVID-19 thing, that I finally have the time... or so I would like to say. 

In reality, I just have the attention span of a goldfish and I get distracted by games, or manga, or pandemics; anything is a good excuse not to maintain a constant stream of posts. These whims sometimes work in the right direction though, and I felt the impulse of writing something recently. I originally intended it to be a simple Twitter thread, but while putting it together I realized a blog post would do it more justice. Without further ado, this is the first post in series that I will hereby call "Math in Anime" (although there's actually not that much math in this one tbh). Spoilers for Madomagi may be present, you've been warned.


-------------------------------------------------------------------------------------------------------------

         I was re-watching the original 12 episodes Madoka series recently; it's one of my favorite anime without a doubt so it felt like time for that. If you haven't watched it drop what you're doing and go watch it now, it's just that good; you can come back to read this later. 
Before I get too sidetracked with singing its praises, let's get into business. As is usual for media one has watched multiple times, I noticed stuff that I didn't really pay attention to when I first watched it. In this case, it was a couple of problems that were written on a board on Episode 10. They appear for at most 5 seconds before moving on with the plot.  Having my curiosity picked, I decided to take a closer look at them. Let's look at the first one:



Even without knowing Japanese, the problem isn't hard to understand, but basically it says "Given that $f(x) = \ldots$ , calculate $f(1) + f(2) + f(3) + \ldots + f(60)$"

The solution I found was to simplify the expression of $f(x)$ into something more manageable. Using some rationalizing, factorization, and expansion: 

                $f(x) = \dfrac{(4x+\sqrt{(2x+1)(2x-1)})(\sqrt{2x+1}-\sqrt{2x-1})}{2x+1-2x+1}$

                          $ = \dfrac{4x\sqrt{2x+1} - 4x\sqrt{2x-1} + (2x+1)\sqrt{2x-1}-(2x-1)\sqrt{2x+1}}{2}$

                          $= \dfrac{2x\sqrt{2x+1} - 2x\sqrt{2x-1} + \sqrt{2x-1}+\sqrt{2x+1}}{2}$

                          $ = \dfrac{(2x+1)\sqrt{2x+1} - (2x-1)\sqrt{2x-1}}{2} = \dfrac{(2x+1)^{\frac{3}{2}} - (2x-1)^{\frac{3}{2}}}{2}$

At this stage, it suffices to notice that for consecutive values of $x$ in the sum, pairs of terms will cancel each other. So we end up with:

                             $\displaystyle \sum_{x=1}^{60} f(x) = \dfrac{1}{2}\sum_{x=1}^{60} (2x+1)^{\frac{3}{2}} - (2x-1)^{\frac{3}{2}}$

                                               $ = \dfrac{1}{2} \left(\color{red}{3^{\frac{3}{2}}} - 1^{\frac{3}{2}} \color{blue}{+ 5^{\frac{3}{2}}} \color{red}{- 3^{\frac{3}{2}}} + 7^{\frac{3}{2}} \color{blue}{- 5^{\frac{3}{2}}} + \ldots + 121^{\frac{3}{2}} - 119^{\frac{3}{2}} \right)$

                                               $= \dfrac{1}{2} \left( 121^{\frac{3}{2}} - 1 \right) = \dfrac{1330}{2} = \mathbf{665}$

-------------------------------------------------------------------------------------------------------------

         Now onto the second problem, shown right after the one above in the same scene. 


        This one may require a translation: "Let $p$ be a prime number and $n$ an arbitrary natural number. Show that $(1+n)^p - n^p - 1$ is always divisible by $p$". 

If you know some number theory, in particular modular arithmetic and Fermat's little theorem, the result follows pretty quickly. Without this knowledge, we need to work a bit more. Using the binomial theorem to expand $(1+n)^p$ and cancel a couple of things:

$$\displaystyle \color{red}{(1+n)^p} - n^p -1 = \color{red}{1 + pn + {p\choose 2} n^2 + \ldots + {p\choose p-1} n^{p-1} + n^p} - n^p-1$$

         Note that after cancelling $n^p$ and $1$, all the terms that are left have a coefficient of  the shape $\displaystyle {p\choose k}$ for $0 < k < n$. Since $p$ is prime, they are all divisible by $p$ and so their sum is too. Now this is what I call a real-world application of math!


-------------------------------------------------------------------------------------------------------------

         You may think this is the end, but the above got me to start thinking about something relating to the series. Let's analyse the context these two appear in a bit: best girl Homura was on the verge of tears from not being able to do these problems after coming back to school from being hospitalized for some time. The teacher notices this and tells her to borrow notes from her classmates to study. From this, we can safely assume that these are standard exercises for the class to do. 

>tfw math anxiety

         While I don't think the problems are particularly difficult, let's not forget that Homura just transferred to a 2nd year of middle school class! I haven't mentioned it on Twitter, but due to a perfect storm of unfortunate events (one of which is the COVID-19 pandemic), I have been required to handle some middle school classes for a couple of months already. For those who don't know, let me tell you: these is far above what an average middle schooler would be asked to do, even in Japan with its reputation of having students who are quite skilled at math

        There is actually a third problem on Episode 9 of the series, but it's slightly hidden (and half solved), so I decided not to include it here. It involves the explicit formula of the Fibonacci sequence as a start; so it's also outside of the level expected of a "standard" student. 
Related to this, it's also worth mentioning that among the few people we get to know in the school, we have some pretty intelligent individuals. For example, Kyousuke seems to be aiming to be a conservatory-level violinist, while Homura figured out how to steal and hide very heavy weaponry from the JSDF (or maybe the Americans?) only using her time manipulation powers. 

         Mitakihara Middle School is quite an interesting school, isn't it?


-------------------------------------------------------------------------------------------------------------

         "Where are you going with this?" you may ask. Good question; it should become clear soon, but let's look at the girls' situation from a slightly different angle for now. Even during your first time watching (where you'll be going crazy by the stuff happening), you'll probably still notice that Madoka lives in an very modern house, Mami's apartment is spacious and well-furnished, Kyousuke's hospital looks like no other, etc... In addition, even when it was being aired people noticed the aesthetic choice of the school, being almost completely made out of glass and stuff like their smart boards/seats.


Notice the smart glass showing the weather on the right.

Not exactly what comes to mind when you hear "student living alone". Her room in Rebellion is even fancier if I recall correctly.

This is a hotel hospital room.

The seat and desk hide themselves and announce the status of the student (欠席 = absent).

         From this, it should be obvious that everyone in the series is really loaded except Kyouko, and even she seems to enjoy the fancy life if the hotel room she's "using" is any indication to go by (how she gets the money for that is a different issue). As if this was not enough, we have to consider that the anime takes place in modern Japan, where living spaces tend to be rather small and expensive in general; even more close to the city as they seem to be. You may have been to distracted by the plot, but when Bernie talks about the 1%, he means the main characters in Madoka.

-------------------------------------------------------------------------------------------------------------

         Challenging academics, fancy and modern architecture, and lots (and lots) of money; we can only conclude that the girls attend an elite school for the super rich and are probably all gifted in some area.  When Madoka talks about not being good for anything and of being of no use to anyone, I think she may very well have impostor syndrome to some degree. After all, we know she does manage to keep up with her high level studies among all the mayhem (her mom only gets an indication that something weird is happening after Sayaka's corpse is found by the police following Kyouko's death). 
It all makes sense and fits rather nicely if we combine this knowledge with the things Kyubey looks for in girls to make a magical girl contract. From what he says on Episode 11, these are the type of girls that would probably make very powerful witches and as such release a great amount of energy to counter entropy.

         Anyways, that's it! I was originally only intending to do the problems, but after finishing them it got me thinking about their age and one thing led to the other. I recall there are some school scenes in "Rebellion" too, so when I re-watch it I may edit this or just tweet about it depending on the length. It's not common to find random math problems in anime, so I'm not sure if this series will go far beyond this entry. There's bound to be some other examples (Monogatari series has some stuff for sure, but I'll have to take a proper look). 

Until next time, have a smug Madoka as a gift for reading!


Comments

Popular Posts