# How to make a 3D plot of $(x^2+y^2-1)^2+(y^2+z^2-1)^2+(x^2+z^2-1)^2=0$ [closed]

How can I make a 3D plot of

$$(x^2+y^2-1)^2+(y^2+z^2-1)^2+(x^2+z^2-1)^2=0$$

Does the above equation describes the same region as

$$x^2+y^2\le 1\wedge y^2+z^2\le 1\wedge x^2+z^2\le 1$$

• Do we have a canonical version that this one can be marked a duplicate of? I thought we did but I cannot find it. The problem is that it's not that obvious to a newbie how to get from implicit equation (usual math term) to ContourPlot. Apr 11, 2015 at 16:27
• @Szabolcs Here are a couple of candidates. 3D: 10710. 2D: 34668. But since this solution set is a finite set of points (one might call it a degenerate surface), using ContourPlot3D is not a solution. See ubpdqn's answer. Apr 11, 2015 at 19:26
• @MichaelE2 You're right, I wasn't careful. Apr 11, 2015 at 19:37
• @Szabolcs Actually the OP's second formulation is the intersection of three solid cylinders, which is quite different. (This time, I was careless. I didn't even read it the first time.) Apr 11, 2015 at 19:44
• @UnitedKingdom Since the second region is bounded by cylinders, you can get a good plot with ParametricPlot3D like this i.stack.imgur.com/hEL0u.png. Code dump here: chat.stackexchange.com/transcript/message/21045469#21045469 Apr 11, 2015 at 20:20

ContourPlot3D seems to do it

f = (x^2 + y^2 - 1)^2 + (y^2 + z^2 - 1)^2 + (x^2 + z^2 - 1)^2;
ContourPlot3D[f, {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
ContourStyle -> Opacity[1], Mesh -> None, Contours -> {1}]


There are many other options you can try for this command. You can change the options for Contours Opacity, and Mesh, etc.

### Update

RegionPlot3D[
x^2 + y^2 <= 1 && y^2 + z^2 <= 1 && x^2 + z^2 <= 1,
{x, -2, 2}, {y, -2, 2}, {z, -2, 2}]


• Thanks,maybe is $x^2+y^2\le 1,y^2+z^2\le 1,x^2+z^2\le 1$ Apr 11, 2015 at 6:24
• It's very nice,Thank you Apr 11, 2015 at 7:43
• Why do you set contours at 1, when the equation in OP requires 0? Apr 11, 2015 at 9:06

$(x^2+y^2-1)^2+(y^2+z^2-1)^2+(x^2+z^2-1)^2=0$

is satisfied by a set of points. This can be established:

f = (x^2 + y^2 - 1)^2 + (y^2 + z^2 - 1)^2 + (x^2 + z^2 - 1)^2;
FullSimplify[Reduce[f == 0, {x, y, z}, Reals]]
Reduce[x^2 + y^2 == 1 && z^2 + y^2 == 1 && x^2 + z^2 == 1, {x, y, z}]


i.e.

(x == -(1/Sqrt[2]) || x == 1/Sqrt[2]) && (y == -(1/Sqrt[2]) ||
y == 1/Sqrt[2]) && (z == -(1/Sqrt[2]) || z == 1/Sqrt[2])


Note as expected the last 2 results are equivalent. f=0, is a set of 8 points (vertices of a cube). This is separate issue for surfaces of f=n that can be explored by ContourPlot3D.

This can be seen in many ways:

ir = ImplicitRegion[
x^2 + y^2 == 1 && z^2 + y^2 == 1 && x^2 + z^2 == 1, {x, y, z}];
dr = DiscretizeRegion[ir]


This can be visualised by using ContourPLot3D (as alluded to by Nasser ) imagine the limiting process to contour value 0:

ContourPlot3D[f, {x, -3, 3}, {y, -3, 3}, {z, -3, 3},
Contours -> {0.1, 0.2, 0.4},
ContourStyle -> {Opacity[0.2], Opacity[0.2], Opacity[0.2]},
Mesh -> False, PlotLegends -> Automatic]


Just another way to see this:

pts = Tuples[{-1/Sqrt[2], 1/Sqrt[2]}, 3];
Graphics3D[{Opacity[0.4], Cylinder[{{0, 0, -1}, {0, 0, 1}}, 1],
Cylinder[{{0, -1, 0}, {0, 1, 0}}, 1],
Cylinder[{{-1, 0, 0}, {1, 0, 0}}, 1],
Sphere[{0, 0, 0}, Sqrt[3/2]],
Opacity[1], PointSize[0.02], Red, Point[pts]}, Boxed -> False,
Background -> Black]