From this link (
Jesus' Right to David's Throne by Dr. Arnold Fruchtenbaum. A messianic Bible Study ) a short writing on the geologies in Matthew and Luke by Arnold G. Fruchtenbaum
Of the four Gospels, only two give us a genealogy, the same two that deal with the birth and early life of Jesus. Both Mark and John do not deal with the birth of Yeshua or His early life. Matthew and Luke do record those events, so it is natural that only these two would bother recording a genealogy. While both Matthew and Luke give us the story of the birth of Jesus, they tell the story from two different perspectives; Matthew tells the story from Joseph's perspective, while Luke tells the story from Mary's perspective. In Matthew, we are told what Joseph is thinking, what is going on in his mind; but we are told nothing of what Mary is thinking. We read of how angels appeared to Joseph, but there is no record of angels appearing to Mary. On the other hand, when we go to Luke's gospel, we see this same story told from Mary's perspective. In the Gospel of Luke, it is Mary who plays the active role while Joseph plays the passive role. We find the angels appearing to Mary, but no angels appearing to Joseph. We are told several times what goes on in the mind of Mary but we are never told anything about what Joseph is thinking. From this context, when we have these two genealogies and these two Gospels only, it should be very evident that since Matthew tells the story from Joseph's perspective, we have the genealogy of Joseph; whereas when Luke tells the story from Mary's perspective, we have the genealogy of Mary instead.