# Given a complete graph of $n$ vertices $K_n$ (has all possible edges – one edge between pair of vertices). [duplicate]

Given a complete graph of n vertices $K_n$ (has all possible edges – one edge between pair of vertices). Use counting to find a formula in $n$ for the number of edges in the graph.

I know that the formula is $\frac{n(n-1)}{2}$ (or at least that's what I think it is from what Wikipedia said.

Though I am not sure how to actually start deriving the formula to come to that conclusion. Any guidance would be great.

$$\dbinom{n}{2} = \frac{n!}{2!(n-2)!} = \frac{n(n-1)}{2}.$$
Every edge is uniquely determined by its two terminal vertices. How many sets of two elements exist? there are $n$ options for the first vertex and $n-1$ options for the second vertex, so $n\cdot(n-1)$. Only we counted the pair $(u,v)$ and $(v,u)$ as different, so we must divide by two. So there are $\frac{n(n-1)}{2}$ subsets of two vertices, each of these defines one of the edges. So there are $\frac{n(n-1)}{2}$ edges in the complete graph on $n$ vertices.
Each of the $n$ people shakes hands with the other $n-1$ for a total of $n (n-1)$ shakes, but wait! when you and I shake hands it is only one shake no two, so divide by two. Total $n(n-1)/2$.