How to maximize f(x,y)=(x+y-2)/(xy) where x,y in {1,2,…,n}? It seems that maximum will occur when (x,y)=(1,n) or (n,1).

How to maximize $f\left(x,y\right)=\frac{x+y-2}{xy}$?
How to maximize $f\left(x,y\right)=\frac{x+y-2}{xy}$ where $x,y\in \left\{1,2,\dots ,n\right\}$?
It seems that maximum will occur when $\left(x,y\right)=\left(1,n\right)$ or $\left(n,1\right).$
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

darkflamexivcr
Note that $f\left(1,1\right)=0$ and $f\left(1,2\right)=f\left(2,1\right)=\frac{1}{2}$
Otherwise,
$\begin{array}{rl}f\left(x,y\right)& =\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)\\ & \le 1-\frac{1}{n}\end{array}$
Note that
$f\left(1,n\right)=1-\frac{1}{n}$
Thus the maximum is $1-\frac{1}{n}$ which is achieved at $\left(1,n\right)$.

Konciljev56
Let M be a maximal value.
Thus,
$Mxy-x-y+2\ge 0,$
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:
$\left(x.y\right)\in \left\{\left(1,1\right),\left(n,n\right),\left(1,n\right),\left(n,1\right)\right\},$
which gives
$M\in \left\{0,\frac{2\left(n-1\right)}{{n}^{2}},\frac{n-1}{n}\right\},$
which gives that $\frac{n-1}{n}$ is a maximal value.