TITLE: Formula for pentagonal numbers
QUESTION [5 upvotes]: The $n$th pentagonal number $p_n$ is defined algebraically as $p_n = \frac{n(3n - 1)}{2}$ for $n \geq 1$. It can also be defined visually as the number of dots that can be arranged evenly in a pentagon

Since in the visual representation of $p_n$, the pentagon has $n+1$ dots on each side, counting the number of dots on each side and multiplying by $5$, we get, $5(n+1)$. However, we have counted the dots at the vertices twice, so we subtract $5$: which gives us $p_n = 5n$. Why does this not correspond to the algebraic definition?

REPLY [14 votes]: The number $p_n$ counts the total number of dots in the $n$th figure (on the border and inside).  You've calculated only the dots on the border.
To see that the algebraic definition is equivalent, we can still use your observation.  Notice at each step, we are adding $3n-2$ extra vertices, so by induction we have:
$$p_n=p_{n-1}+3n-2=\frac{(n-1)(3(n-1)-1)}{2}+3n-2=\frac{3n^2-7n+4+6n-4}{2}=\boxed{\displaystyle\frac{n(3n-1)}{2}}$$