# A kinda crazy Facebook-like math problem

You know that stupid math problems with food that 50-old people share on Facebook? I’m kinda use the answer is yes; those problems are obviously ridiculously easy even if they’re usually presented with captions like “only 1% of the population of the entire multiverse can solve this”. Of course the various math-themed communities on Facebook started to meme on this fact coming out with pearls like the “only 0,000000000001% of the population of the world can solve this” associated with an image featuring the Riemann Hypothesis. Here’s a common food problem:

Nothing too hard: it’s clear that $apple=10,\quad banana=4,\quad coconut=2$; easy. Parodies of such “problems” exist are usually feature an array of fruit linear equations and an integral right below with fruit in it that say “now solve me, you 1% of population genius”. However I’ve always laughed over those parodies-images and never tried to actually solve one till yesterday; and holy shit that was painful. I want to report here the whole thing since I found it really challenging and fun (well, if you’re masochist enough) and I also want to see how WordPress’ LaTeX can handle this:

First let’s do the system of linear equations: let’s set $pear=p,\quad apple=a,\quad banana=b$ and rewrite the whole this as:

$\displaystyle \begin{cases}2p-2a+b=2\\-3p+2b=1\\3p+a-b=3\end{cases}$

This is not so hard so I’m not going to explain what I did step by step, but I can tell you that I used the substitution method starting by finding $a$ in the third equation. The results are not so good-looking:

$\displaystyle \begin{cases}p=\frac{17}{13}\\a=\frac{20}{13}\\b=\frac{32}{13}\end{cases}$

I personally expected more plain results like 1, 3, 5 and even numbers like 6, 8, 12; those fractions made me realize that I was going to suffer a lot to break down that integral. Let’s rewrite it without fruit, the lemon will be our $x$:

$\displaystyle \int_{a-b}^{b-p}\frac{2\sin^2(x)+cos(2x)}{x^4+1}\, dx$

Let’s now solve the indefinite integral first:

$\displaystyle \int\frac{2\sin^2(x)+\cos(x)}{x^4+1}\, dx$

This thing initially scared me, trig always does, but then I realized that we can use the trigonometric identities $\cos(2\theta)=2\cos^2(\theta)-1$ and $\sin^2(theta)=1-\cos^2(\theta)$ to simplify it:

$\displaystyle \int\frac{2\sin^2(x)+\cos(x)}{x^4+1}\, dx = \int\frac{2-2\cos^2(x)+2\cos^2(x)-1}{x^4+1}\, dx=\int\frac{1}{x^4+1}\, dx$

So the trig went away but this new integral is still problematic: we need to decompose this fraction (if you have any, this is the time to play some epic music like this). This implies that we have to factor $x^4+1$ and that’s not banal because it have no real roots, it have complex roots but I don’t know if dealing with them is useful. However I found that if we rewrite the thing as $x^4 + 2x^2 - 2x^2 + 1$ we can then substitute $u = x^2$ to get $u^2 + 2u - 2u + 1$; we can now see that $u^2 + 2u + 1$ easy factor to $(u + 1)^2$ and thus the whole thing is just $(u + 1)^2 - 2u$: a difference of squares! A difference of squares $a^2 - b^2$ factor to $(a+b)(a-b)$ so $(u + 1)^2 - u^2$ equals $(u + 1 + \sqrt{2u})(u + 1 - \sqrt{2u})$, undoing the substitution: $(x^2 + \sqrt{2}x + 1)(x^2 - \sqrt{2}x + 1)$. So the factoring is done:

$\displaystyle \int\frac{1}{x^4+1}\, dx=\int\frac{1}{(x^2 + \sqrt2x + 1)(x^2 - \sqrt2x + 1)}\, dx$

It’s now time to decompose this fraction:

$\displaystyle\frac{1}{(x^2 + \sqrt2x + 1)(x^2 - \sqrt2x + 1)}=\frac{Ax+B}{x^2 + \sqrt2x + 1} + \frac{Cx+D}{x^2 - \sqrt2x + 1}$

We need to find values for $A,\, B,\, C,\, D$  so:

$\displaystyle\frac{1}{(x^2 + \sqrt2x + 1)(x^2 - \sqrt2x + 1)}=\frac{Ax^3-\sqrt2Ax^2+Ax+Bx^2-\sqrt2Bx+b+Cx^3+\sqrt2Cx^2+Cx+Dx^2+\sqrt2Dx+D}{(x^2 + \sqrt2x + 1)(x^2 - \sqrt2x + 1)}$

We can now solve this system of linear equations to get our answers:

$\displaystyle \begin{cases}A + C = 0\\B + D = 1\\-\sqrt2A+B+\sqrt2C+D=0\\ A-\sqrt2B+C+\sqrt2D=0\end{cases}$

Playing with the first two equations and substituting things is easy to come up with these solutions:

$\displaystyle \begin{cases}A=\frac{\sqrt2}{4}\\B=\frac{1}{2}\\C=-\frac{\sqrt2}{4}\\D=\frac{1}{2}\end{cases}$

Now:

$\displaystyle \frac{Ax+B}{x^2+\sqrt2x+1}=\frac{\sqrt2x+2}{4(x^2+\sqrt2x+1)}=\frac{x+\sqrt2}{\sqrt{2^3}(x^2+\sqrt2x+1)}$

$\displaystyle \frac{Cx+D}{x^2+\sqrt2x+1}=-\frac{\sqrt2x-2}{4(x^2+\sqrt2x+1)}=-\frac{x-\sqrt2}{\sqrt{2^3}(x^2+\sqrt2x+1)}$

We can now rewrite the integral applying linearity:

$\displaystyle\int\frac{1}{x^4+1}\, dx=\frac{1}{\sqrt{2^3}}\int\left(\frac{x+sqrt2}{x^2+\sqrt2x+1}-\frac{x-\sqrt2}{x^2-\sqrt2x+1}\right)\, dx$

The first thing I noticed at this point is that $\frac{d}{dx}[x^2+\sqrt2x+1]=2x+\sqrt2$ and that $\frac{d}{dx}[x^2-\sqrt2x+1]=2x-\sqrt2$; that’s very similar to what we have as numerators of our fractions: we just have to multiply the whole integral by $2/2$:

$\displaystyle\frac{1}{2\sqrt{2^3}}\int\left(\frac{2x + 2\sqrt2}{x^2+\sqrt2x+1}-\frac{2x-2\sqrt2}{x^2-\sqrt2x+1}\right)\, dx$

Considering that $2\sqrt2=\sqrt2+\sqrt2$ we can write the integral as:

$\displaystyle \frac{1}{\sqrt{2^5}}\left[\int\left(\frac{2x+\sqrt2}{x^2+\sqrt2x+1}\right)\, dx - \int\left(\frac{2x-\sqrt2}{x^2-\sqrt2x+1}\right)\, dx + \sqrt2\int\left(\frac{1}{x^2+\sqrt2x+1}+\frac{1}{x^2-\sqrt2x+1}\right)\, dx\right]$

The first two integrals are easy: they are in the form $\int\frac{f'(x)}{f(x)}\, dx$ that easily equal $\log\left|f(x)\right|$, where $\log(x)$ is the natural logarithm of $x$, so:

$\displaystyle \int\frac{2x+\sqrt2}{x^2+\sqrt2x+1}\, dx=\log\left|x^2+\sqrt2x+1\right|$

$\displaystyle \int\frac{2x-\sqrt2}{x^2-\sqrt2x+1}\, dx=\log\left|x^2-\sqrt2x+1\right|$

The third one is a bit tricky; we have to complete the square in order to go on (in doing so we can even apply linearity and split it in two):

$\displaystyle \sqrt2\int\left(\frac{1}{x^2+\sqrt2x+1}+\frac{1}{x^2-\sqrt2x+1}\right)\, dx = \sqrt2\left[\int\frac{1}{\left(x+\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\, dx +\int\frac{1}{\left(x-\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\, dx\right]$

Now we can use the rule $\int\frac{1}{x^2+a^2}\, dx = \frac{1}{a}\arctan(\frac{x}{a})$ to solve those two integrals and get that:

$\displaystyle \sqrt2\left[\int\frac{1}{\left(x+\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\, dx +\int\frac{1}{\left(x-\frac{\sqrt2}{2}\right)^2+\frac{1}{2}}\, dx\right] = \sqrt2\left[\sqrt2\arctan(\sqrt2x+1)+\sqrt2\arctan(\sqrt2x-1)\right]$

Putting everything together we finally have a solution for our initial integral $\int\frac{1}{x^4+1}\, dx$, let’s call it $I$:

$\displaystyle I=\dfrac{\log\left|x\left(x+\sqrt{2}\right)+1\right|-\log\left|x\left(x-\sqrt{2}\right)+1\right|+2\left(\arctan\left(\sqrt{2}x+1\right)+\arctan\left(\sqrt{2}x-1\right)\right)}{\sqrt{2^5}}$

One last step: we need to calculate $[I]_{a-b}^{b-p}$. Due to previous results this ask us to calculate $[I]_{-\frac{12}{13}}^{+\frac{15}{13}}$ that apparently equals:

$\displaystyle \dfrac{\ln\left(39{\cdot}2^\frac{5}{2}+313\right)-\ln\left(39{\cdot}2^\frac{5}{2}-313\right)+2\left(\arctan\left(\frac{3{\cdot}2^\frac{5}{2}+13}{13}\right)+\arctan\left(\frac{3{\cdot}2^\frac{5}{2}-13}{13}\right)+\arctan\left(\frac{15\cdot\sqrt{2}+13}{13}\right)+\arctan\left(\frac{15\cdot\sqrt{2}-13}{13}\right)\right)+\ln\left(195\cdot\sqrt{2}+394\right)-\ln\left(195\cdot\sqrt{2}-394\right)-2\ln\left(-1\right)}{2^\frac{5}{2}}$

That we can approximate to 1.76; probably there are better ways to solve it but I couldn’t figured them out since the last time I did integrals seriously was probably some months ago. However that was fun (and probably also one of the hardest I’ve ever done) and challenging; maybe I’m going to try some other parody-images math problems in the future. If you like math I’ll suggest you to try those things out, they can be pretty cool.