When the sun was a newborn and Earth was in its infancy, the solar system could be a cruel and chaotic place. Dozens of would-be worlds, called “protoplanets,” careened about in uncertain orbits — jostling, jarring, and occasionally obliterating each other.

Out of this darkness emerged a mysterious, Mars-sized body scientists call Theia. We don’t know what this world looked like, or where it came from.

But 4.5 billion years ago, we are confident, it came barreling straight toward Earth.

The primordial planets crashed together with cataclysmic force. Our world shattered. Theia was destroyed. Billions of pounds of rocks were tossed into orbit around Earth. By the time the dust cleared, those rocks had coalesced into a brand new body.

The moon was born.

This moment of creation changed the course of Earth’s own history. The presence of a large, rocky satellite gave Earth a partner and protector in its dance around the sun. For 4.5 billion years the moon has stabilized Earth’s tilt, lengthened its days, summoned its tides. And, when beings were born on this planet with the capacity to look up and wonder, the moon gave us something to dream toward.

It’s been just 50 years since Earthlings left our first footprints on the lunar surface. But for our whole history, the moon has made its mark on us. Indeed, we might not exist without it.

The story of the moon’s origin, called the “Giant Impact Hypothesis,” is supported by a host of scientific studies. Lunar rocks brought back by the Apollo astronauts bear the same chemical fingerprints as material from Earth. Experiments showed that the moon is missing certain easily vaporized molecules, like oxygen and carbon dioxide, which would have been lost during its tumultuous formation process. Models of the collision suggest it is the best explanation for the moon we know today.

In the millennia after the moon’s creation, its surface remained entirely molten. Had anyone been around on Earth to witness it, they would have seen a huge red orb in the sky, 10 times larger than the moon we know today.

The moon was much closer then, computer simulations indicate, and the Earth spun so fast the sun rose and set every 6 hours. The moon trailed behind us in our orbit, tugging at our planet like a sluggish child. With each tug, it stole a little bit of Earth’s energy, called “angular momentum,” slowing our rotation and simultaneously drifting slightly farther away.

More than a billion years ago, when microscopic green and purple algae flourished in vast sulfuric seas, a day on Earth lasted 18 hours and the moon was 24,000 miles closer.

By the time of the dinosaurs, days were 20 minutes short of their current length.

Humans, who have only ever known a 23-hour, 56-minute day, are lucky to live when we do. At its current distance, the moon takes up the same amount of space in the sky as the sun — a cosmic coincidence that allows us to experience the grandeur of a total solar eclipse. Of all the Earthlings in history, we are among the few who have witnessed the light show of the solar corona, the glitter of sunlight shining across the moon’s craters, the otherworldly peace of twilight in midday.

But the moon keeps receding by about an inch and a half each year, and the time between sunrises stretches by 2 milliseconds every century. In about 650 million years, the moon will seem so small to us it will no longer be able to block the sun. The era of eclipses will be over.

The same gradual game of gravitational tug-of-war that stretched Earth’s days also altered our view of the moon. Over time, its rotational period — the amount of time it takes to turn on its axis — has slowed until it matched its orbital period — the time it takes to circumnavigate Earth. Now, like a child caught up in the arms of a twirling parent, it always shows us the same face.

This phenomenon, called tidal locking, explains why every human who has ever gazed skyward has observed the same thing: a northern arc of dark lava flows surrounded by pearly highlands, the star-shaped scar of Tycho crater spreading across the southern hemisphere.

Some of us have seen in those features the face of an old man, or the leaping form of a rabbit, or the head of Death. Prehistoric people in Ireland may have carved a map of the moonscape into one of their tombs.

Early astronomers thought the darker areas held liquid and referred to them by the Latin word for “seas.” Scientists today still call them “maria,” and have named them for the forms of water and its many moods: Rain and Serenity — the man in the moon’s two eyes; Tranquility — where the Apollo 11 astronauts landed.

Some day, many billions of years in the future, the moon could slow our rotation so much that Earth too becomes tidally locked. Then, one half the world would be lit by a distant moon every two-week-long night. The other half of the planet would always see only stars.

Don’t let this possibility worry you too much. It’s likely that the sun will expand into a red giant star and swallow the entire Earth long before then.

Our moon is uniquely large for the solar system; whereas Mars’s largest moon weighs less than 0.0000017 percent of its planet, the moon’s mass is roughly 1 percent of Earth’s. Its size gives it gravity powerful enough to pull the oceans toward it, producing the tides that rise and fall as Earth rotates.

More importantly, our massive moon provides a steadying influence.

Earth’s seasons are a result of its tilt; because the planet spins at an angle to the sun, the hemispheres trade off absorbing most of its rays. Though the planet may wobble slightly in response to gravitational influences from Jupiter and Saturn, the moon acts as a counterbalance to those distant giants. For most of our history, our tilt has stayed stable at about 23 degrees (no tilt would mean the axis of rotation was perpendicular to the plane of Earth’s orbit around the sun).

But worlds without such large moons tend to flounder, lurch and shimmy far more violently. Mars, with its two tiny moons, has swung from being nearly straight to practically on its side over the course of its history. Scientists suspect that this produced dramatic climate fluctuations that helped strip Mars of its atmosphere, leaving it desiccated, desolate and seemingly incapable of supporting life. Some have estimated that only 1 percent of all Earthlike planets in the universe have a satellite as hefty and protective as ours.

The moon is what let us be here. It is also what taught us where “here” is.

When Galileo developed his telescope, the moon was the first thing he looked at. He was stunned to find not the perfect heavenly body humans had imagined for centuries, but a rugged and real world, pocked with craters, streaked by mountain ranges.

“It is like the face of the Earth itself,” the astronomer wrote. The realization helped convince him of a sun-centered model of the solar system, in which the Earth was but one planet among many, a small but precious participant in “the dance of the stars.”

Today, scientists study the moon to better comprehend our corner of the cosmos. Like a time capsule, the lunar surface preserves history that has been lost on Earth — subsumed by plate tectonics, or worn away by water and wind. Its craters reveal periods of asteroid bombardment that pummeled the inner solar system. Its soil darkens from opalescent to dusky gray in response to the energetic particles that stream from the sun.

“We can look at the moon and see that record there that goes back 4.5 billion years, and understand our place in the solar system and what our environment is really like,” said lunar geologist Sarah Noble, a program scientist at NASA.

And sometimes, the moon reveals us to ourselves.

During a lunar eclipse, when the Earth slips between the moon and the sun, our satellite glows ghostly red, lit only by the pale light that passes through Earth’s atmosphere. This “earthshine” is colored by interactions with the oxygen, water and carbon dioxide in our air. By splitting it into a rainbow, astronomers can identify the chemical fingerprints of an inhabited world.

One day, perhaps, they will spot these signatures in the filtered starlight of a faraway planet and realize that we are not alone.

We will have one more reason to thank the moon.