It seems that Luke gives Joseph's geneology (Luke 3:23-38):
And Jesus himself was beginning about the age of thirty years; being (as it was supposed) the son of Joseph, who was of Heli, who was of Mathat, 24 Who was of Levi, who was of Melchi, who was of Janne, who was of Joseph, 25 Who was of Mathathias, who was of Amos, who was of Nahum, who was of Hesli, who was of Nagge, 26 Who was of Mahath, who was of Mathathias, who was of Semei, who was of Joseph, who was of Juda, 27 Who was of Joanna, who was of Reza, who was of Zorobabel, who was of Salathiel, who was of Neri, 28 Who was of Melchi, who was of Addi, who was of Cosan, who was of Helmadan, who was of Her, 29 Who was of Jesus, who was of Eliezer, who was of Jorim, who was of Mathat, who was of Levi, 30 Who was of Simeon, who was of Judas, who was of Joseph, who was of Jona, who was of Eliakim, 31 Who was of Melea, who was of Menna, who was of Mathatha, who was of Nathan, who was of David, 32 Who was of Jesse, who was of Obed, who was of Booz, who was of Salmon, who was of Naasson, 33 Who was of Aminadab, who was of Aram, who was of Esron, who was of Phares, who was of Judas, 34 Who was of Jacob, who was of Isaac, who was of Abraham, who was of Thare, who was of Nachor, 35 Who was of Sarug, who was of Ragau, who was of Phaleg, who was of Heber, who was of Sale, 36 Who was of Cainan, who was of Arphaxad, who was of Sem, who was of Noe, who was of Lamech, 37 Who was of Mathusale, who was of Henoch, who was of Jared, who was of Malaleel, who was of Cainan, 38 Who was of Henos, who was of Seth, who was of Adam, who was of God.
Of course the parenthetical "Jesus .... being (as it was supposed) the son of Joseph" (3:23) means that while Christ was reckoned the son of Joseph by all, he of course contributed nothing to the conception of Christ, but was a foster father, Mary having conceived miraculously without Joseph's participation: "he knew her not before her bringing forth a son" (Matthew 1:25); "How shall this [conception of Jesus] be, seeing as I do not know man?" (Luke 1:34).
He perhaps ends his genealogy with "God" as the final 'patriarch' in answer to the fact that Joseph was not the true father, but God. It seems to be a frank but subtle recognition that this genealogy of course does not to prove Christ's ancestor via any royal line, but still serves the purpose of conveying the truth that Jesus is in a sense not of this world, but the Son of God.
That he brings Christ's genealogy back as far as Adam is also to show that Christ is the new Adam (1 Corinthians 15:45 etc.), theology Luke perhaps learned from one of its major, or perhaps first, proponents, Paul, of whom he was the amanuensis, or secretary. So thought apostolic fathers like Irenaeus.1
Whereas it seems that Matthew gives Mary's genealogy because of the indispensable requirement for the Messiah to be a son of David (Mary being a daughter of David).
The book of the generation of Jesus Christ, the son of David, the son of Abraham: 2 Abraham begot Isaac. And Isaac begot Jacob. And Jacob begot Judas and his brethren. 3 And Judas begot Phares and Zara of Thamar. And Phares begot Esron. And Esron begot Aram. 4 And Aram begot Aminadab. And Aminadab begot Naasson. And Naasson begot Salmon. 5 And Salmon begot Booz of Rahab. And Booz begot Obed of Ruth. And Obed begot Jesse. 6 And Jesse begot David the king. And David the king begot Solomon, of her that had been the wife of Urias. 7 And Solomon begot Roboam. And Roboam begot Abia. And Abia begot Asa. 8 And Asa begot Josaphat. And Josaphat begot Joram. And Joram begot Ozias. 9 And Ozias begot Joatham. And Joatham begot Achaz. And Achaz begot Ezechias. 10 And Ezechias begot Manasses. And Manasses begot Amon. And Amon begot Josias. 11 And Josias begot Jechonias and his brethren in the transmigration of Babylon. 12 And after the transmigration of Babylon, Jechonias begot Salathiel. And Salathiel begot Zorobabel. 13 And Zorobabel begot Abiud. And Abiud begot Eliacim. And Eliacim begot Azor. 14 And Azor begot Sadoc. And Sadoc begot Achim. And Achim begot Eliud. 15 And Eliud begot Eleazar. And Eleazar begot Mathan. And Mathan begot Jacob. 16 And Jacob begot Joseph the husband of Mary, of whom was born Jesus, who is called Christ. 17 So all the generations, from Abraham to David, are fourteen generations. And from David to the transmigration of Babylon, are fourteen generations: and from the transmigration of Babylon to Christ are fourteen generations.
It seems that Mary is lumped in her along with the other descendants of David, namely Joseph, because it's already obvious and implicit that: a) among the Jewish people, it was known that the Messiah must be a real descendant of David, and so the mother is obviously a descendant of David if the father's David ancestry is irrelevant, as in this case b) it is immediately related after this that Joseph had no part in the conception of Jesus. That is, both Mary and Joseph are descended from David (Luke 1:32; 2:3-5).
This is important because Matthew's Gospel is universally recognized as a very Semitic Gospel, whose intended audience are Jews, who are looking for all the key requirements of the Davidic Messiah to be met in the Christ (note also the arbitrary selection of Abraham, the father of the Jews, as a major patriarch, as opposed to anyone else). The importance of the Davidic ancestry of the Messiah is perhaps why Matthew begins his Gospel with Jesus' genealogy; a non-descendant of David was not a candidate for the Messiah.
Thus, He gives a Davidic lineage via Mary, his mother: "Paul, a servant of Jesus Christ, called to be an apostle, separated unto the gospel of God, which he had promised before, by his prophets, in the holy scriptures, concerning his Son, who was born of the seed of David [i.e. Mary], according to the flesh" (Romans 1:1-3); "God sent forth His Son, born of a woman" (Galatians 4:4). Also significant perhaps is involving the mother at all in an important genealogy such as this, since the Davidic Kingdom consisted of the King, but also a significant figure, being the mother of the King, who served as Queen or Lady of that Kingdom (cf. Jeremiah 13:18; 1 Kings 2:19; 2 Kings 24:12; etc.). This was doubtless, then, another expectation of the Jewish people concerning the Messiah: 'who would the blessed mother of our Messiah be?' Note therefore the fulfillment of this expectation in the words of Elizabeth, speaking of the mother of the Messiah: "Blessed are you among women, and blessed is the fruit of your womb! And why was it granted to me that the mother of my lord [i.e. the Messiah] should come to me?" (Luke 1:43; cf. Psalm 110).
Worthy of consideration is the fact that the Hebrew letters דוד ("David") have the sum numeral value of 14 (ד being 4, ו being 6), which may explain the division into fourteens here as significant of 'perfect Davidicness.' It may be, too, that the apparent redundancy or irrelevance of Joseph's genealogy (Jesus not being descended from him) can be explained as showing simply that Joseph is a fulfillment in the delineated recapitulations of generations in fourteens.
1 "Wherefore Luke points out that the pedigree which traces the generation of our Lord back to Adam contains seventy-two generations, connecting the end with the beginning, and implying that it is He who has summed up in Himself all nations dispersed from Adam downwards, and all languages and generations of men, together with Adam himself. Hence also was Adam himself termed by Paul 'the figure of Him that was to come,'" (Irenaeus, Against Heresies, Book III, Chapter 22, 3. Circa A.D. 180.