# Find the volume of the region defined by $|x|+|y|+|z|<4$

I want to find the volume of the region defined by the following inequality:

$\quad \quad |x|+|y|+|z|<4$

In addition to calculating the volume of this region, I would also like to be able to obtain its representation as a plot.

I have started by plotting the vertices, i.e., the points (4, 0, 0), (-4, 0, 0), (0, 4, 0), (0, -4, 0), (0, 0, 4), and (0, 0, -4), but I am not sure how to continue from there.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. May 1, 2015 at 3:23
• @julie You may want to consider accepting one of the answers that have been provided below, if they solve your problem. May 3, 2015 at 17:45

volume = Integrate[1,  Element[{x, y, z}, ImplicitRegion[Abs[x] + Abs[y] + Abs[z] < 4, {x, y, z}]]]

(*256/3*)

ContourPlot3D[Abs[x] + Abs[y] + Abs[z] == 4, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}] ## A small addition from Mathematica v. 10

In his answer @Ivan has already nailed the most important part of the question, i.e. the formal representation of your region as an ImplicitRegion object:

region = ImplicitRegion[Abs[x] + Abs[y] + Abs[z] < 4, {x, y, z}]


I just wanted to add that, if you are on Mathematica 10 or newer, you can also use the RegionMeasure or Volume functions to calculate the volume of a region:

RegionMeasure[region]
Volume[region]

(* 256/3 *)


## How to arrive at the shape of this region

In response to @julie's question in the comment, here is how one can imagine constructing the 3D region.

Consider the corresponding equality in 2D, disregard the absolute values for now, and let's just concentration on the first quadrant ($x>=0$,$y>=0$). The resulting $x + y = 4$ is just the equation of a line, i.e. $y = 4 - x$. The region in the first quadrant in which the inequality $x+y<4$ holds is the region between that line and the axes:

RegionPlot[
x + y < 4 && x >= 0 && y >= 0,
{x, -5, 5}, {y, -5, 5},
Axes -> True, Frame -> False
] Taking the absolute value of $x$ is geometrically equivalent to mirroring that triangle with respect to the $y$ axis as shown below. Since we are taking its absolute value, we will also remove the $x>=0$ restriction.

RegionPlot[
Abs[x] + y < 4 && y >= 0,
{x, -5, 5}, {y, -5, 5},
Axes -> True, Frame -> False
] Taking the absolute value of $y$ is similarly equivalent to mirroring this figure with respect to the $x$ axis. The result is the square region below:

RegionPlot[
Abs[x] + Abs[y] < 4,
{x, -5, 5}, {y, -5, 5},
Axes -> True, Frame -> False
] In the three-dimensional case, you can work your way through in a similar way: $x+y+z=4$ is the equation of a plane that defines a trangular wedge in the first quadrant, and so forth.

As for the numerical value, you could consider that your figure is made up of two square pyramids. The volume of a square pyramid is $V=a^2h/3$ where $a$ is the length of the base edge, and $h$ is the height. In your case, you can calculate the base edge as the hypotenuse of the smallest 2D triangle we introduced above ($a^2=4^2+4^2=32$), and the height of the pyramid is 4. The volume of this pyramid is 128/3, and your figure is made of two such pyramids, so $2\times128/3 = 256/3$.

• thank you! but how was the final answer calculated? how did you know what all the sides were and where those points went? May 1, 2015 at 3:28
• @julie I amended my answer to include a way to construct the region. Let me know if that answers your question appropriately. May 1, 2015 at 4:27

An alternate approach to calculating the volume

Integrate[
Boole[Abs[x] + Abs[y] + Abs[z] < 4],
{x, -Infinity, Infinity},
{y, -Infinity, Infinity},
{z, -Infinity, Infinity}]


256/3

As a cone (with a square base), the volume is one-third the base times the height: 1/3 * (4 Sqrt)^2 * 8.

Another plot, based on the OP's coordinates:

ConvexHullMesh@Join[4 IdentityMatrix, -4 IdentityMatrix] 