If the solution to a problem does not reveal itself straight away then why not let your initial guesswork evolve? That's the approach we've taken in trying to determine the mass of our galaxy by mapping the historic movement of two nearby galaxies.
Many of the 200 billion stars in our galaxy, known as the Milky Way, can be seen in a narrow band stretching across the night sky.
The southern night sky throws up more surprises, in the form of two indistinct, fuzzy blobs. Larger than the full moon, and often seen overhead, these are two galaxies in their own right, known as the Large and Small Clouds of Magellan.
But these Magellanic Clouds are caught in the gravitational grip of our much larger Milky Way, pulling them in their orbit. They are also attracted to each other, performing a dance about one another as they circle the Milky Way.
Seen through radio eyes, the Magellanic Clouds are no longer distinct but are sheathed in gas, joined by a prominent bridge of gas and have an extensive stream of gas following them in their orbit.
But how much of this rich structure is formed by their dance, and how much is the Milky Way playing a part? At present, this is unclear, but unravelling the complex history of the Clouds and their interaction with the Milky Way will reveal one of the key secrets of our own galaxy: namely, how massive it is.
While we have a rough idea to how much dark matter holds our Milky Way together, it is tricky to tie this down to a precise value. If we can understand the dynamical lives of the Clouds of Magellan, we may be able to do better.
Tracing the orbits of the Clouds
Through a range of techniques we've been able to accurately determine the distance to the Clouds is about 160,000 light years.
Through the Doppler effect, we've been able to measure the speeds of the two galaxies towards us, but measuring their velocity across the sky has proved much harder. Only in recent years, using the Hubble Space Telescope, have astronomers been able to measure the almost imperceptible shift in stars as the Clouds move in their orbits.
We know that both Clouds are moving with the gravitational pull of the Milky Way, and they are also attracted to each other.
So all we need to do is use the gravitational and dynamical equations by Isaac Newton and integrate these equations of motion back in time to tell us where the Clouds have come from.
It might not be so simple
The size of a gravitational pull depends on the mass creating it but we are unsure of the actual mass of the Milky Way. Our estimates of the masses of the Large and Small Magellanic Clouds are also uncertain.
How do we know what the correct masses actually are? If we choose the wrong ones, then the orbits we find, while they may be pretty, they will have very little to do with reality.
Let's complicate things a little bit more. In science all measurements come with an uncertainty, and that tricky measurement of the motion across the sky with the Hubble Space Telescope comes with a non-negligible uncertainty. Again, if we pick the wrong value, then what we get will have little to do with reality.
So, what's the solution? The solution is to try all plausible values of the positions, the velocities and the masses, and use rules derived from the genetics of evolution to breed the best solution.
Nature knows best
Evolution lives by Charles Darwin's creed "Survival of the fittest" so that with a population of individuals, inhabiting a certain environment, only those that are strong enough, or best suited to the living conditions, can survive.
These survival skills are encoded in their genes and are passed onto the next generation. Every so often, a random mutation changes the skill set, and fitter individuals can be added to a population.
So we can use a process known as genetic algorithms to mimic this evolutionary process.
Each unknown value is encoded into a gene, with the expression of this gene, the phenotype, representing a realisation of a model. Each realisation will fit the data to a lesser or greater degree, and so we can take a scythe to the population, killing off the weaker ones and allowing the stronger ones to breed (that is, exchange chunks of their genes).
Throw in a random mutation here or there, by changing a value in a gene, and what you find is that subsequent generations of the population contain individuals that better and better fit the data.
Genetic algorithms have proved to be remarkably robust in optimising, finding excellent solutions when there are many variables to consider. This includes mimicking the evolution of animal movement, designing complex structures and machinery, and even stock trading.
For the problem of the Magellanic Clouds, we had to define what we mean by "better". Clearly, the Clouds should end up where we see then today, and be moving at the right speeds, but we also include extra observational evidence of their past interactions, especially bursts of star formation which can occur when two galaxies crash together.
The fittest survivor
With the genetic approach, we considered many thousands of the uncountable number of potential orbits of the Magellanic Clouds, breeding and mutating our populations to get the fittest. But how fit is the fittest?
Our best orbit accurately reproduces our observations, in terms of positions, velocities, previous star bursts and the location of the extensive gaseous stream.
And the mass of the Milky Way? We've measured it at about 1,000 billion times the mass of our sun to an accuracy of 20%, and find it to be lighter than previous measurements that have tried to use the Clouds orbits.
Explore further: The Great Debate over whether the universe is small or large