# Visualizing the zeros of a function of three variables

I have a function f[x_, y_, z_] := (x - y) (z^2 - x*y) of three variables x, y and z. The conditions for f[x, y, z] to have zeros are x=y or z^2 = x*y. Now if I impose the condition that that f[x, y, z]  is a non-negative function, then how do the above conditions for zeros get affected for a fixed x while varying y and z?

• You can use RegionFunction in ContourPlot3D[] to impose your constraints. Commented Sep 19, 2023 at 15:59
• f[x_, y_, z_] := (x - y) (z^2 - x*y); ContourPlot3D[ f[x, y, z] == 0 // Evaluate, {y, -5, 5}, {z, -5, 5}, {x, -5, 5}, PlotPoints -> 30, MaxRecursion -> 2, RegionFunction -> Function[{x, y, z}, f[x, y, z] >= 0], RegionBoundaryStyle -> None, AxesLabel -> {"y", "z", "x"}, LabelStyle -> {10, Bold}] Commented Sep 19, 2023 at 22:07

a = 1;
f[x_, y_, z_] := Max[{(x - y) (z^2 - x*y), 0}];
ContourPlot3D[f[x, y, z], {x, -a, a}, {y, -a, a}, {z, -a, a}]


UPDATE

This is probably more exactly what you are asking. Mathematica has a bit of a problem plotting the surface where the function is zero or near zero:

a = 1;
g[x_, y_, z_] := (x - y) (z^2 - x*y);
f[x_, y_, z_] := Piecewise[{{g[x, y, z], g[x, y, z] >= 0}}, Undefined]
ContourPlot3D[f[x, y, z], {x, -a, a}, {y, -a, a}, {z, -a, a}]