In a nutshell, whenever you sign up for a Facebook account, Facebook asks permission to look at your email contacts if you're on a computer, or your phone contacts if you're on a smartphone. When you grant the site permission, it searches your contacts for users already on the network, and it searches other users' uploaded contacts for you. That gives it a very primitive outline of your social circles: who you know, but not how you know them or how well.
To refine that map, Facebook asks you more questions about yourself: where you went to school, when you were born, what city you live in. Each field in your Facebook profile and each interaction you make through that profile actually double as a source of data for Facebook's mapping algorithms. What they're trying to do is determine the structure of the network: where the cliques are, which people bridge them, who knows who.
Once Facebook knows the structure of your social network, it can analyse it to predict (with startling accuracy) not only the people you're most likely to know now, but those you're likely to know in the future.
This isn't magic: It's actually closer to statistics. In the network, there are a set number of "nodes", i.e, people, and a set number of "edges", i.e, friendships. Given that, each nonexistent connection between two nodes is a statistical possibility. But not all nodes are created equal, so not all connections are equally likely. (I don't anticipate befriending many 40-year-old guys in Siberia, say.)
To estimate which connections are most likely, Facebook can run analyses against the structure of the network, using a long and entirely above-our-pay-grade list of coefficients and indices. Those coefficients account for a huge number of things: How many unusual commonalities do two people share, for instance? How many friends do they have in common? Which people in the network serve as rallying points, the people who know everyone? How many "degrees of separation" exist between them, how many friends of friends?
In the end, Facebook's friend-recommendation system isn't magic or malice - just really good maths. And guessing your future friends isn't telling the future; it's modelling the evolution of Facebook's social graph.
As you and I know, of course, this doesn't always work. Facebook, not infrequently, suggests you "may know" somebody you don't. Or it suggests people you do know but don't want to see in your newsfeed.
That's not Facebook's fault, says David Liben-Nowell, a computer scientist at Carleton College who studies the evolution of social networks. There are some forces outside the network that Facebook could never account for, he says: like what if I randomly sat next to a middle-aged Siberian man on a plane? And on top of that, Facebook's dealing with a vast and complex network.
Liben-Nowell poses the example of your friend's exes, some of whom you may want to Facebook-friend. "But which ones? And why?" he asks.
"Their network positions relative to you are all pretty much the same, but [only] you know the one who you happened to sit beside at a wedding. So its prediction algorithms can only do so much."
That said, both Facebook and mathematics at large have enormous interest in improving models of social-network change and "link prediction"; after all, the way people connect has implications way outside social networking, in fields as diverse as epidemiology, communications and counterterrorism.
"We continuously update the 'People You May Know' algorithm to make it better and more relevant for people," says Facebook spokesperson, Ana Brekalo.
So in the future, Facebook may know even more about your friends.