Tuesday, March 31, 2009

Triangles and Pyramids

When I decided to make my "art project" out of construction paper, consisting of a series of multi-sided pyramids of simple isosceles triangles, the principle concept was "powers of two". That is, I started with a four-sided pyramid, then I went to 8-sided, then 16-, 32 and finally 64-sided. In all cases, I wanted the smaller ones to fit into the bigger ones, meaning that I needed to keep them all the same height, and I wanted the base side to be the same width for all pyramids as well. So, the question became, how do you calculate the length of the triangle in order to get a specific height for a pyramid of n-sides? It's actually pretty simple, if you do it right (and use Excel to do the math for you).



First, a four-sided pyramid is simply 4 isosceles triangles taped together. It's easy enough to get the width of the base ('b' in picture 1) because we're the ones making that decision. It's the length of the paper triangle ('x' in pictures 1 and 4) that's the problem. Let's assume that the pyramid is 0 inches tall (just flat paper that we're looking down on). This gives us picture 2. The angle at the center of the square, theta, is 360/n, where 'n' is the number of sides for the pyramid. In this case, n=4 and theta=90 degrees). The distance of center point 'p' to the middle of the square in picture 2 is the same as the value of 'c' in picture 3. Since

c = a * cos(theta/2) and b/2 = a * sin(theta/2),

then
a = (b/2)/sin(theta/2), and c = (b/2) * cos(theta/2) / sin(theta/2). We'll stop here.

Now, let's say that the height of the pyramid is greater than 0. If we look at the pyramid in picture 1 from the side, we get picture 4. We can see here that the length of our paper triangle is,

x = sqrt(h^2 + c^2)

and we know that

c = (b/2) * cos(theta/2) / sin(theta/2)

If we choose the number of sides, 'n'; the base of the triangle, 'b'; and the height of the pyramid, 'h'; we can easily get the length of the triangle to cut, 'x'. Conversely, if we cut the triangles with length 'x', then we know how tall the pyramid will be, for any number of sides greater than 2.

Example:

number of sides = 8
height = 3 inches
base = 2 inches

theta = 360 / 8 = 45
theta / 2 = 22.5

c = 2/2 * cos(22.5) / sin(22.5)
c = 0.928 / 0.383
c = 2.414

x = sqrt(3^2 + 2.414^2)
x = 5.68

Which then gives us the dimensions of the triangle in picture 5. Tape 8 of those picture 5 triangles together, and you have something close to a cone, 3" tall.

What's nice about this formula is that if you keep the size of the base and the height constant, the length of the paper is then just a matter of the number of sides you want. If b = 2" and h = 3"

x = sqrt(9 + (cos(180 / n) / sin(180 / n)) ^ 2)

And, that's exactly the information I wanted to make my pyramids of sides 4, 8, 16, 32 and 64.

-------------------------

In the Pyramids entry, I said that this project is a great example of practical calculus. We can get the area of the isosceles triangles by noting that this kind of triangle can be cut in half and rearranged to make a rectangle that's "c" long and "b/2" wide. The area is then c * b/2. And we have "n" triangles. If we keep "a" constant and vary "b" as a function of the number of sides (b/2 = a * sin(360/(n*2))), then "c" would get closer and closer to the radius of the circle (c -> a) as "n" approached infinity. We'd be able to get the area of the circle by adding up the areas of an infinite number of infinitely thin triangles.

That is:

area of approx. circle = n * c * b/2
= n * c * a * sin(360/(n*2))

In the case of my 64-sided pyramid, if the height = 0; b = 3; and c = 30.533.

area = 64 * 30.533 * 1.5 = 2931 cm^2

For a circle of the same radius:

area = PI * r^2
area = 3.14159 * 30.57^2 = 2935 cm^2

2931 is 99.84% of 2935.

So, just by using 64 triangles of a known size, I can get within 0.16% of the area of a circle. That's not too bad. What I should mention here is that the difference from the actual area of the approximate circle has nothing to do with the size of the triangle slices used. The percent difference is purely a matter of the number of sides used.

% diff = (area of circle - area of triangles) / area of circle

Since the radius of the circle is "a"; "c" for the triangle is a*cos(360/2*n); and "b/2" is a*sin(360/2*n).

% diff = (PI * a^2 - n*(a*sin(360/2*n) * a*cos(360/2*n)) ) / PI * a^2)

factor out a^2 and we get

% diff = 1 - n*sin(360/2*n) * cos(360/2*n) / PI

if n = 64, % diff = 0.16%, which is what we obtained above by actually adding up 64 triangles of 3 cm by 30.533 cm.

What's really important here is that this is all simple arithmetic that tells us in advance how much paper we'd need to make cone-pyramids of any given size. This can save us from needing to make multiple trips to the store in the middle of an art project, or from over-buying paper because we over-guessed what we needed.

No comments: