Hello, gilliana!
I came up with a very messy function.
A pole $\displaystyle a+b$ m high stands vertically in a river $\displaystyle b$ meters deep.
Assume a > b.
How many meters above the surface of the water must it break
so that the top bending down touches the bottom of the river
and the horizontal distance on the surface of the water between the points
where the parts of the pole enter the water would be a maximum?
Suppose that the break point is $\displaystyle x$ meters above the surface of water.
Specify the function that is to be maximized in terms of x. Code:
*




a 
 P *
 \
  \
 x  \
  \
  θ \ ax
* ~ ~ ~ Q *   * S
  y \
  \
b  b  \
  \
  v θ \
*     R *      * T
z
The pole is broken at $\displaystyle P\!:\;\;PQ = x,\;PT = ax,\;QR = b$
Let $\displaystyle y = QS,\;z = RT$
Let $\displaystyle \theta = \angle PSQ = \angle PTR$
In right triangle $\displaystyle PRT\!:\;\tan\theta = \frac{x+b}{z}$
In right triangle $\displaystyle PQS\!:\;\tan\theta =\frac{x}{y}$
. . Hence: .$\displaystyle \frac{x+b}{z} \:=\:\frac{x}{y} \quad\Rightarrow\quad y \:=\:\frac{xz}{x+b}$ .[1]
In right triangle $\displaystyle PRT\!:\;\;z^2 + (x+b)^2 \:=\:(ax)^2$
. . Solve for $\displaystyle z\!:\;\;z \:=\:\sqrt{a^2b^2  2(a+b)x} $
$\displaystyle \text{Substitute into }{\color{blue}[1]}\!:\;\;y \;=\;\frac{x\left[a^2b^22(a+b)x\right]^{\frac{1}{2}}}{x+b} $
And that is the function to be maximized.