# Finding the formula for the number of golf balls in a triangular pyramid with $n$ layers. [closed]

Toni and her friends are building triangular pyramids with golf balls. Write a formula for the number of golf balls in a pyramid with n layers, if a $1$-layer pyramid contains 1 ball, a 2-layer pyramid contains 4 balls, a 3-layer one contains 10 balls, and so on.

What is the formula for this question, and what are the steps involved in deriving it?

• It seems the third layer should have $9$ balls, not $10$. In that case, you are looking for the sum of square numbers. If you think $10$ is correct, you need to define the pattern better. – Ross Millikan Feb 15 '15 at 5:33
• For clarification, is the base of the pyramid a square or a triangle? The numbers you quote do not seem to agree. If a tetrahedron (a pyramid with a triangle base), then there is one ball in the top layer and 3 balls in the second layer, 6 balls in the third layer, 10 balls in the fourth layer and so on. If it is a square pyramid it will have 1 ball in the top layer, 4 balls in the second layer, 9 balls in the third layer, 16 balls in the fourth layer and so on. If you were stating totals, in a tetrahedron if $n=1,2,3,4$ the totals are 1,4,10,20, etc. – JMoravitz Feb 15 '15 at 5:36
• the pattern is 1,4,10 (given), following this should be 19, 31, and further. The answer is n/6(n+1)(n+2), the question is what are the steps to solving this. – Arthur Alex Karapetov Feb 15 '15 at 5:39
• Then there is a typo or a mistake in the calculations somewhere. The problem described does not match those numbers in any interpretation. – JMoravitz Feb 15 '15 at 5:41
• The answer is correct, if n=1 the answer is 1. There must be a way to come to this conclusion. – Arthur Alex Karapetov Feb 15 '15 at 5:43

If it is a square pyramid, the length of the side of each level will increase by one each time you go down. Thus the number of balls on each level is $k^2$. Therefore the total number of balls with $n$ levels is $\sum\limits_{k=1}^n k^2$

In simplifying this it becomes the Square Pyramidal Number which is $\frac{n(n+1)(2n+1)}{6}$

If it is a tetrahedron, the length of the side of each triangle on each level will increase by one each time you go down. Thus the number of balls on each level is $T(k)$, the $k^{th}$ triangle number. Thus the total number of balls with $n$ levels is $\sum\limits_{k=1}^n T(k)$

In simplifying this, it becomes the $n^{th}$ Tetrahedral Number, $\frac{n(n+1)(n+2)}{6}$

The derivation of the square pyramidal number is outlined in the wiki article linked. To prove the derivation of the tetrahedral number, first note that $T(k) = \sum\limits_{i=1}^k i = \frac{k(k+1)}{2}$, where $T(k)$ denotes the $k^{th}$ triangle number.

So, the $n^{th}$ tetrahedral number is $\sum\limits_{k=1}^n T(k) = \sum\limits_{k=1}^n \frac{k(k+1)}{2} = \frac{1}{2}\sum\limits_{k=1}^n k^2 + k = \frac{1}{2}(P(n)+T(n))$ where $P(n)$ denotes the $n^{th}$ pyramidal number.

This then simplifies to $\frac{1}{2}(\frac{n(n+1)(2n+1)}{6} + \frac{n(n+1)}{2})$ which after some algebra simplifies to the formula given earlier.

To find the triangle number, $T(n)$, this is $1+2+3+\dots+(n-1)+n$. At the moment we do not know what the total is as we are coming up with a formula for it. Suppose that we give the total a name, $T(n)$. Then $T(n)=1+2+3+\dots+(n-1)+n$.

We try multiplying it by two to see what happens.

$2T(n)=2(1+2+3+\dots+(n-1)+n)$

$= (1+2+3+\dots+(n-1)+n) +(1+2+3+\dots+(n-1)+n)$

$=(1+2+3+\dots+(n-1)+n) +(n+(n-1)+\dots+3+2+1)$ by reversing the order of the second parenthesis

$=(1+n)+(2+(n-1))+\dots+((n-1)+2)+(n+1)$ by grouping terms together as they appear in the parenthesis.

$=(n+1)+(n+1)+\dots+(n+1) = n(n+1)$

Remembering this was the total for $2T(n)$, we divide by two to get

$T(n)=\frac{n(n+1)}{2}$

• Can you explain in detail the process of finding the Tetrahedral Number. Your solution is correct but how would you state it without presuming my in depth knowledge - this question was given in a grade 10 math textbook under a special category "math contest" in a lesson on "The method of substitution" - very simple stuff. – Arthur Alex Karapetov Feb 15 '15 at 5:48
• @ArthurAlexKarapetov Assuming knowledge of the derivation of the triangle number, and letting you read the derivation on the square pyramidal number, the rest of the steps are given above (minus some algebraic manipulation at the end). – JMoravitz Feb 15 '15 at 5:56
• The knowledge of the derivation of the triangle number is something I am not expected to have at this point, so it is strange this question appears in my book. Thank you very much for your help. – Arthur Alex Karapetov Feb 15 '15 at 5:59
• Adding information on how to derive the triangle number formula then. – JMoravitz Feb 15 '15 at 6:01

Each layer is a triangular number $\binom n2=\frac{n(n-1)}2 = \sum_{i=0}^{n-1}i$, where the side of the triangle contains $n-1$ balls. Note that the second equality is a special case of the general identity $$\sum_{i=0}^{n-1}\binom ik =\binom n{k+1}$$ which can be proved by an easy induction using Pascal's recurrence $\binom nk+\binom{n-1}k=\binom n{k+1}$. Applying it for $k=2$ gives $$\sum_{i=0}^{n-1}\binom i2 =\binom n3$$ which is the number of balls in a tetrahedral pyramid with side $n-2$. So the number you are after is $$\binom{n+2}3=\frac{n(n+1)(n+2)}6.$$

Generalising, then number in dimension $d$ is $\binom{n+d-1}d$. Since that number is well known to count the $d$-multisets on an $n$-elements set (that is, ways to select $d$ elements out of a total of$~n$ with multiple selection of a same element allowed), one might ask if there is a way to uniquely label the golf balls with such multisets. Here is a way to do it. Arrange the multiset as $(c_1,\ldots,c_d)$ in weakly decreasing order, so that one has $n\geq c_1\geq c_2\geq\cdots\geq c_d>0$; then let $c_1$ select the size of the "layer" on the outer level, and let $(c_2,\ldots,c_d)$ recursively select agolf ball in this $d-1$-dimensional layer.