[Math] Minimizing a quadratic function of 2 variables in quadratic region

nonlinear optimizationoptimizationquadratic programming

Let $f$ be a real valued quadratic function of 2 real variables:
$$f(x,y) = ax^2 + by^2 + cxy + dx + ey + f$$

How to minimize it? Subject to constraints:

$$ 0\leq x \leq 1, \quad 0\leq y \leq 1 $$

I understand the necessary conditions for equality constraint optimization (Lagrange multipliers), but I am not sure if it would help.

Best Answer

As barrycarter suggests, just set the two partial derivatives to 0: $$\frac {\partial f}{\partial x} = 0, \qquad \frac {\partial f}{\partial y} = 0$$ This gives you a pair of linear equations in $x, y$ that you can solve. The solution will be rational functions of $a, b, c, d, e$ that may or may not satisfy $0 \le x \le 1,\ \ 0 \le y \le 1$, depending on the values. If not, then in turn set $x = 0$, then $x = 1$, then $y = 0$, then $y = 1$. In each case, mimimize the function with respect to the other variable. Then select the lowest overall value among the four.