# The Friendship Paradox

Let’s suppose that you ask all your friends how many friends they have, and compare that average friends that your friends have to the number of friends you have. It might surprise you that on average, you will have less friends than your friends have.

How can this be true? It might seem that there should be some sort of symmetry in the number of friends everyone has, and therefore among your’s friends, on average you should have an equal number of friends with less friends than you compared to those with more friends than you. However, you can also argue that since someone that has more friends is friends with more people, it’s more likely that you are friends with someone with more friends than average. Let’s take a closer and more rigorous look at this problem, using probability and friendship graphs to analyze it.

Before we look at probabilities, we need a way to specify a random network of friends. We can represent the friendship network as a graph with vertices (people) and edges (friendships). There are a few ways to generate random graphs, for our purposes we fix and and consider each unique graph with vertices and edges as equally likely. Here are two random graphs with 5 nodes and 5 edges:

We first compute the average number of friends each person has in terms of and . From the point of view of a single vertex, we need to compute the average number of edges it has.

This is the same as summing up the degrees of all the vertices (here denotes the set of all vertices) and dividing it by the total number of vertices . If we look from the point of view of a single edge instead, we see that it is connected to two vertices, and it contributes 2 to .

Hence:

and the average number of friends each person has is . We see that the change of perspective from a vertex to an edge is really helpful, and we will be using this technique again later on.

Next, we need to find the average number of friends that each person’s friends have. We can do this by first choosing any person, and then any friend of that person, and then ask the friend how many friends he or she has.

If we do this for every person-friend pair and sum up the answers, then divide by the number of person-friend pairs, we get the average number of friends that a person’s friend can have.

What’s the total number of person-friend pairs? This must be related to the number of edges in the graph , since each edge represents a friendship. Also, since an edge between and contains two person-friend pairs ( to and to ), the total number of person-friend pairs is .

How do we find the sum of all the answers? First let’s take the perspective of one person. This person asks all of his or her friends, and each friend returns an answer. Let’s suppose a person makes a mark on every edge denoting a friendship each time he or she is asked. The following figure shows the number of marks on each edge after one person asked all of his or her friends.

Now the sum of all the answers is just the sum of the number of marks. To do this let’s make a change of perspective to one of the friends being asked, . How many marks would have to make? Each time someone asks , he or she would have to make marks, where is the degree of its vertex, and he or she would be asked times.

Thus there would be a total of marks. Therefore for the entire graph, there will be marks, the summation of the square of each vertex’s degree.

Thus the average number of friends each person’s friends have is:

That would be our answer, except that we don’t know how to find . We calculated earlier that the average degree of an vertex (the average number of friends per person) is . The variance of the degree of each vertex is given by:

After a little algebra, we get:

Since is positive, we have proved that the average number of friends that one’s friends have is greater than , the average number of friends a person has.

Let’s generate some random graphs and see if this is true. We generate a graph of 250 nodes and 500 edges. A node is colored blue if it has less friends than the average, and red if the other way round. If it has the same number of friends as the average, it remains grey.

As you can see, in this case there’s almost twice the number of blue nodes as red nodes, which means the majority of people have less friends than their peers. There’s still a lot of interesting experiments to do, such as deriving the expected percentage of blue/red nodes given the total number of nodes and edges, or figuring out the distribution of the degrees of the nodes given our method of generating random graphs.