# RegionFunction with equalities?

Can we use RegionFunction with Plot3D for equalities? This answer (Plot multivariable function with constraints) has shown the use of RegionFunction with inequalities, but the same commands don't work for equality constraints. Any way out?

• Can you show an example of what you are trying to achieve, with the code you currently have? Did you see the use of PlotStyle -> None in the linked question's answers to obtain only the boundary of the region identified with the inequality? That would be functionally equivalent to plotting the equality. – MarcoB Apr 24 '18 at 19:37
• @MarcoB, the options given in the other answer in that link are not applicable in this case. I used Plot3D[x + 2 y, {x, -Sqrt[5], Sqrt[5]}, {y, -Sqrt[5], Sqrt[5]}, RegionFunction -> Function[{x, y}, x^2 + y^2 - 1]] and it gives a circular 'hole' in the plot of x+2y, instead of showing just the circle on top of the plot of x+2y – sant Apr 24 '18 at 19:57

This approach may not be the most direct, but here is how I envisioned using the techniques shown in kglr's answer to the linked question (Q157490) to achieve your goal, as I understand it:

Show[
(* This generates the plot of the surface of interest *)
Plot3D[x + 2 y, {x, -Sqrt[5], Sqrt[5]}, {y, -Sqrt[5], Sqrt[5]}],

(* This generates the region boundary *)
Plot3D[
x + 2 y, {x, -Sqrt[5], Sqrt[5]}, {y, -Sqrt[5], Sqrt[5]},
RegionFunction -> Function[{x, y}, x^2 + y^2 < 1],
BoundaryStyle -> Directive[Thick, Black],
PlotStyle -> None, Mesh -> None
]
]