Let $f,p,d \ge 0$ such that
$$ f \ge G(d):=\begin{cases}p^2/2,&\mbox{ if }p \le d,\\ pd-d^2/2,&\mbox{ else.}\end{cases} $$
In terms of $f$ and $p$, I'm interested in finding the largest possible value for of $d$.
Question. Could someone kindly verify my argument below.
Argument
It is clear that $G(d) \le p^2/2$ for any $d \ge 0$. Now,
- If $f \ge p^2/2$, then the inequality $f \ge G(d)$ has solution set all of $\mathbb R_+$.
- If $f < p^2/2$, then the inequality $f \ge G(d)$ is equivalent to $d < p$ and $f \ge pd - d^2/2$, i.e $$ d \le p-\sqrt{p^2-2f} = \dfrac{2f}{p+\sqrt{p^2-2f}}. $$
Context. The problem is quite elementary, but is a crucial part of a bigger argument (not presented here). A bug in the solution to this elementary problem could therefore have a big (negative) impact on the bigger argument.