Associated Topics || Dr. Math Home || Search Dr. Math

### Formula for Counting Triangles

```
Date: 03/16/2000 at 19:16:55
From: Sebastian
Subject: Explicit formula for a set of numbers

Dr Math,

I have this extremely difficult math problem that I need to answer. I
hope you will be able to come up with an explicit formula for this set
of numbers. Part of the problem is finding the numbers, and then
finding the equation is the second task. I will try to explain how to
find the numbers as clearly as possible.

First, start out with an equilateral triangle one unit on a side. (It
helps if you draw it as you read this.) Then, extend 2 of the sides of
the triangle out for another unit and connect the bottom points of the
extended lines. In the second row, if you make an "upright"
equilateral triangle, an "upside down" equilateral triangle, then one
more "upright" one you have 3 unit-side triangles in the second row.
Counting the 1 in the first row, the 3 in the second row, and the big
2-unit-side triangle, you have 5 triangles total.

So far, you have a total of 1 after the first row and 5 after the
second row. Now extend the sides out again so the sides of the
surrounding equilateral triangle (of all 3 rows) are 3 units. In the
third row alone, you'll have 5 equilateral triangles (3 upright and
2 upside down.) Counting all the unit-side equilateral triangles, the
2-unit side triangles, and the surrounding 3-unit side triangle,
you'll get 13 equilateral triangles.

Keep repeating the process of extending the sides and creating more
triangles. I think that the fourth row has 27 total equilateral
triangles counting everything:

/\
/__\
/\  /\
/__\/__\
/\  /\  /\
/__\/__\/__\
/\  /\  /\  /\
/__\/__\/__\/__\

To recap it: 1 row = 1, 2 rows = 5, 3 rows = 13, 4 rows = 27, etc.
You'll need to count probably to the 20 row, in which there are
hundreds of them. Now what I need is an explicit formula relating x
(the row number) and y (the number of equilateral triangles).

Thank you very much.
Sebastian
```

```
Date: 03/17/2000 at 17:02:26
From: Doctor Rob
Subject: Re: Explicit formula for a set of numbers

Thanks for writing to Ask Dr. Math, Sebastian.

If you count the number of upright triangles of each size, you'll find
that these are (surprise!) triangular numbers, but the numbers start
one row farther down with each increase by 1 in their size:

x \ size   1    2    3    4    5    6  ...  subtotal
0         0    0    0    0    0    0  ...      0
1         1    0    0    0    0    0  ...      1
2         3    1    0    0    0    0  ...      4
3         6    3    1    0    0    0  ...     10
4        10    6    3    1    0    0  ...     20
5        15   10    6    3    1    0  ...     35
6        21   15   10    6    3    1  ...     56
:         :    :    :    :    :    :           :

Each entry in this array is a binomial coefficient C(x-s+2,2). When
you add up these binomial coefficients for s = 1 to x, you get the
binomial coefficient C(x+2,3) for the subtotal of these.

Now if you count the number of upside-down triangles of each size,
you'll find that these are also triangular numbers, but the numbers
start *two* rows farther down with each increase by 1 in their size:

x \ size   1    2    3  ...  subtotal
0         0    0    0  ...      0
1         0    0    0  ...      0
2         1    0    0  ...      1
3         3    0    0  ...      3
4         6    1    0  ...      7
5        10    3    0  ...     13
6        15    6    1  ...     22
:         :    :    :           :

Once again, each entry in this array is a binomial coefficient
C(x-2*s+2,2). This time when you add them up, you don't get such a
simple answer as before. In fact, you get two different answers for
even and odd x. The facts that adding up triangular numbers, which are
quadratic in x, gives a cubic in x, and this even/odd business, make
it plausible that the formula you seek is of the form

y = a*x^3 + b*x^2 + c*x + d + e*(-1)^x.

You might also take a look at

Counting Triangles
http://mathforum.org/library/drmath/view/56194.html

Hope this helps!

- Doctor Rob, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search