We have just started studying functions of several variables and their derivatives and our professor suggested the following problem as food for thought.
Two squares, both with length $l=1$ intersect in a rectangle that has an area equal with $1/8$ . Find the minimum and maximum distance between the centers of the squares.
Hint from the professor : An elegant solution can be derived by using the Lagrange multiplier. (which we haven't studied)
I've got no clue how to even approach this kind of problem, I'd be very interested in a solution, as this problem seems quite fascinating.
You need to introduce some coordinates in there to transform that geometry problem into an algebra one.
So let's fix the first square between $(0,0)$ and $(1,1)$, so with center $(1/2,1/2)$. Next, you have $(x,y)$ the coordinates of one edge of the other square, which defines that square up to 4 cases. We will focus on $(x,y)$ being the top right corner.
The center of that second square is then $(x-1/2,y-1/2)$. The distance between the 2 centers is then $d(x,y)= \sqrt{(x-1)^2 + (y-1)^2}$.
So now the problem is to find the extremum of $d(x,y)$ (or better $d^2$) subject to $xy = 1/8$.
With Lagrange multipliers, that's finding the extremum of $\phi(x,y,\lambda) = (x-1)^2 + (y-1)^2 - \lambda(xy-1/8)$ such that $\frac{\partial \phi}{\partial x} = \frac{\partial \phi}{\partial y} = 0 = 2(x-1)-\lambda y = 2(y-1)-\lambda x$
that implies $x=y=\frac{1}{2\sqrt2}$ (easy to verify it's a minimum by looking at the 2nd derivative).
As for the maximum, it's obviously not a critical point, so has to be on the border. For instance $x=1$ and $y=1/8$.
Something to note here: you don't need Lagrange multipliers, as you can simply replace $y$ by $1/x$ in the expression of $d(x,y)$ and checking that your condition respects the boundary conditions.