# Closed form for the maximum of the two-variable function $(a x + (1 - a) y) (b (1 - x) + (1 - b) (1 - y))$

Mathematics Asked on January 5, 2022

I’m trying to characterize the maximum of this function within the unit interval ($$x,yin [0,1]$$):

$$f(x,y)=(a x + (1 – a) y) (b (1 – x) + (1 – b) (1 – y))$$

for $$0 < a < 1$$ and $$0 < b < 1$$.

An observation is that each factor is a convex combination of $$x$$ and $$y$$.

By plotting the graph of $$f$$, I see that there is a unique maximum for any value in the range of $$a$$ and $$b$$. I have tried using Lagrange multipliers with no luck using the condition $$x+y-2=0$$. If $$g(x,y)=x+y-2$$, the Lagrange function is:

$$mathcal L(x,y) = f(x,y)+lambda,g(x,y)$$

I compute the gradient of $$mathcal L$$ and solve the system of equations:

$$nablamathcal L(x,y,lambda)=0$$

The solutions are:
$$x* = frac{4a – 3}{2 (2 a – 1)}$$
$$y* = frac{4a – 1}{2 (2 a – 1)}$$
$$lambda = frac{a-b}{2 (2 a – 1)}$$

In order for the condition to be active, $$lambda > 0$$, iff, $$1>a>b>frac{1}{2}$$ or $$frac{1}{2}>b>a>0$$ or $$1>b>frac{1}{2}>a>0$$ or $$1>a>frac{1}{2}>b>0$$

The objective function evaluated on the solution is:
$$f(x*, y*)=frac{1-2b}{4(1-2a)}$$

which is positive only if $$a,b>frac{1}{2}$$ or $$a,b.

I would conclude that the maximum would be

$$x* = frac{4a – 3}{2 (2 a – 1)}$$
$$y* = frac{4a – 1}{2 (2 a – 1)}$$

when $$1>a>b>frac{1}{2}$$ or $$frac{1}{2}>b>a>0$$. However, what is the expression of the maximum for the other cases of $$a$$ and $$b$$?

For, instance, I can clearly see in the plot that when $$a=1$$ and $$b=0$$, the maximum is $$(0, 1)$$ and when $$a=0$$ and $$b=1$$ the maximum is $$(1, 0)$$. And when $$a=b=frac{1}{2}$$, the maximum is the line $$y=1-x$$.