The AM/GM Story: Calculus-Free Optmization
This is a LaTeX-enabled post. For best viewing, use a browser and view this on my blog, not a mobile device or your dash.
Difficulty: \(({*})\) This post is marked as a Single Star.
Prerequisites: None.
Those of you who have taken Calc 1 know how to solve basic optimization problems. A function is maximized or minimized when its derivative is zero. There exists a story of love and life, a story of ingenuity, and a story explaining how you don’t actually need calculus to solve most Calc 1 optimization problems. This is that story.
So, for some reason, you have acquired several tortoises. Maybe you like the tortoises because they make you feel fast. Maybe you like them because reptiles are the best kind of pet. Maybe you just like durdle turtles. For whatever reason, you have tortoises, which you need to encase in a pen next to a river.
You think to yourself, why would I put them next to a river? Because otherwise the smart kid will be like “Use a Square!” and ruin the surprise. Either way, this is the pen you need to create. The problem is that you only have so much fence. You have, in fact, seventeen meters and you want to enclose the largest possible area for your tortoises. So you ask your friendly neighborhood mathematician if they can help you solve this problem and they tell you to take the derivative and set it equal to zero.
Silly mathematicians and their math. What, do they think an ordinary person like you knows calculus? Give me a break.
But wait! “What if I can solve this problem without calculus?” you ask them. They perk up and say, “You can use the AM/GM inequality!”
They pull out a piece of paper and say, “Say \( a\) and \( b\) are just numbers on the number line,” and write \( (a-b)^2 \ge 0\). You say, “Well yea, a square number can’t be negative.” They then add, “The key here is that \( (a-b)^2 = 0\) exactly when \( a-b=0\). Otherwise, \( (a-b)^2 > 0\).” You nod in agreement. They expand \( (a-b)^2\) and get \( a^2 -2ab + b^2 \ge 0\), with equality still when \( a-b=0\). You agree. Then, they add \( 2ab\) to both sides, and gets \( a^2 + b^2 \ge 2ab\), with equality only when \( a = b\).
“How’d you get when \( a=b\)?”
“That’s the same thing as \( a-b=0\). I skipped a step.”
So now you look at \( a^2 + b^2 \ge 2ab\) and you get an idea. You have seventeen meters of fence and you have one section parallel to the river equal to the width, and two stretches perpendicular to the river equal to the height. You write \( w + 2h = 17\). Suddenly, a flash of intuition occurs to you and you write \( w + 2h = 17\) as \( \left(\sqrt{w}\right)^2 + \left(\sqrt{2h}\right)^2 = 17\). Now, you can use the AM/GM inequality! By AM/GM you know that \( \left(\sqrt{w}\right)^2 + \left(\sqrt{2h}\right)^2 \ge 2\sqrt{w}\sqrt{2h}\) with equality only if \( \sqrt{w} = \sqrt{2h}\), which is just \( 17 \ge 2\sqrt{2}\sqrt{wh}\), with equality only if \( \sqrt{w} = \sqrt{2h}\). The right-hand side is maximized when equality holds, so \( 2\sqrt{2}\sqrt{wh}\) is maximized when \( \sqrt{w}=\sqrt{2h}\). But this is just \( 2\sqrt{2}\sqrt{\mathrm{Area}}\), so the square root of the area is maximized when \( \sqrt{w} = \sqrt{2h}\), so this must maximize the area as well! So the area is maximized when \( \sqrt{w} = \sqrt{2h}\), which is just when \( w = 2h\)! Aha! So it must be twice as wide as it is deep!
The friendly neighborhood mathematician grins and says, “Exactly. I’m Taylor, by the way.”
One and a half years later, you end up married, and the neighborhood mathematician becomes your relative topologist when you intersect your lives. You decide to to go a Bruce Springsteen concert while on your honeymoon.
The first thing you notice is that Bruce has an American flag bandanna and sunglasses on. It’s nighttime, but he’s just that cool. He’s got a humongous Star-Spangled banner behind him because there’s nobody more American than Bruce. Like seriously, how does he do it?
The second thing you notice is that you don’t know the optimal place to stand to maximize the fraction of the view that Bruce occupies. If you’re right below him then you only see his feet and head pretty much. But if you go too far back, he’s far enough away that he takes up a small fraction of your view. You draw a diagram, labeling the distances \( B\) for Bruce’s height, \( A\) for American and also for the height above your eye level that he’s standing, and \( x\) for how xcited you are to be there with your new spouse, at a Bruce concert, and also for your distance on the ground from the slope.
You realize that the angle \( \theta_1\) to Bruce’s feet is \( \tan^{-1}\left(\frac{A}{x}\right)\) and the angle to his head is \( \tan^{-1}\left(\frac{A+B}{x}\right)\). You write down that you want to maximize the difference of \[\tan^{-1}\left(\frac{A+B}{x}\right)-\tan^{-1}\left(\frac{A}{x}\right)\].
You don’t know calculus so this stumps you, and you ask your spouse. They say, “Inverse Tangent!” and get all excited, then they say “Don’t worry. Your friend AM/GM helps here too.” You think, and then realize that maximizing a function on \( [0, \pi/2)\) is the same as maximizing its tangent. So you take the tangent of your quantity, and get
\[\tan\left(\tan^{-1}\left(\frac{A+B}{x}\right)-\tan^{-1}\left(\frac{A}{x}\right)\right)\]
Good thing you remember the tangent of a difference formula, or that
\[\tan(y-z) = \frac{\tan(y) - \tan(z)}{1+\tan(y)\tan(z)}\]
Simplifying, you get
\begin{align*}
&\phantom{=}\tan\left(\tan^{-1}\left(\frac{A+B}{x}\right)-\tan^{-1}\left(\frac{A}{x}\right)\right) \cr
&=\frac{\tan\left(\tan^{-1}\left(\frac{A+B}{x}\right)\right) - \tan\left(\tan^{-1}\left(\frac{A}{x}\right)\right)}{1+\tan\left(\tan^-1\left(\frac{A+B}{x}\right)\right)\tan\left(\tan^{-1}\left(\frac{A}{x}\right)\right)} \cr
&= \frac{\frac{A+B}{x} - \frac{A}{x}}{1 + \frac{(A+B)(A)}{x^2}} \cr
&= \frac{\frac{A+B}{x} - \frac{A}{x}}{1 + \frac{(A+B)(A)}{x^2}}\cdot\frac{x^2}{x^2} \cr
&=\frac{Bx}{x^2+(A+B)A}
\end{align*}
You know \( B > 0\) so this is the same as maximizing \( \frac{x}{x^2 + (A+B)A}\). Then you have a flash of ingenuity and write that this is the same as maximizing \( \frac{2\sqrt{A(A+B)}x}{x^2+(A+B)A}\), which means now you can use AM/GM! You know that \( 2\sqrt{A(A+B)} x \le A(A+B) + x^2\) with equality only when \( \sqrt{A(A+B)} = x\)! But this means that \( \frac{2\sqrt{A(A+B)}x}{x^2+(A+B)A} \le 1\) and equals \( 1\) only when \( x=\sqrt{A(A+B)}\), so it’s maximized when \( x=\sqrt{A(A+B)}\). You look at your spouse and say “aha!” and show them your work. They reply, “I knew you had it in you,” and you kiss.
Years later, it comes up again. “Taylor, I’ll deal with dinner tonight. Can you pick up the kids?”
Now that you get to make dinner, you need to head to the grocery store and decide what to buy. Clearly, you have to have potatoes, because what kind of blog post would this be without the obligatory potato reference? Anyway, it’s beautiful out, so you decide to bike there. The grocery store is located on the corner of a large blacktop where kids play:
You think it will be faster to to on the road at least some of the way, because you ride at eight meters per second on the road and two meters per second on the blacktop to avoid kids. The blacktop is a 100-meter square. So, if you ride \( x\) meters on the road, your time on the road is \( x/8\). Your time on the blacktop is \( \sqrt{(100-x)^2+100^2}/2\) by the Pythagorean theorem. So you’re trying to minimize \( x/8 + \sqrt{(100-x)^2+100^2}/2\), which at this point you already know to do using AM/GM. This one’s a tough one, but you think you can do it. The first thing you do is rewrite \( (100-x)\) as \( z\) and write \( \sqrt{(100-x)^2+100^2}\) as \( y\). So now, you’re minimizing \( x/8 + y/2\). Then, because \( z^2 + 100^2 = y^2\), you’d rather use \( z\) instead of \( x\). You write this as \( \frac{100 - z}{8} + \frac{y}{2}\), which is \( \frac{100}{8} - \frac{z}{8} + \frac{y}{2}\). Minimizing this is the same as minimizing \( \frac{y}{2} - \frac{z}{8}\), which is the same as minimizing \( 4y - z\). You don’t know what to do with the \( -\) sign because you can’t use AM/GM if there’s a \( -\), so you decide to minimize the square and see what happens. Minimizing \( (4y-z)^2\) expands to \( 16y^2 - 8yz + z^2\). You could use AM/GM on the square terms, but you still have this awkward \( -8yz\) term, unless, you think, what if I did it on that? You write \( 8yz = 2\cdot 4y \cdot z\), and you get \( 8yz = 2 \cdot 4y \cdot z \le 16y^2 + z^2\). But of course you know that already because \( 16y^2 + z^2 - 8yz = (4y - z)^2 \ge 0\). But then, you think “I wonder...” as Ollivander did in the first Harry Potter book when Harry bought his wand, and you write \( 8yz = 2 \cdot y \cdot 4z\)! This means that \( 8yz \le y^2 + 16z^2\), so \( -8yz \ge -y^2 -16z^2\). So \( 16y^2 - 8yz + z^2 \ge 16y^2 + z^2 - y^2 - 16z^2\). But that is just \( 15(y^2 - z^2)\), and \( y^2 - z^2 = 100^2\) is a constant! So we have that \( (4y-z)^2 \ge 15 \cdot 100^2\) with equality if and only if \( y = 4z\). This gives us \( 16z^2 = z^2 + 100\), or that \( z = \frac{100}{\sqrt{15}}\), so \( x = 100\left(1-\frac{1}{\sqrt{15}}\right)\). You know that \( 1 - 1/\sqrt{15}\) is just a bit less than \( 1- 1/\sqrt{16} = \frac{3}{4}\), so you need to go about \( \frac{3}{4}\) of the way and then cut across the blacktop. You hop on your bike and
“Dear?”
“Yes Taylor?”
“What about dinner?”
“Oh, well, I just figured out the fastest way to bike to the grocery store via the blacktop. I didn’t even use calculus. I used AM/GM.”
“That’s nice honey but the fastest method would have been to just go without calculating for half an hour.”
“Oh. Yea. I guess so. Anyway, Goodbye, be back in bit, see you later alligator, et cetera, love you.”
You hop on your bike, content with your AM/GM inequality and understanding spouse who happens to be facepalming at this very moment. So, at least somewhat understanding. That’s understanding enough if you’re going to be irresponsible, you think, as you ride off into the sunset (because it got dark while you were calculating). You end up making a lovely dinner of corned beef and potatoes, and live happily ever after. The end. \( \Box\)
In case anyone’s wondering, I did purposely avoid using gendered pronouns. The protagonist of this story is “you” and I can’t make any assumptions. Tell me what you think of my story!