# Maximizing a function of two variables

• October 3rd 2009, 06:15 AM
garymarkhov
Maximizing a function of two variables
$f(x,y)=(4-x^2)y-2y^2-1$ on the set $\{ x\geq 1, y\geq 1 \}$

Can someone tell me if this is right?

$\frac{\partial f}{\partial x} = -2xy$

$\frac{\partial f}{\partial y} = 4-x^2-4y$

Setting the partials equal to zero, we can find that

$y = 1 - \frac{x^2}{4}$

and

$-2x(1 - \frac{x^2}{4}) = 0$

So

$x(2x^2-8)=0$

and we can see that x is either 0, 2, or -2. So the inflection points are (0,1), (2,0), (-2,0). So $f(0,1)=1$ is the greatest value we can get.

Checking the boundary conditions, we see that things only get worse if we make x or y larger.

Forming the Hessian at this point, $\left(\begin{array}{cc} -2y & -2x \\ -2x & -4 \end{array}\right) = \left(\begin{array}{cc} -2 & 0 \\ 0 & -4 \end{array}\right)$

This is a symmetric matrix, so the diagonal values are the eigenvalues. Both eigenvalues being negative means that the matrix is negative definite and (0,1) is a max of this function. Put another way, the leading principle minors alternate in sign so the matrix must be negative definite.

Can someone confirm that my calculations are right and make a note if I could have done something more efficiently? Thanks.
• October 5th 2009, 05:01 AM
CaptainBlack
Quote:

Originally Posted by garymarkhov
$f(x,y)=(4-x^2)y-2y^2-1$ on the set $\{ x\geq 1, y\geq 1 \}$

Can someone tell me if this is right?

$\frac{\partial f}{\partial x} = -2xy$

$\frac{\partial f}{\partial y} = 4-x^2-4y$

Setting the partials equal to zero, we can find that

$y = 1 - \frac{x^2}{4}$

and

$-2x(1 - \frac{x^2}{4}) = 0$

So

$x(2x^2-8)=0$

and we can see that x is either 0, 2, or -2. So the inflection points are (0,1), (2,0), (-2,0). So $f(0,1)=1$ is the greatest value we can get.

Checking the boundary conditions, we see that things only get worse if we make x or y larger.

Forming the Hessian at this point, $\left(\begin{array}{cc} -2y & -2x \\ -2x & -4 \end{array}\right) = \left(\begin{array}{cc} -2 & 0 \\ 0 & -4 \end{array}\right)$

This is a symmetric matrix, so the diagonal values are the eigenvalues. Both eigenvalues being negative means that the matrix is negative definite and (0,1) is a max of this function. Put another way, the leading principle minors alternate in sign so the matrix must be negative definite.

Can someone confirm that my calculations are right and make a note if I could have done something more efficiently? Thanks.

None of your critical points are feasible, that is they are not within the region that the mininmum is required.

In which case any extrema should lie on the boundary of the feasible region.

CB
• October 5th 2009, 06:09 AM
garymarkhov
Quote:

Originally Posted by CaptainBlack
None of your critical points are feasible, that is they are not within the region that the mininmum is required.

In which case the minimum should lie on the boundary of the feasible region.

CB

Good point, but do you mean the "maximum should lie on the boundary of the feasible region"? I'm trying to maximize the function, not minimize it.
• October 5th 2009, 06:38 AM
HallsofIvy
Yes. Both maximum and minimum must either lie at a point where the gradient is 0 or on the boundary of the set. Since the gradient is never 0 in this set, both maximum and minimum must be on the boundary. That means you must look at [tex]f(x,1)= 1- x^2[tex], $x\ge 1$ and $f(1, y)= 3y- 2y^2- 1$, $y\ge 1$. And, of course, you must check the point (1,1) itself.

Since this region is not bounded, there do not necessarily exist points where the function is maximum or minimum. (In this case, the maximum does exist but there is no minimum.)
• October 5th 2009, 07:15 AM
garymarkhov
Quote:

Originally Posted by HallsofIvy
Yes. Both maximum and minimum must either lie at a point where the gradient is 0 or on the boundary of the set. Since the gradient is never 0 in this set, both maximum and minimum must be on the boundary. That means you must look at [tex]f(x,1)= 1- x^2[tex], $x\ge 1$ and $f(1, y)= 3y- 2y^2- 1$, $y\ge 1$. And, of course, you must check the point (1,1) itself.

Since this region is not bounded, there do not necessarily exist points where the function is maximum or minimum. (In this case, the maximum does exist but there is no minimum.)

Why do you say "both maximum and minimum must be on the boundary" and then go on to say "In this case, the maximum does exist but there is no minimum"?

In any case, I find that if $x=1$, the max for $y$ would be $\frac{3}{4}$. If $y=1$, the max for $x$ would be $0$. Since those combinations aren't within the boundary, $(1,1)$ is the winner. Correct?
• October 5th 2009, 01:15 PM
CaptainBlack
Quote:

Originally Posted by garymarkhov
Why do you say "both maximum and minimum must be on the boundary" and then go on to say "In this case, the maximum does exist but there is no minimum"?

In any case, I find that if $x=1$, the max for $y$ would be $\frac{3}{4}$. If $y=1$, the max for $x$ would be $0$. Since those combinations aren't within the boundary, $(1,1)$ is the winner. Correct?

Put x=1 then maximise the objective under that constraint, then instead try y=1 and maximise under that constraint. If one or more of these maxima are feasible then the larger of these two maxima is the global maxima that you seek.

If neither are feasible either (1,1) gives the maximum or there is no maximum. In this case the brute force approach of plotting the function over a reasonably sized part of the feasible quarter space shows that (1,1) is probably the point giving the maximum.

CB