Assume $x,y \in \mathbb{R}^+$ and satisfy $$\left(2xy-1\right)^2 = (5y+2)(y-2)$$, find the maximum of the expression $x+\frac{1}{2y}$.
$\because (5y+2)(y-2) \geq 0$ , $\therefore y\geq 2$ or $y \leq -\frac{2}{5}$, and we have $$2xy = \sqrt{(5y+2)(y-2)}+1$$ then $f(x,y)=x+\frac{1}{2y}=\frac{2xy+1}{2y}=\frac{\sqrt{(5y+2)(y-2)}+2}{2y}=g(y)$,$$\therefore g'(y) = \frac{2 + 2 y - \sqrt{-4 - 8 y + 5 y^2}}{y^2 \sqrt{-4 - 8 y + 5 y^2}}$$ and $2+2y = \sqrt{5y^2-8y-4} \Rightarrow y = 8+6\sqrt{2}$, with the help of graphing calculator ,i know this is the maximum point. $$\therefore f_{\text{max}}(x,y)=g(8+6\sqrt{2})=\frac{3\sqrt{2}}{2}-1$$
Is there any other way to work out it?
Alternative solution:
Let $z = x + \frac{1}{2y}$.
We have $x = z - \frac{1}{2y}$ and $2xy = 2yz - 1$.
Then, we have $$(2yz - 2)^2 = (5y + 2)(y - 2)$$ or $$(4z^2 - 5)y^2 + (-8z + 8)y + 8 = 0. \tag{1}$$
Since the quadratic equation in $y$ (1) has real roots, its discriminant is non-negative, i.e. $$\Delta := -64z^2 - 128z + 224 \ge 0$$ which results in $$- \frac{3}{2}\sqrt 2 - 1\le z \le \frac{3}{2}\sqrt 2 - 1.$$
Also, when $y = 8 + 6\sqrt 2$ and $x = \frac98\sqrt 2 - \frac12$, we have $(2xy - 1)^2 = (5y + 2)(y - 2)$ and $z = \frac{3}{2}\sqrt 2 - 1$.
Thus, the maximum of $x + \frac{1}{2y}$ is $\frac{3}{2}\sqrt 2 - 1$.