<s>[INST] Maximum protrusion over a folded piece of paper The pages of a book are $x$ cm tall and $y$ cm wide. If a page is folded appropriately, a corner of the page can stick out above the top of the book. What is the maximum amount that a page can protrude above the top of the book without tearing the page or separating it from the binding?
 [/INST] I'll change the notation since I prefer using $x$ and $y$ as coordinates in the plane.
Let's say the edges  of the page are on the lines $x=0$, $x=a$, $y=0$, $y=b$ before folding, and you fold along a line $y = c x + d$ with positive slope that crosses the top and bottom edges of the page, so $c > 0$, $0 \le (b-d)/c \le a$
and $0 \le -d/c \le a$.
$$(x,y) \to \left(\frac{1-c^2}{1+c^2} x + \frac{2c}{1+c^2} y - \frac{2cd}{1+c^2}, \frac{2c}{1+c^2} x + \frac{c^2-1}{1+c^2} y + \dfrac{2d}{1+c^2}\right)$$
We want to maximize
$$ f(c,d) = \frac{2c}{1+c^2} a + \frac{c^2-1}{1+c^2} b + \dfrac{2d}{1+c^2}$$
subject to $c > 0$, $0 \ge d \ge b-ac$.
Since $\partial f/\partial d = 2/(1+c^2) > 0$, the maximum will occur on the upper boundary of the region in $(c,d)$ space, i.e. at $d=0$.  Taking the derivative with respect to $c$, we find that the solution is
$$ c = \dfrac{b + \sqrt{a^2+b^2}}{a},\ d=0$$
and the maximum protrusion amount turns out to be
$$ \dfrac{a^2}{b+\sqrt{a^2+b^2}}$$
</s>