Birds on a Wire Revisited

Some birds are sitting at random places on a wire. If bird B is bird A's closest neighbor and bird A is bird B's closest neighbor, then A and B are mutual nearest neighbors and form a mutual neighbor pair.
This Demonstration simulates birds on a wire and shows all mutual neighbor pairs with different colors. We also show estimated probabilities for the number of birds that are a part of a mutual neighbor pair. Furthermore, we generalize the problem to two and three dimensions.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


This is problem 3 in [2]. The problem originally appeared in 1978 in [4] for four birds, and asked what the probability is that a bird picked at random is looking at another bird that is looking at it. Also, what is the probability if there are more than four birds? The solution appeared the next year in [1]. In one dimension, the probability is , irrespective of the number of birds! (However, for two birds the probability is, of course, one.) In two dimensions, the probability that a randomly picked point is a part of a mutual neighbor pair is . In three dimensions, the probability is . As dimensions grow, the probability approaches the value [3]. The problem is considered as a Poisson process in a Demonstration cited in the Related Links.
[1] J. Herbert, "Birds on a Wire (Solution)," Journal of Recreational Mathematics, 11(3), 1979 pp. 227–228.
[2] P. J. Nahin, Digital Dice: Computational Solutions to Practical Probability Problems, Princeton: Princeton University Press, 2008.
[3] D. K. Pickard, "Isolated Nearest Neighbors," Journal of Applied Probability, 19(2), 1982 pp. 444–449.
[4] D. P. Shine, "Birds on a Wire," Journal of Recreational Mathematics, 10(3), 1978 p. 211.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+