So I came up with this problem when I was playing around on Desmos, and I thought to take it one step further and actually have to compute it. (Here's the Desmos link). This problem can also be visualized by a rectangular select tool on MS Paint(Or just the way you select icons on the desktop). Just make a rectangle and move the mouse randomly. You should notice how a rectangle is always formed with varying area.
Here's the problem:
A rectangle is formed by $4$ points on $\mathbb{R}^2$ such that one point always remains fixed. The point diagonally opposite the fixed point moves on a given curve $y=f(x)$ . The other two points are freely movable such that a rectangle is always formed. Find the relation between $f(x)$ and $f'(x)$ such that the rectangle so formed has extremum area. (Assume $f(x)$ to be bounded)
(By extremum area, I mean either maximum or minimum area. This is not fixed because we do not have the exact $f(x)$ for which we can decide maximum/minimum area)
The situation can be visualized as such:
The area of the rectangle can be written as: \begin{align} A=(a-x)(b-f(x))&=ab-af(x)-xb+xf(x)\\[2ex] A'&=-af'(x)-b+f(x)+xf'(x)\\[2ex] \text{If } A'&=0 :\\[2ex] af'(x)+b&=f(x)+xf'(x)\\[2ex] \implies f(x)&=(a-x)f'(x)+b \end{align} I have differentiated $A$ to get the extremum condition. Now that we have a condition for $f(x)$, we can equate $f(x)$ in this equation to our original function to get the exact point where we will have extremum area. To find out if the area is maximum or minimum, we'll have to perform the second derivative test: \begin{align} A''&=-af''(x)+2f'(x)+xf''(x)\\[2ex] &= (x-a)f''(x)+2f'(x) \end{align} If $A''>0$ the area so formed will be minimum and vice-versa.