Matthew began his Gospel with a genealogy, listing the great ancestors of Joseph. His clear purpose in beginning with them was that he was writing his Gospel to refute the claim that Jesus went against Jewish traditions. Matthew showed that being directly descended from Abraham and King David, Jesus couldn’t have been more Jewish than that.
Such genealogies were a common thing in the Bible, and they were never expected to be accurate. Matthew’s and Luke’s genealogies didn’t agree. Luke lists forty generations between David and Joseph, while Matthew lists only twenty-eight; and most of the names are different.
Matthew list, fourteen generations for the eight hundred yeas between Abraham and David, for the four hundred years between David and the Babylonian Captivity, and for the six hundred years between then and Joseph.
Arabic scholars put out a reason for being three sets of fourteen. They say three sets of fourteen breaks down to six sets of seven. That would put Jesus as the first in a seventh set of seven; and that was thought to be a position of total greatness.
While Hebrew genealogies, known as toledoths, gave only the names of male ancestors, Matthew draws attention to King David’s wife Bathsheba, and to his great grandmother Ruth, and two of David’s female ancestors Tamar, and Rahab.