How to calculate $\max\left\{\,\dfrac{1}{x}+\max\left\{\,\dfrac{2x}{x+y}, 1\right\} \right\} $

48 Views Asked by At

I am doing a case analysis for coming up with the worst-case performance of an algorithm. At some points, I need to calculate the maximum value of the following: $$\dfrac{1}{x}+\max\left\{\,\dfrac{2x}{x+y}, 1\right\}$$ where $x \in \mathbb{N}$, $y\in \mathbb{R}$, $y>1$, and $1 \leq x \leq \lceil y \rceil$ ?

1

There are 1 best solutions below

2
On BEST ANSWER

The answer is $2$ by classifying into $2$ cases, as $x\le \left\lceil\,y\right\rceil$

Case $(1)$ $x\le y$, we have $\dfrac{2x}{x+y}=\dfrac{2}{1+\frac{y}{x}}\le 1$ and , thus, $\max\left\{\,\dfrac{2x}{x+y},1\right\}=1$ and our expression becomes $=\dfrac{1}{x}+1\le 2$, if we let $x=1$

Case $(2)$ $x>y$ , this case is the same as $(1)$ that we have $\max\left\{\,\dfrac{2x}{x+y},1\right\}=\dfrac{2x}{x+y}$ and the expression is $$\dfrac{1}{x}+\dfrac{2x}{x+y}=\dfrac{2x^2+x+y}{x^2+xy}\le 2\Longleftrightarrow (xy-1)+(x-1)(y-1)\ge 0$$ which is true, since $x,y\ge 1$ $\Box$