# Intersection Volume

In a cube of side "a", a sphere with center in one of the vertices intersects another sphere located in the vertex opposite to the previous one. What is the volume of the intersection?

First I tried to draw the situation The equation of one of the spheres centered at the origin is

$$x^2+y^2+z^2 =a^2$$ And the one located on the opposite vertex will be

$$(x-a)^2+(y-a)^2+(z-a)^2 =a^2$$

2 questions How to plot the situation? How to calculate the common volume?

I used several commands but I did not get the cube and the 2 spheres at the same time in a drawing

Edited: There was an error in the radios of the spheres, they have radius "a", similar to the edges of the cube

• Try this: RegionIntersection[Ball[{0, 0, 0}, 3], Ball[{1, 1, 1}, 3]] // Volume – Anjan Kumar Apr 22 '17 at 1:12
• "Unable to compute the volume of region \ RegionIntersection[Ball[{0,0,0},3],Ball[{1,1,1},3]]" :( – susy diaz Apr 22 '17 at 1:38
• Note that your problem statement mentions nothing about the radius. Are you sure that's all you've been given? – J. M.'s ennui Apr 22 '17 at 1:51
• Edited: There was an error in the radios of the spheres, they have radius "a", similar to the edges of the cube – susy diaz Apr 22 '17 at 2:11
• c = {1, 1, 1}; Show[ContourPlot3D[{(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 1, x^2 + y^2 + z^2 == 1}, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, ContourStyle -> Opacity[0.5], Mesh -> None], Graphics3D[{Red, PointSize[0.04], Point[{{0, 0, 0}, c}], Line[{{0, 0, 0}, c}]}]] --> This is the idea Similar code in forum As I get the whole spheres, and the volume – susy diaz Apr 22 '17 at 2:49

For the plotting - with a equal to 1:

Graphics3D[{Opacity[0.3], Green, Ball[], Red, Ball[{1, 1, 1}],
Opacity[0.6], Blue, Cuboid[]}] As suggested by J.M., it is possible to derive a symbolic expression for the region using

region = Simplify[RegionMember[RegionIntersection[
Ball[], Ball[{1, 1, 1}]], {x, y, z}], {x, y, z} ∈ Reals]

x^2 + y^2 + z^2 <= 1 && (-1 + x)^2 + (-1 + y)^2 + (-1 + z)^2 <= 1


which is the same as the OPs expression with a=1.

To plot just the intersection:

RegionPlot3D[region, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, PlotPoints -> 100] To find the volume, integrate over the region of intersection:

NIntegrate[Boole[region], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

0.107742

• ok , What instruction do I now take to calculate the common volume of the two spheres – susy diaz Apr 22 '17 at 21:05
• Here's the symbolic way to get the integration region: Simplify[RegionMember[RegionIntersection[Ball[], Ball[{1, 1, 1}]], {x, y, z}], {x, y, z} ∈ Reals] – J. M.'s ennui Apr 23 '17 at 2:30
• Hey what if I want to find intersection region of two ellipsoid instead? – Rajat Zope Mar 8 '18 at 11:18
• @Rajat Zope -- Define the region and then integrate over Boole[region]. – bill s Mar 8 '18 at 13:23