Absolute extrema of $\sin x+\cos y+\sin (xy)$ on a square

383 Views Asked by At

I want to find the absolute extrema of the function $f(x,y)=\sin x+\cos y+\sin (xy)$ on $\{ (x,y) \mid 0\le x\le 2\pi,~0\le y \le 2\pi \}$. I tried by finding the gradient of the function $f$, but it is hard to find $(x,y)$ to satisfy $\operatorname{grad} f(x,y)=(0,0)$. I need your help.

1

There are 1 best solutions below

0
On

Contrary to the claim by the doctor below, the gradient $\nabla f$ has zeros in the domain. Below are the graphs of the zero contours of the partial derivatives $\partial_x f$ and $\partial_y f$, plotted in Mathematica. The zeros of the gradient are precisely the points where the contours intersect.

ContourPlot[{Cos[x] + y Cos[x y] == 0, x Cos[x y] - Sin[y] == 0},
    {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}]

Zero contours

You can prove the existence of solutions to $\nabla f(x,y) = 0$, thanks to Taylor's theorem, by either

  1. Approximating the two zero contours near any point where the computer suggests they intersect, or
  2. Bounding $f$ on the boundary and then showing that $f$ exceeds those bounds in the interior.

Method 2, by the way, would also show that the global extrema on this domain lie in the interior. I won't bother writing down the excruciatingly tedious details because it will bore everyone (including myself), and would probably exceed the character limit of this answer box.

Anyways, in general you shouldn't expect to be able to find nontrivial closed-form solutions to all but the simplest of equations. This appears to be one of those non-simple situations. So, let's approach the problem numerically instead.

Since $f$ has multiple local extrema, we first need to identify which of those extrema are global. Here is the contour plot of $f$ where $f \geq 2$:

ContourPlot[Sin[x] + Cos[y] + Sin[x y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]},
    PlotRange -> {2, 3}, PlotLegends -> Automatic]

High regions

Zooming in on the yellow region, we find that the global maximum lies at approximately $(1.27, 6.22)$, and $\max f \approx 2.95$.

ContourPlot[Sin[x] + Cos[y] + Sin[x y], {x, 1.22, 1.32}, {y, 6.05, 2 \[Pi]}, 
    PlotRange -> {2.94, Automatic}, PlotLegends -> Automatic, 
    GridLines -> {{1.26, 1.27, 1.28}, {6.21, 6.22, 6.23}}]

Plot near maximum

ContourPlot[{Cos[x] + y Cos[x y] == 0, x Cos[x y] - Sin[y] == 0},
    {x, 1.22, 1.32}, {y, 6.05, 2 \[Pi]},
    GridLines -> {{1.26, 1.27, 1.28}, {6.21, 6.22, 6.23}}]

Intersection of zero contours at maximum

Similarly, here is the contour plot of $f \leq -2$:

ContourPlot[Sin[x] + Cos[y] + Sin[x y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}, 
    PlotRange -> {-3, -2}, PlotLegends -> Automatic]

Low regions

Zooming in on the deep blue region would locate the minimum at around $(4.95, 3.48)$ and yield $\min f \approx -2.91$.

If you need higher precision, you can keep zooming in. Or, you can unleash one of any number of optimization methods, such as gradient descent (applied to $f$) or Newton's method (applied to $\nabla f$), using the approximate coordinates we found above as starting points.