Matthew began his narrative with a long genealogy of Jesus. Luke did not include a genealogy until the beginning of Jesus’ ministry (Luke 3:23-38). A quick comparison reveals that not only are the two set in different contexts, they include different names and follow totally distinctive patterns. Most surprising, perhaps, is that Matthew began with Abraham and traced Jesus’ lineage down to Joseph, “the husband of Mary, of whom Jesus was born.” Luke began with Jesus” the son (as was thought) of Joseph” and traced Jesus’ ancestry back to “Adam, son of God.” Sonship was important to Luke, as some of his parables also indicate.
Leaving Luke’s genealogy aside, Matthew stated his intent in defining Jesus’ ancestry in the first words of his text: “An account of the genealogy of Jesus the Messiah, the son of David, the son of Abraham.” He wished his audience to understand that Jesus, as Messiah/Christ, was descended from Abraham, the father of God’s holy people, and also heir to the royal line of David. The forty-two generations in three segments of fourteen may have referred to the mystical number seven. Almost certainly this genealogy was artificial rather than historical.
The audience for whom Matthew wrote was most likely a mixture of Jewish and Gentile Christians, but mostly Jewish. Matthew the author was probably not the so-named apostle but someone using his name. He may have been a Greek speaking Jew very familiar with the Hebrew scriptures and also a Pharisee. Although he generally favoured the Pharisees, he was adamantly negative toward those scribes and Pharisees who rejected Jesus. The expulsion of Jewish Christians from synagogues dominated by the Pharisees the Synod of Jamnia (ca. 85 CE) may well have been the historical background of his narrative.
There is a real possibility that Matthew sought to present Jesus as the new Moses sent by God to lead God’s people to a new destiny. He wrote in the 80s CE possibly in Edessa, a city east of the Euphrates River then in Syria and now in southeastern Turkey. His vision of the kingdom of God was of a people far more pluralistic than his own Jewish nation had become since the destruction of Jerusalem in 70 CE.
The Bible is full of family genealogies, most of them plainly boring, but quite significant. They legitimated priests and kings by tracing the priesthood back to Aaron of the tribe of Levi and monarchs back to the royal line of David. They also could be used to settle contested inheritance of ancestral property. Generally they included only male ancestors.
Surprisingly, Jesus’ genealogy included five women - Tamar, who seduced her father-in-law; Rahab, a prostitute of Jericho; Ruth a Moabite; and Bathsheba, wife of Uriah the Hittite, and mother of Solomon by King David. This was Matthew's way showing that although Jesus was Jewish, he was also descended from non-Jews and women of humble if not doubtful social status. Mary was named only to anticipate the next part of Matthew’s narrative.