$d(n) = \frac{n(n-3)}{2}$ , is equal to the number of diagonals in a n-gon
Proof: Each vertex connects to all vertices apart from the two next it used to form edges and itself $(2+1) = 3 $. Thus maximum number of diagonals from each vertex is given by $ (n -3) $ such that the collective number of diagonals from all vertices ( irrespective of uniqueness ) is $ n ( n - 3 ) $ where by each diagonal connects 2 vertices therefore to get the total number of unique diagonals we need $ \frac{1}{2} $ of $ n ( n - 3 ) $ ; $d(n) = \frac{n(n-3)}{2}$
Simple proof: $$\binom{n}{2}-n$$ where $\binom{n}{2}$ is number of lines formed when given $n$ points and removing $n$ lines, since there are $n$ edges.