# ContourPlot and 3Dplot of $f(x,y,z)=x z + y z - x y z$

I have a function of 3 variables: $x$, $y$, and $z$. This is the function: $$f(x,y,z)=x z + y z - x y z$$

1. Is there a way for me to graph this function? (3D graph)
2. Can you sketch several representative contour plots from the family of equations for various choices of c. We might place them all together in one plot?
3. Can this function of three variables be visualized as a 2D grid of 2D contours? As shown in the picture Thanks for the help.

You (apparently) have a scalar function of three variables, so you cannot use a simple ContourPlot; you must use ContourPlot3D. Moreover 3DPlot (which does not exist in Mathematica but instead Plot3D) takes a function of two variables and plots the value in the third dimension.

DensityPlot3D[x z + y z - x y z,
{x, -2, 2},
{y, -2, 2},
{z, -2, 2},
PlotLegends->Automatic] If you want contours:

ContourPlot3D[x z + y z - x y z,
{x, -2, 2},
{y, -2, 2},
{z, -2, 2},
Contours -> 10] If you want two-dimensional slices:

GraphicsGrid[
Partition[
Table[
ContourPlot[x z + y z - x y z,
{x, -2, 2},
{y, -2, 2}],
{z, -2, 2, .5}],
3]] • Thank you very much for the wonderful work .... Can you plote afunction of 3 variables could be visualized as a 2D grid of 2D contours as this i.stack.imgur.com/QRjO6.png Jun 8 '17 at 22:28
• @Emad: So PLEASE ANSWER: What is $c$?? Jun 8 '17 at 22:56
• c representation a constant level set ...... we assume $f(x,y,z)=c$ where c is constant Jun 8 '17 at 23:01
• @ David G. Stork Please see this question math.stackexchange.com/questions/1573755/… to understand me Jun 8 '17 at 23:06

This is for illustrative purposes. ContourPlot can be used for grid of graphics and SliceContourPlot3D for a 3D visualization. Noting the link to the provided graphic does not relate to provided function, the differences in plot are expected.

f[x_, y_, z_] := x z + y z - x y z
cp[c_, z0_] :=
ContourPlot[f[x, y, z0] == c, {x, -4, 4}, {y, -4, 4},
FrameLabel -> {Row[{"c=", c, ", z=", z0}], None}, BaseStyle -> 12]
Grid[Table[cp[i, j], {j, Range[-2, 2]}, {i, Range[-2, 2]}],
Frame -> All, Spacings -> {2, 0}]
g[x_, y_, z_, c_] := f[x, y, z] - c
scp[c_, z0_] :=
SliceContourPlot3D[
g[x, y, z, c], {z == z0}, {x, -4, 4}, {y, -4, 4}, {z, -4, 4},
Contours -> {0}, ContourShading -> None, ContourStyle -> Thick]  