The Moon is a mystery. Everyone on Earth can see it, but we only ever see one side of it. It affects the tides of the ocean, when animals have sex and apparently even how people sleep.

Yet until 1969, no one had ever been to the Moon. Even in 2015, almost a half-century later, only a measly 12 people have been there.

Thanks to the astronauts who visited the Moon, along with the many unmanned probes that have also been, we now know a lot about the Moon's makeup. But for all that knowledge, scientists are still struggling with a seemingly simple question: where the Moon came from.

Did it somehow get spun off from the Earth? Was it roaming through the solar system before being grabbed and forced to forever encircle us? Or did something altogether apocalyptic happen to bring it into being?

Our ancestors couldn't get to the Moon, but that didn't stop them pondering where it came from.

After the Second World War a completely different idea took hold

The Italian astronomer, physicist and philosopher Galileo Galilei made an early contribution when he succeeded in making a powerful telescope that showed the Moon in far greater detail than had been possible before.

In the early 1600s, Galileo showed that the Moon had a landscape similar to that of Earth. It was rugged, with mountains and plains. This was the first hint that the Earth and Moon somehow formed together.

Fast forward to the 1800s, and Charles Darwin's son George had an idea. He suggested that when the Earth was young it rotated very quickly, and as a result part of it flew off into space and formed the Moon. The Pacific Ocean is supposedly the scar from this "fission".

This theory didn't get much traction, and after the Second World War a completely different idea took hold.

The chemist Harold Urey proposed instead that the Moon came from another part of the galaxy, and was pulled in by the Earth's gravity as it passed by.

They were unsure if the Earth could capture the Moon without having its orbit disrupted

The capture theory gets a lot right. The Moon is large compared to the Earth, unusually so for a satellite, but if it formed elsewhere that suddenly makes sense. The theory also accounts for the fact that it always faces us with the same side, as this can happen when objects get captured.

Still, some scientists were unconvinced. They were unsure if the Earth could capture the Moon without having its orbit disrupted. They also thought the two would have probably collided.

There was a possible solution. If the Earth's atmosphere was large enough at the time, it could have acted like a giant airbag, slowing the Moon down before it could escape back into space. But this seemed rather unlikely.

The lunar scientists needed a theory that was consistent with several key observations. In particular, the Moon is relatively large. It is also speeding up, which means it is gradually moving away from Earth.

The Apollo astronauts were tasked with bringing back samples of moon rock

One idea put forward was accretion theory. This posits that the Earth and Moon formed together from a giant spinning disk of matter, which surrounded a black hole.

This theory died a quick death. It couldn't explain the speed with which the Moon orbits the Earth. Also, astronomers had calculated that the Moon was half as dense as Earth, suggesting they probably didn't form from the same accretion disk. Finally, there was no sign of the black hole.

This meant Urey's theory of capture remained dominant throughout the 1960s, when the USA began trying to send a manned mission to the Moon. If Urey was right, the Moon ought to have a different chemical composition to the Earth.

In part to test this, the Apollo astronauts were tasked with bringing back samples of moon rock. The data from those rocks blew all the existing theories to pieces.

The first casualty was George Darwin's fission theory. The lunar rock samples showed that the Moon was far older than the Pacific Ocean from which it was supposed to have come.

Urey's capture theory also received a hammer blow

"The oldest rocks on the Moon were these white anorthosites," says Alex Halliday of the University of Oxford in the UK. Because this mineral is not very dense, it normally floats on molten magma, so it would have been found close to Earth's surface rather than deep inside.

However the outermost layer of Earth's crust is only about 200 million years old. It cannot be the source of the Moon's rocks.

Urey's capture theory also received a hammer blow.

To everyone's surprise, the samples of lunar rock and soil revealed that the Moon is almost chemically identical to the Earth. That would be most unlikely if they formed far apart, as Urey had suggested.

Apollo led to "a period of deep confusion"

The rocks also showed that the Moon formed about 29 million years later than other similar-sized objects in the solar system.

It appears to have had a fiery beginning. The dark areas of its surface suggest it was once covered all over by a deep ocean of liquid magma.

Any theory of the Moon's origin would need to account for all of this. None of the existing theories were up to the job, so Apollo led to "a period of deep confusion", according to a 2014 paper by Jay Melosh of Purdue University in West Lafayette, Indiana. "A great many detailed facts about the Moon… were gleaned from the lunar rocks, but no clear picture of its origin emerged."

In 1975, three years after the final Apollo landing, a new idea was put forward. The giant impact hypothesis, as it became known, was distinctly dramatic.

The impact caused part of Earth's outer layer to spin off and form a giant molten ball

When the solar system was forming 4.5 billion years ago, there were all sorts of rocks whizzing around. So William Hartmann and Donald Davis of the Planetary Science Institute in Tucson, Arizona suggested that one of them hit the Earth.

It must have been a seriously big rock: about the size of the planet Mars, which has a mass one-tenth that of Earth. This hypothetical planet, which has been nicknamed Theia, delivered a massive sideways blow rather like the cue ball in a game of pool.

The impact caused part of Earth's outer layer to spin off and form a giant molten ball. This ball would have burned bright, occupying about a third of Earth's sky, until it cooled and moved further away.

This collision has been simulated in computers, and works rather well. For starters, it can account for why the Moon's iron core is about half the size of Earth's. Theia's core accreted into Earth's, so the Moon didn't get much.

Halliday calls the impact the "least worst explanation"

It also explains why the Moon has so few "volatiles", those elements that easily evaporate into gases. The heat of the collision blasted them off into space.

Finally, the relative sizes of Earth and Theia can account for the speed of the Moon's orbit.

As a result, Halliday calls the impact the "least worst explanation". But it still has one big problem.

It's the same issue that derailed Urey's capture theory: the Earth and Moon are just too similar chemically.

If Theia existed, it has left no trace on the Moon

Many elements exist as subtly different variants called isotopes. Each atom is made up of three types of smaller particle, called protons, electrons and neutrons. Every atom of a given element has to have the same number of protons and electrons, but the number of neutrons varies, giving rise to isotopes.

Isotopes act as a kind of chemical fingerprint. If you have a mystery material, looking at the mix of isotopes it contains can give you a clue about where it came from.

In the case of the lunar rocks, some of the isotopes should have come from Earth and some from Theia, so the isotopic composition should be somewhere between the two. But in fact it's almost exactly the same as Earth's. If Theia existed, it has left no trace on the Moon.

This is a big problem for the giant impact hypothesis.

So far, it hasn't killed the impact hypothesis

The isotopes of tungsten and silicon are especially tricky, because they are produced during the formation of planetary cores.

"Every planet has a different history of core formation, so you'd expect to get a different signal," says Halliday. "These isotopes suggest it was the Earth itself that the Moon's atoms came from."

Melosh calls this finding the "isotopic crisis". But so far, it hasn't killed the impact hypothesis.

The simplest possible explanation is that Theia just so happened to have exactly the same isotopic signature as Earth, perhaps because it formed nearby. However, simulations of the early solar system suggested the probability of this happening is less than 1%.

In line with that, there are no other known bodies in the solar system with the same isotopic composition as Earth and the Moon. Scientists would like to collect meteorite samples from Venus and Mercury to see if they share similar isotopes, but it's a long shot.

The problem is that Theia has to have struck Earth a glancing blow

Alternatively, maybe the impact was so severe that Theia and Earth both melted, and their atoms mixed together. That would explain why the Earth and Moon are now so similar, but it's far from clear if such a catastrophic impact happened.

It's also been suggested that the impactor body was mostly made of ice. There are plenty of such ice-balls in the outer solar system, and one could have clobbered the Earth at high speed.

But even then, only 73% of the Moon could be derived from Earth, which is not enough to explain the isotopes. The problem is that Theia has to have struck Earth a glancing blow, otherwise the Moon would have ended up in a different orbit, and this sideways blow messes up the isotopes.

Maybe Theia didn't strike a glancing blow after all. In 2012 Matija Ćuk and Sarah Stewart of Harvard University in Cambridge, Massachusetts came up with a way to avoid it.

Theia could have been far smaller than previously thought

They suggested that the Earth was already spinning very fast when Theia hit it. If Earth was spinning rapidly, there was already enough momentum to send the Moon into the right orbit. There was no need for a glancing blow: Theia could have hit Earth head-on.

That means Theia could have been far smaller than previously thought, about 2% of Earth's mass. In turn, that means the Moon could be primarily made up of material from Earth.

This idea "has shaken the ground beneath all previous approaches," says Melosh.

In April 2015, yet more evidence emerged to support the giant impact hypothesis.

It makes the odd similarity of the Earth and Moon a little easier to explain

Alessandra Mastrobuono-Battisti of the Israel Institute of Technology in Haifa and her colleagues performed a more detailed simulation of the objects buzzing around in the early solar system.

They found that the objects that impacted on planets were much more similar to those planets than previously expected. Instead of just a 1% chance of Theia and Earth being very similar, the odds were more like 20%.

That's still not brilliant odds, but it makes the odd similarity of the Earth and Moon a little easier to explain.

Nevertheless, the job's not quite done. "We are still missing something," says Stewart.

Perhaps we shouldn't be too surprised that part of its origin story relies on blind luck

Most researchers now think the solution will be some version of the giant impact hypothesis, but it still needs some tweaking to convincingly explain the isotopes.

The biggest problem is to find a theory under which every aspect of the Earth and Moon look reasonably likely. As long as the theory requires Theia to have a particular mass, or hit the Earth in just the right way, it will always be open to doubt.

That being said, part of the reason for all the interest in the formation of the Moon is that it is unusual. Perhaps we shouldn't be too surprised that part of its origin story relies on blind luck.