The popularity of at-home deoxyribonucleic acid (DNA) testing kits has risen sharply in the last decade. Companies such as Ancestry and 23andMe make it fun and easy to find out where your ancestors came from. But what exactly are these tests looking for in your DNA?

DNA is essentially a map of your entire genetic makeup. It is a structure composed of a variety of molecules, but the most important ones for your ancestry kits are called nucleotides — adenine (A), thymine (T), cytosine (C), and guanine (G). It is the combination of these molecules in a linear arrangement that determines the characteristics that make you, ‘you.’ Usually, your biological machinery copies DNA faithfully, but sometimes it makes mistakes.

If the changes in DNA — known as mutations — occur in the cells that become sperm and ova, your children can inherit them. Genetic testing companies look for specific mutations and use self-reported information about the origins of other individuals with the same mutations, then use that information to determine where your genetics come from.

Let’s imagine, for example, that most humans have a specific segment of DNA that reads “AAAAAA.” Let’s call this segment Segment 1. Now imagine that hundreds of years ago, an individual inhabiting region X experienced an event that led to a mutation that made Segment 1 read “AAATAA.” They passed that mutation on to their children, their grandchildren, and so on. 

Many generations later, almost all individuals from region X who descended from that first individual have “AAATAA” at Segment 1. When a scientist encounters a random genome with the code “AAATAA” at Segment 1, they can be pretty sure the genome belongs to someone who originated from region X.

In reality, population genetics is a much more complex field than in the above example. However, this example illustrates the basic logic genetic testing companies use to guess the ancient populations from which your specific mutations originated.