how to maximize $f(x,y)=\frac{x+y-2}{xy}$?

106 Views Asked by At

How to maximize $f(x,y)=\frac{x+y-2}{xy}$ where $x,y \in \{1,2,\ldots,n\}$?

It seems that maximum will occur when $(x,y)=(1,n)$ or $(n,1).$

2

There are 2 best solutions below

5
On BEST ANSWER

Note that $f(1,1)=0$ and $f(1,2)=f(2,1)=\frac {1}{2}$

Otherwise, $$\begin{align} f(x,y)&=\frac{x+y-2}{xy}\\ &=\frac {1}{y} +\frac {1}{x} - \frac {2}{xy}\\ &=\frac {1}{y} \left(1-\frac {1}{x}\right) +\frac {1}{x}\left(1-\frac {1}{y}\right)\\ &\le\frac {1}{2} \left(1-\frac {1}{x}\right) +\frac {1}{2}\left(1-\frac {1}{y}\right)\\ &\le1-\frac {1}{n} \end{align}$$

Note that $$f(1,n)= 1-\frac {1}{n}$$

Thus the maximum is $ 1-\frac {1}{n}$ which is achieved at $(1,n)$.

2
On

Let $M$ be a maximal value.

Thus, $$Mxy-x-y+2\geq0,$$ which is a linear inequality of $x$ and of $y$, which says that it's enough to check this inequality for the extreme values of $x$ and $y$: $$(x.y)\in\{(1,1),(n,n),(1,n),(n,1)\},$$ which gives $$M\in\left\{0,\frac{2(n-1)}{n^2},\frac{n-1}{n}\right\},$$ which gives that $\frac{n-1}{n}$ is a maximal value.