Im trying to plot this graph in mathematica: (x+y)sin(x-y)

And this is my in- and output:

Plot3D[(x + y) (Sin[x - y]), {x, -50, 50}, {y, -50, 50}]

The output is this: enter image description here

My goal is to find how many max/min and saddle points there are in R2 of the function. How can I get that answer from the graph?

  • 1
    $\begingroup$ Use Sin instead of sin. $\endgroup$
    – Syed
    May 23 at 10:54
  • $\begingroup$ Okay it's working now, but how can I determine how many max/min points there are? $\endgroup$
    – Kei Len
    May 23 at 10:57
  • $\begingroup$ I think you should first start by looking at a smaller segment of the plot then try to determine algebraically the min and max points. Looks to me they are along the digaonal lines y=ax+b periodic in sin(x-y). $\endgroup$
    – josh
    May 23 at 12:29
  • $\begingroup$ Change coordinates $u=x+y$, $v=x-y$, and optimize $u \sin v$, that is, solve $\sin v = 0,\ u \cos v = 0$, which is fairly easy by inspection. $\endgroup$
    – Michael E2
    May 26 at 17:00

1 Answer 1


First, to see what is going on, a simpler example:

eq = {D[f[x, y], x] == 0, 
   D[f[x, y], y] == 0, -5 <= x <= 5, -5 <= y <= 5};
sol = Solve[eq, {x, y}] // N

Show[Plot3D[(x + y) (Sin[x - y]), {x, -5, 5}, {y, -5, 5}]
 , Graphics3D[{PointSize[0.03], Point[{x, y, f[x, y]} /. sol]}]]

enter image description here

We only have saddle points, no minima or maxima.

Now for the original problem: How many saddle points are in R^2?

f[x_, y_] = (x + y) Sin[x - y];
eq = {D[f[x, y], x] == 0, D[f[x, y], y] == 0};
Reduce[eq, {x, y}]

enter image description here

Therefore there are an infinity of saddle points on the diagonal x==-y and x== c1 Pi and x== (c1+1/2) Pi.


Not the answer you're looking for? Browse other questions tagged or ask your own question.