In the square prism ABCD A1B1C1D1, AB=2, A1B1=1, AA1=Sqrt [2], what is the volume of this prism?

It is easy to calculate its volume using the volume formula:

In[489]:= v = 1/3 (4 + 1 + 2) Sqrt[3/2]

Out[489]= 7/Sqrt[6]

Is there another method to calculate the volume of the regular quadrilateral prism based on the known conditions in the software and the graph? That is to say, for any drawn spatial geometry, what method is there to calculate their volume?

Draw the graph of the pyramid according to the following code:

a = {Sqrt[2], 0, 0};
b = {0, Sqrt[2], 0};
c = -a;
d = -b;
o = Mean[{a, b, c, d}]
h = Sqrt[6]/2;
a1 = {Sqrt[2]/2, 0, h};
b1 = {0, Sqrt[2]/2, h};
c1 = {-Sqrt[2]/2, 0, h};
d1 = {0, -Sqrt[2]/2, h};
o1 = Mean[{a1, b1, c1, d1}]
labels = {Text[Style[O, 12, FontFamily -> "Times"], o, {-1, -1}],
   Text[Style[O1, 12, FontFamily -> "Times"], o1, {-1, -1}],
   Text[Style[A, 12, FontFamily -> "Times"], a, {-1, -1}],
   Text[Style[B, 12, FontFamily -> "Times"], b, {1, 1}],
   Text[Style[C, 12, FontFamily -> "Times"], c, {1, 1}],
   Text[Style[D, 12, FontFamily -> "Times"], d, {-2, 0}],
   Text[Style[A1, 12, FontFamily -> "Times"], a1, {3, 0}],
   Text[Style[B1, 12, FontFamily -> "Times"], b1, {-1, -2}],
   Text[Style[C1, 12, FontFamily -> "Times"], c1, {0, 1}],
   Text[Style[D1, 12, FontFamily -> "Times"], d1, {3, 0}]};
dashLines = {Dashed,
   AbsoluteThickness[2], {Line[{{o, o1}, {d, d1}}]}, {Red,
    Line[{{c, d}, {a, d}, {b, d}, {a, c}}]}};
realLines = {AbsoluteThickness[2],
   Line[{{a, b}, {b, b1}, {a1, a}, {b, b1}, {b1, a1}, {c, c1}, {b1,
      c1}, {c1, d1}, {b, c}, {a1, c1}, {b1, d1}, {a1, d1}}]};
Show[Graphics3D[{dashLines, realLines, labels}, Boxed -> False,
  ViewPoint -> {2, 3.5, 1.28}],
 Graphics3D[{Arrow[{{o1 - o, o1 - o + {0, 0, 1}}, {a - o,
      a - o + {1, 0, 0}}, {b - o, b - o + {0, 1, 0}}}],
   Text[Style["z", 20, Italic, FontFamily -> "Times"],
    o1 - o + {0, 0, 1}, {-1, -1}],
   Text[Style["y", 20, Italic, FontFamily -> "Times"],
    b - o + {0, 1, 0}, {-2, -1}],
   Text[Style["x", 20, Italic, FontFamily -> "Times"],
    a - o + {1, 0, 0}, {2, -1}]}]]

Enter image description here


4 Answers 4


If the regions you're interested in are convex (e.g., no holes), as in the case of this pyramid, you can create a region from the points, and then get its volume

Volume[ ConvexHullRegion[{a, b, c, d, a1, b1, c1, d1}] ]

which gives 7/Sqrt[6].


You want Hexahedron, which specifies a geometric region with six quadrilateral sides via a list of vertices. Note that the vertices need to be ordered in a specific way, described in the documentation; in your case, though, it's just the "obvious" ordering. Note also that you can run into weird behavior if your vertices are not coplanar; Hexahedron does not check for this, apparently.

reg = Hexahedron[{a, b, c, d, a1, b1, c1, d1}]

(* 7/Sqrt[6] *)

enter image description here

You can further use built-in Mathematica functions to calculate things like centroids, nearest points, etc. Examples of this can be found in the above-linked documentation page.


Since the prism under consideration is a convex set, one may produce

Volume[ConvexHullRegion[{a, b, c, d, a1, b1, c1, d1}]]


Region[ConvexHullRegion[{a, b, c, d, a1, b1, c1, d1}]]

enter image description here


We can generalize a solution using a function to define a square pyramidal frustum that's base-centered at the origin. The squareFrustum function computes coordinate points for Hexahedron from the prism's base and top widths, and its height. The advantage is that squareFrustum replaces the need to make manual assignments for the coordinates a, b, c, d, etc.

squareFrustum[wb_,wt_,h_] := With[{p1={-wb/2,-wb/2,0}, p5={-wt/2,-wt/2,h}},
  Hexahedron[{p1, p1+{wb,0,0}, p1+{wb,wb,0}, p1+{0,wb,0},
    p5, p5+{wt,0,0}, p5+{wt,wt,0}, p5+{0,wt,0}}]]

We're given the slant length, but we need height so let's calculate it where b1 is the width of the base (AB=2), b2 is the width of the top (A1B1=1), and c is the slant length (AA1=$\sqrt{2}$).

height = Sqrt[c^2 - 1/2*(b1 - b2)^2] /. {b1->2, b2->1, c->Sqrt[2]};

Next, define a symbolic definition for the prism, where the base width is b1, the top width is b2, and height is h. Then, Volume gives the formula for volume, and substituting numeric values gives $\frac{7}{\sqrt{6}}$. SurfaceArea and RegionCentroid can also provide symbolic solutions.

spf = squareFrustum[b1, b2, h]; (* square pyramidal frustum *)

Simplify[Volume@spf, {b1>0, b2>0, h>0}]
%/.{b1->2, b2->1, h->height}
((b1^2 + b1*b2 + b2^2)*h)/3

Use numeric values with squareFrustum for direct numeric solutions. First[sol] displays the coordinate points.

sol = squareFrustum[2, 1, height];
(* 7/Sqrt[6] *)
(* 5 + 3*Sqrt[7] *)

Graphically, we get:

Graphics3D[sol, Boxed->False]

square pyramidal frustum


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.