Find the maximum attained by $f(x,y)=\frac{|a_1+a_2x+a_3(y-\alpha)|}{\sqrt y}$ in the triangle $\mathcal T$ Let us consider the function
$$f(x,y)=\frac{|a_1+a_2x+a_3(y-\alpha)|}{\sqrt y}$$
where $a_1,a_2,a_3\in\mathbb R$ and $\alpha>0$. Find the maximum attained by $f(x,y)$ in the triangle $\mathcal T$ formed by the lines $x=0$, $x=y-\alpha$, $y=\alpha+1$.
My attempt. I tried to simplify the absolute value, thus:
$$f(x,y)=\begin{cases}\frac{a_1+a_2x+a_3(y-\alpha)}{\sqrt y} \hspace{9.8mm}\text{if}\hspace{3mm} y\geq \alpha-\frac{a_1}{a_3}-\frac{a_2}{a_3}x \\   -\frac{a_1+a_2x+a_3(y-\alpha)}{\sqrt y} \hspace{6.5mm}\text{if}\hspace{3mm} y<\alpha-\frac{a_1}{a_3}-\frac{a_2}{a_3}x\end{cases}$$
but $\frac{\partial f}{\partial x}\neq0$. So we have to look for the maximum on the sides of the triangle:
$$\begin{cases}f(y-\alpha,y) \hspace{7mm}\text{if}\hspace{3mm} y\in[\alpha,\alpha+1] \\   f(0,y) \hspace{15mm}\text{if}\hspace{3mm} y\in[\alpha,\alpha+1]\\
f(x,\alpha+1) \hspace{7mm}\text{if}\hspace{3mm} x\in[0,1]
\end{cases}$$
Is it correct? Now I should do the derivatives trying to simplify the absolute values for the first two functions of the previous equation.
 A: Let
$$g(x, y) := [f(x, y)]^2 = \frac{[a_1+a_2x+a_3(y-\alpha)]^2}{y}.$$
We need to find the maximum of $g(x, y)$ subject to $0 \le x \le y - \alpha$ and $\alpha \le y \le \alpha + 1$.
Fact 1: If $F(u)$ is convex on $[a, b]$,
then $\max\limits_{a\le u \le b} F(u) = \max\{F(a), F(b)\}$.
Fact 2: If $F_1(u)$ and $F_2(u)$ are both continuous on $[a, b]$, then
$$\max_{a\le u \le b} \max\{F_1(u), F_2(u)\} = 
\max\left\{\max_{a\le u \le b} F_1(u), ~ \max_{a\le u \le b} F_2(u)\right\}.$$
Now, we have
\begin{align*}
 &\max_{0 \le x \le y - \alpha, ~
  \alpha \le y \le \alpha + 1} g(x, y)\\[5pt]
 =\,& \max_{\alpha \le y \le \alpha + 1} ~
 \max_{x : ~ 0 \le x \le y - \alpha} g(x, y)\\[5pt]
 =\,& \max_{\alpha \le y \le \alpha + 1}
 \max\{ g(0, y), ~ g(y - \alpha, y)\} \tag{1}\\[5pt]
 =\,&
 \max\left\{\max_{\alpha \le y \le \alpha + 1} g(0, y),~ \max_{\alpha \le y \le \alpha + 1} g(y - \alpha, y)\right\} \tag{2}\\[5pt]
 =\,& \max\Big\{\max\{g(0, \alpha), ~ g(0, \alpha + 1)\}, ~ \max\{g(0, \alpha), ~ g(1, \alpha + 1)\}\Big\} \tag{3}\\[5pt]
 =\,& \max\{g(0, \alpha), ~ g(0, \alpha + 1),~ g(1, \alpha + 1)\}.
\end{align*}
Explanations:
(1): $g(x, y)$ is convex in $x$, Fact 1.
(2): Fact 2.
(3): $g(0, y)$ and $g(y - \alpha, y)$ are both convex on $y > 0$, Fact 1.
Thus, the maximum of $f(x, y)$ subject to
$0 \le x \le y - \alpha$ and $\alpha \le y \le \alpha + 1$ is given by
$$\max\{f(0, \alpha), ~ f(0, \alpha + 1),~ f(1, \alpha + 1)\}
= \max\left\{\frac{|a_1|}{\sqrt \alpha}, ~ \frac{|a_1 + a_3|}{\sqrt{\alpha + 1}},
~ \frac{|a_1 + a_2 + a_3|}{\sqrt{\alpha + 1}}\right\}.$$
A: Triangle $ \ \mathcal{T} \ $ has vertices $ \ A \ (0 \ , \ \alpha) \ \ , \ \ B \ (0 \ , \ \alpha + 1) \ \ , \ \ C \ (1 \ , \ \alpha + 1) \ \ , \ \ \alpha \ > \ 0 \ \ , $ with the "oblique" side on the line $ \ x \ = \ y - \alpha \ \ . \ $  Since the coefficients in the numerator of $ \ f(x,y) \ $ are unconstrained, we will need to consider cases in dealing with the absolute-value in the function expression, about which more later.
We may start by removing the absolute-value brackets for the present and consider the function $ \  g(x,y) \ = \ \large{\frac{ a_1 \ + \ a_2 \ x \ + \ a_3·(y-\alpha) }{\sqrt y}} \ \ . \ $  Along a "horizontal" line $ \ y \ = \ Y \ \ , \ \ \alpha \ < \ Y \ < \ \alpha + 1 \ $ passing through $ \ \mathcal{T} \ $ from $ \ (0 \ , \ Y ) \ $ to $ \ (X \ = \ Y - \alpha \ , \ Y) \ \ , \ $  the function  is  $ \  g(x,Y) \ = \ \large{\frac{ a_1 \ + \ a_2 \ x \ + \ a_3·X }{\sqrt Y}} \ \ . \ $  So $ \ g(x,Y) \ $ is just a linear function which has its maximal value $ \ g(X,Y) \ = \ \large{\frac{ a_1 \ + \ (a_2  +   a_3)·X }{\sqrt Y}} \ $ for $ \ a_2  \ > \ 0 \ $ or $ \ g(0,Y) \ = \ \large{\frac{ a_1 \ + \ a_3·X }{\sqrt Y}} \ $ for $ \ a_2  \ < \ 0 \ \ . $  This tells us that $ \ g(x,y) \ $ has no critical points in the interior of $ \ \mathcal{T} \ \ , \ $ which will mean, when we "put back" the absolute-value brackets, that while $ \ f(x,y) \ $ could have a minimum of zero in the interior (should $ \ g(x,y) \ $ change sign), the maximum can only occur on the boundary of the region.  [This also hints at the complication in finding the maximum for the function for general coefficients.]
On the edges of the triangle, we have
• $ \quad \mathbf{AB}  : \ \ g(0,y) \ = \ \large{\frac{ (a_1 \ - \ a_3·\alpha) \ + \ a_3·y }{\sqrt y}} \ \ \normalsize{\Rightarrow \ \ g(0,\alpha) \ = \ \large{\frac{  a_1  }{\sqrt \alpha}}} \ \ , \ \ g(0,\alpha + 1) \ = \ \large{\frac{  a_1  \ + \ a_3 }{\sqrt {\alpha \ + \ 1}} \ \ ;}  $
• $ \quad \mathbf{BC}  : \ \ g(x,\alpha + 1) \ = \ \large{\frac{ (a_1 \ + \ a_3) \ + \ a_2·x }{\sqrt{\alpha \ + \ 1}}} \ \ \normalsize{\Rightarrow \ \ g(0,\alpha + 1) \ = \ \large{\frac{  a_1 \ + \ a_3  }{\sqrt{\alpha \ + \ 1}}}} \ \ , $
$ \quad \quad \quad g(1,\alpha + 1) \ = \ \large{\frac{  a_1  \ + \ a_2 \ + \ a_3 }{\sqrt {\alpha \ + \ 1}} \ \ ;}  $
• $ \quad \mathbf{AC}  : \ \ g(y - \alpha,y) \ = \ \large{\frac{ (a_1 \ - \ [a_2 + a_3]·\alpha) \ + \ [a_2 + a_3]·y }{\sqrt{y}}} \ \ \normalsize{\Rightarrow \ \ g(0,\alpha) \ = \ \frac{  a_1  }{\sqrt{\alpha }}} \ \ , $
$ \quad \quad \quad g(1,\alpha + 1) \ = \ \large{\frac{  a_1  \ + \ a_2 \ + \ a_3 }{\sqrt {\alpha \ + \ 1}}} \ \ .   $
We see that $ \ g(x,y) \ $ along side $ \ BC \ $ is a linear function, but may be increasing or decreasing depending on the sign of $ \ a_2 \ \ , $ as has already been mentioned.  Along sides $ \ AB \ $ and $ \ AC \ \ , \ $  it is instead the sum of both an increasing $ \ ( \ c·\sqrt{y} \ ) \ $ and a decreasing $ \ ( \ \frac{C}{\sqrt{y}} \ ) \ $ function of $ \ y \ \ , $ so the relative contributions of these terms is dependent upon not only the signs but also the relative "magnitudes" of the coefficients.
The presence of the absolute-value brackets in the numerator of the expression for $ \ f(x,y) \ $ complicates this further if we seek to know at which vertex the maximum of the function is attained.  To illustrate this, let us choose $ \ \alpha \ = \ 4 \ \ . \ $ Even restricting ourselves to $ \ a_1 \ , \ a_2 \ , \ a_3 \ > \ 0 \ \ , $ we can obtain different relationships between the function values at the three vertices of $ \ \mathcal{T} \ \ . $
In the table below, the change in coefficients between the first two rows changes $ \ f(0,y) \ $ from an increasing to a decreasing function of $ \ y \ \ ; \ $ the additional change shown in the third row "flattens" the surface of $ \ f(x,y) \ $ sufficiently that its value at vertex $ \ A \ $ becomes slightly larger than at the other two vertices.
When we permit the coefficients to take on negative values, there are additional consequences.  Having $ \ a_2 \ < \ 0 \ \ , $ as is shown in the fourth row, will make $ \ g(x,\alpha + 1) \ $ a decreasing function of $ \ x \ $ (as has been said before); it becomes possible for  $ \ f(0,\alpha + 1) \ $ to take on the maximal value.
In all of the examples thus far, $ \ g(x,y) \ > \ 0 \ $ on $ \ \mathcal{T} \ \ , $ so $ \ f(x,y) \ $ is identical.  The final two rows of the table include negative values for $ \ a_2 \ $ and $ \ a_3 \ $ that cause $ \ g(x,y) \ $ to be negative over a portion of the region.  Taking the absolute-value produces a "crease" in the function surface of $ \ f(x,y) \ $ where it has the minimum value of zero.  A small change in the coefficients can cause $ \ g(x,y) \ $ to take on a more negative value at a vertex, which may then have the largest absolute-value for its function values, thereby becoming the maximal value of $ \ f(x,y) \ \ . $

maximal value for each example in boldface
We see then that while the result given by River Li is formally correct, it somewhat conceals the complicated behavior of this function; in the end, we only settle what the maximal value is by inserting the coefficients into the expressions for the vertex values.  A complete cataloguing of cases to provide a direct method of finding which vertex value is largest would involve developing several coefficient inequalities.
A: Forming the lagrangian
$$
L(x,y,\lambda,s) = \frac{1}{y}(a_1+a_2 x+a_3(y-\alpha))^2+\lambda_1(x-s_1^2)+\lambda_2(x-y+\alpha+s_2^2)+\lambda_3(y-\alpha-1+s_3^2)
$$
here $s_1,s_2,s_3$ are slack variables to transform the inequalities
$$
\cases{
x\ge 0\\
y\le \alpha+1\\
y \ge x + \alpha}
$$
defining the feasible region, into equivalent equations.
The stationary points to the lagrangian are the solutions to
$$
\nabla L = 0 = \left\{
\begin{array}{l}
 \frac{2 a_1 (a_1+a_2 x+a_3 (y-\alpha ))}{y}+\lambda_1+\lambda_2\\
 -\frac{(a_1+a_2 x-a_3 \alpha )^2}{y^2}+a_3^2-\lambda_2+\lambda_3 \\
 x-s_1^2 \\
 \alpha +s_2^2+x-y \\
 -\alpha +s_3^2+y-1 \\
 -2 \lambda_1s_1\\
 2 \lambda_2 s_2 \\
 2 \lambda_3 s_3 \\
\end{array}
\right.
$$
