Optimization explained to a middle school kid Let's say you play the game of collecting the maximum amount of coins along a path in the $(x,y)$ plane. The total amount of coins collected $S$ is given by $S = 5x + 7y$ where $5$ and $7$ represents the number of coins collected by walking respectively one unit in the $x$ and $y$ direction. However I can only go as far as one unit of distance ($x^2+y^2=1$).
It turns out that the solution to the problem is so such that $y/x = 7/5$ or said in other words, the ratio of how much you have to walk in the $y$ direction compared to in the $x$ direction is the same as the ratio of the rates at which you collect the coins in the $y$ direction compared to in the $x$ direction. 
My question : suppose I have to explain this result to a middle school student who does not know any calculus of trigonometry. He is also quite shaky on describing equations of lines in the plane so I would not rely on that. How can I convince him with intuition that the two ratios are the same? (I'm not looking for a series of algebraic equations but rather for some kind of a visual proof).
 A: This is related in an interesting way to the method of Gradient Descent:

  
*
  
*Why is it that if you find yourself on a 2D-plane tilted by a slope of $a$ in the $x$-direction and a slope of $b$ in the $y$-direction, the steepest uphill direction will be toward $(a,b)$?
  

I have no idea how you would convince someone without going into at least some mathematical details, but from my perspective I have the following reasons:

  
*
  
*If one moves perpendicular to the $v=(5,7)$ vector, which would be toward $\hat v=(-7,5)$ you would gain zero score from the expression $5x+7y$. Simply we have $5\cdot(-7)+7\cdot 5=0$.
  
*Any direction can be decomposed into two parts in terms of the two perpendicular directions $v=(5,7)$ and $\hat v=(-7,5)$, and only the part in direction of $v$ will increase the score.
  

Good luck breaking this down and coming up with a visual representation of it. I am positive it can be done, but I am less sure how you would omit any of the non-intuitive details.


At least you can say that the part of "some direction" pointing in the direction of $v$ is shorter than "some direction" itself, and so it achieves the same score while traversing a shorter distance. The red dotted line represents the part of "some direction" not contributing to the score at all.
A: Consider the iso-$S$ curves, i.e. the combinations of $x$ and $y$ giving the same amount.
If you increase $x$ by $7$, you'll have to decrease $y$ by $5$ to ensure status-quo. As this is true whatever $x,y$, the iso-$S$ are straight lines of direction $(7,-5)$.
Now it should be clear that the optimal solution is found on the iso-$S$ that is tangent to the circle.
And as a tangent at a point is perpendicular to the corresponding radius, the point of contact is found in the perpendicular direction. Rotate the vector $(7,-5)$ to get $(5,7)$, giving the slope of the perpendicular.
A: You could start by showing that if you're walking along the line $7y=5x$,then going to the upper right increases the number of coins, while walking to the lower left decreases it. Then show how walking a little bit off the line to the upper right increases coins, but not as quickly. As your path has a larger and larger angle, the rate decreases. Eventually, when it reaches 90 degrees, you aren't getting any more coins, and when the angle exceeds that, you're losing coins. Tell the student to imagine walking along the circle, and holding their arm straight out pointing forward. When will their arm go from pointing in an "increasing" direction to a "decreasing" direction? That's where the number of coins is maximized.
You could try a change of coordinates. Mark a tick mark off every 1/7 of a y unit, and every 1/5 of an x unit. You get a coin at each tick mark. What happens if you redraw the graph so that each tick mark is equidistant? The circle turns into an ellipse. If you draw the point that corresponds to $(\sqrt2,\sqrt2)$, then even though calculating the exact optimum location will be difficult, it'll be obvious that it's to the left and above that point, showing that giving more coins for vertical distance moves the optimum point to the left and up.
A: I'd probably start with easier numbers to visualise. For example $10$ and $5$, you can explain that every step in $1$ direction you pick up $£5$, and every step in the other you pick up $£10$. Therefore to collect the same amount of money in the first direction as the second you have to walk twice as fast (or far). Hopefully this can start the intuitive thinking about the relationship between the ratios.
A: I know you said to perhaps avoid equations of lines, but I think the lines here are a crucial point. You don't need to "know" how to plot them though, just somehow convince yourself that the following description makes sense.
Try to draw the set of points in the positive quadrant where $S = 1$. This should be easy to do for the intercepts $(1/5, 0)$ and $(0, 1/7)$, and then work out that everything on the line between them also has $S = 1$. Now try again for $S = 2$, which has intercepts $(2/5, 0)$ and $(0, 2/7)$, and so on. What you find is that increasing $S$ corresponds to making this triangle larger and larger, but always in the same horizontal:vertical ratio of $7:5$.

The key thing to take away from this is that all the points having the same $S$ are a line, and increasing this $S$ is just sliding this line to be a higher parallel line.
Now we include the constraint that $x^2 + y^2 = 1$, i.e. we want to only look at points lying on the unit circle. Trying to maximise $S$ while still having $(x, y)$ lying on the circle means that you will slide the triangle to make it larger and larger until the line just touches the edge of the circle, i.e. the line is tangent to the circle. (It's also interesting here that for a suboptimal $S$, there are two solutions - this could make for some interesting discussion). You make a picture like the following:

where the outer triangle $ADE$ is in the ratio $7:5$, and the angle $ABE$ is a right angle because tangents to circles meet the diameter at right angles. The point $B$ is the point achieving the maximum. Now all you need to explain is why the smaller triangle $ACB$ is in the ratio $5:7$, which can be done in several ways (if $m$ is a gradient, the perpendicular gradient is $-1/m$, etc etc).
A: First of all, let's lose the coins. That doesn't make any sense. How can the number of coins you get be somehow related to the direction in which you walk? Surely if there are coins lying around on the ground, the amount you get should be proportional to how far you walk, not in what direction.
Maybe the following is a better visualization of the problem. You are inside a circular wall, with some large radius, say a mile. Every step you take east, I'll pay you 5 gold. Every step you take north, I'll pay you 7 gold. How can you maximize the amount of money you make?
Where you end up and how much money you make are functions only of how many steps east and how many steps north you take. It doesn't matter in what order you take them. Therefore, we may as well begin by stepping only north, and then step only east until we hit the wall. So the only question is when to stop going north and go east.
At first it seems like we should just only go north, since we get more money that way. But towards the end of our journey, when we're just one step away from the wall, if we look to our right we'll find that we can step several steps to the east before hitting the wall. So clearly at that point we should head east. So it's not hard to intuitively see why going only north isn't optimal.
That's the easy part.
But now we need to work out exactly when to turn east. The basic idea is that every step I take north, I'm sacrificing a certain number of steps east. Because of the way the circle is getting shallower and shallower as I go north, (the eastern wall is approaching me faster and faster), I'm sacrificing more and more as I go north. How much eastward distance I sacrifice on a given step north has to do with the slope of the circle.
When we take a step north and sacrifice $x$ steps east, we gain a net total of $7-5x$ gold, which becomes negative at the point $x=\frac75$. By zooming into the circle and applying properties of similar triangles, it should be possible to essentially reinvent enough of differential calculus to show what you're trying to prove.
