Consider picking a graph with m edges on n vertices uniformly at random from the set of all graphs with n vertices and m edges. What is the expected number of triangles? Before we give an exact formula, consider the following heuristic. We can approximate this graph with a random binomial graph (each edge appears independently from the others with probability
) where
. Therefore the expected number of triangles
in
should be roughly
. This heuristic can be turned into a rigorous statement by using the asymptotic equivalence of the two random graph models. However this is a good asymptotic approximation. What about an exact formula? The simplest way is counting! How many graphs (let me mention even a bit late that we are talking about labelled graphs, which means that we have names for the vertices. For convenience we call the names by the integers 1 through n) on n vertices do we have? Clearly
. Consider now a triangle formed by three distinct vertices
. What is the probability of seeing this particular triangle? We have to count how many graphs contain it and divide by the total number of possible graphs. Clearly we have to use 3 edges and therefore the way of placing the rest of the edges is
. The expectation therefore is
. QED