Why is Joseph

Why is Joseph’s genealogy given in Matthew's Gospel, instead of that of Mary, seeing that Joseph was not the father of the Lord Jesus?

There are, as is well known, not one but two genealogies of Christ in the Gospels. In Matthew 1: His royal descent is traced from Abraham, through David and the kings of Judah, down to Joseph, His legal, though not His actual father. But in Luke 3 His natural descent is traced from Mary’s own father, Heli, through a different branch of the Davidic family up to Adam. The phrase, “Being, as was supposed, the son of Joseph,” which is parenthetically inserted in Luke 3:23, really answers the questions asked above. For since He was supposed, or legally reckoned, to be Joseph’s son, it was necessary that there should be what might be called an official genealogy, through him to David and Abraham, as well as that through His mother, in order that all objections to His claim to be “Son of David” should be silenced. In Matthew’s Gospel Joseph is prominent, and in Luke’s, Mary, not merely in the genealogies, but in the entire narrative, which in each case is as it should be, in view of the Jewish character of the former, and the Gentile character of the latter.