Reciprocity in evolutionary biology refers to mechanisms whereby the evolution of cooperative or altruistic behaviour may be favoured by the probability of future mutual interactions. A corollary is how a desire for revenge can harm the collective and therefore be naturally deselected.
Main types of reciprocity 
Three types of reciprocity have been studied extensively:
- Direct reciprocity
- Indirect reciprocity
- Network reciprocity
Direct reciprocity 
Direct reciprocity was proposed by Robert Trivers as a mechanism for the evolution of cooperation. If there are repeated encounters between the same two players in an evolutionary game in which each of them can choose either to "cooperate" or "defect", then a strategy of mutual cooperation may be favoured even if it pays each player, in the short term, to defect when the other cooperates. Direct reciprocity can lead to the evolution of cooperation only if the probability, w, of another encounter between the same two individuals exceeds the cost-to-benefit ratio of the altruistic act:
- w > c/b
Indirect reciprocity 
In the standard framework of indirect reciprocity, there are randomly chosen pairwise encounters between members of a population: the same two individuals need not meet again. One individual acts as donor, the other as recipient. The donor can decide whether or not to cooperate. The interaction is observed by a subset of the population who might inform others. Reputation allows evolution of cooperation by indirect reciprocity. Natural selection favors strategies that base the decision to help on the reputation of the recipient: studies show that people who are more helpful are more likely to receive help. The calculations of indirect reciprocity are complicated and only a tiny fraction of this universe has been uncovered, but again a simple rule has emerged. Indirect reciprocity can only promote cooperation if the probability, q, of knowing someone’s reputation exceeds the cost-to-benefit ratio of the altruistic act:
- q > c/b
One important problem with this explanation is that individuals may be able to evolve the capacity to obscure their reputation, reducing the probability, q, that it will be known.
Individual acts of indirect reciprocity may be classified as "upstream" or "downstream":
- Upstream reciprocity occurs when an act of altruism causes the recipient to perform a later act of altruism in the benefit of a third party. In other words: A helps B, which then motivates B to help C.
- Downstream reciprocity occurs when the performer of an act of altruism is more likely to be the recipient of a later act of altruism. In other words: A helps B, making it more likely that C will later help A.
Network reciprocity 
Real populations are not well mixed, but have spatial structures or social networks which imply that some individuals interact more often than others. One approach of capturing this effect is evolutionary graph theory, in which individuals occupy the vertices of a graph. The edges determine who interacts with whom. If a cooperator pays a cost, c, for each neighbor to receive a benefit, b, and defectors have no costs, and their neighbors receive no benefits, network reciprocity can favor cooperation. The benefit-to-cost ratio must exceed the average number of people, k, per individual:
- b/c > k (See below, however.)
Recent work  shows that the benefit-to-cost ratio must exceed the mean degree of nearest neighbors <knn>:
- b/c > <knn>
- Martin Nowak Evolutionary Dynamics: Exploring the Equations of Life Harvard 2006
- Martin Nowak Five Rules for the Evolution of Cooperation Science 314, 1560 (2006);
See also 
- R. Trivers, Q. Rev. Biol. 46, 35 (1971).
- M. A. Nowak, K. Sigmund, Nature 393, 573 (1998).
- Fowler JH "Second Order Free Riding Problem Solved?" Nature 437: doi:10.1038/nature04201 (22 September 2005)
- E. Lieberman, C. Hauert, M. A. Nowak, Nature 433, 312 (2005).
- H. Ohtsuki, C. Hauert, E. Lieberman, M. A. Nowak, Nature 441, 502 (2006).
- T. Konno, A condition for cooperation in a game on complex networks, Journal of Theoretical Biology, 269 (2011)
Further reading 
- Panchanathan K. & Boyd, R. (2004). Indirect reciprocity can stabilize cooperation without the second-order free rider problem. Nature 432: 499–502. Full text
- Panchanathan K. & Boyd, R. (2003) A Tale of Two Defectors: The Importance of Standing for the Evolution of Indirect Reciprocity. Journal of Theoretical Biology, 224: 115–126. Full text