In Europe, surnames began to be used in the 12th century, but it took several centuries before the majority of Europeans had one. The primary purpose of the surname was to further distinguish people from one another. In the 13th century about a third of the male population had a given name of William, Richard or John *. To uniquely identify them, people began referring to different Williams as William the son of Andrew (leading to Anderson), William the cook (leading to Cook), William from the brook (leading to Brooks), William the brown-haired (leading to Brown), and so on. Eventually these surnames became inherited, being passed from parents to children.
Broadly, most surnames fall into four categories.
See also byname.