Every living thing on Earth, from fungus to flying foxes, is descended from one single-celled ancestor that showed up in the primordial ooze billions of years ago. You probably knew that already. But did you ever wonder how a single ancestor split into the 9 million or so species that populate the world today? It’s a subject that evolutionary biologists spend a lot of time thinking about, for obvious reasons, and they still don’t agree on all the details. But something that happened to a bunch of flies in the 1800s is helping them figure it out. The process of one species splitting into two or more is called speciation, and there are two basic ways it can happen: allopatric and sympatric. Allopatric speciation is the kind that’s pretty straightforward. It happens when a single species is split into two or more groups by a physical barrier. Think glaciers during an ice age, a river carving out a canyon, a lava flow from a volcanic eruption, or even the construction of a new highway. Over time, each of the isolated populations goes off in its own evolutionary direction. Either because they’re adapting to the specific spots where they ended up, or just through random genetic drift, they build up genetic and physical differences from each other. Eventually, they become so different that even if they come into contact again, they can’t interbreed with each other – they’ve become separate species. Biology is full of examples of allopatric speciation, like the different species of squirrel on the north and south rims of the Grand Canyon, or finches isolated on different islands in the Galapagos. But there’s not always a clear physical barrier that separates one species into two. Sometimes a species splits even though the two diverging groups are still living side by side in the same habitat. That’s sympatric speciation. Like in the case of the apple maggot fly, an insect native to North America that split into two very different groups around the mid-1800s. For sympatric speciation to happen, something has to make different groups within a population stop breeding with each other even though they’re still sharing a habitat. They don’t just, like, spontaneously decide that they want to split up. The process generally starts with disruptive selection, when natural selection drives a population in two different directions at the same time. Combine that with assortative mating, where individuals choose mates that are similar to themselves, and you can end up with two different groups splitting off from each other. If these forces are at work for long enough, they can cause one species to break up into two, each carving out a separate niche in their shared ecosystem. That’s what happened with the apple maggot fly. The fly used to lay its eggs only on the fruit of hawthorn trees, which are native to North America. But after domestic apple trees were introduced to North America in the 1600s, some flies were able to switch over to using those instead. By the mid-1800s, there were so many flies infesting apples that they’d become a serious problem for apple farmers. The flies look for mates on the type of fruit they hatch on, so over time, hawthorn-eating flies and apple-eating flies have tended to stick to their own. These days, hawthorn flies and apple flies have different genomes, even though they still live in the same habitat. They’ve gone through sympatric speciation in just a few hundred years. Another example of sympatric speciation in action comes from Lake Apoyo, a volcanic lake in Nicaragua. The lake was colonized just once by a single ancestral species of cichlid fish, but today there are two related species there, even though there’s no way two populations could ever have been isolated from each other in the small, uniform, conical lake. They split up anyway: the two fish species that live there now have different body shapes and different teeth and specialize in different food, with one eating insects and the other eating plant material. But even though we’ve seen sympatric speciation in action, it’s still kind of controversial among biologists. The conditions needed for it to happen are pretty specific, and clear-cut examples of sympatric speciation in nature are rare. So much so that some biologists are still a little skeptical about the idea. Cases like the apple maggot fly and the cichlids in Lake Apoyo have helped convince most scientists that sympatric speciation really can happen, but we’re still not sure how common it is. Do species split up that way all the time? Or does there need to be some kind of physical separation between two groups except in very rare cases? Since we often don’t know what the exact geographical conditions were when species split in the past, it’s hard to tell. All we know for sure is that evolution is a non-stop process: species are arising, changing, diverging, and dying out all the time. Thanks for watching this episode of SciShow, which was brought to you by our patrons on Patreon. If you want to help support this show, you can go to patreon.com/scishow. And don’t forget to go to youtube.com/scishow and subscribe!