The Gospels give two completely different genealogies for Jesus. In Matthew 1:1-16, the list begins with Abraham, goes down to David in verse 6, then Solomon, Rehoboam, and on through the kings of Judah until the Babylonian exile. The lineage ends with Matthan, Jacob, and Joseph the husband of Mary. Luke 3:23-38 starts with Jesus and goes backward in time. The difference is immediate. Joseph's father is given as Eli (also spelled Heli), then Matthat, Levi, and Melchi. The son of David in this line is not Solomon, nor are any of the kings of Judah mentioned. Instead, Nathan is the link to David. Nathan was the third son of David and Bathsheba and the older brother of Solomon (1 Chronicles 3:5). The genealogy then continues on, ending in Adam and God.
Why do Matthew and Luke have different genealogies of Jesus?
Why the discrepancy? It is too large a difference to blame a copyist, and genealogy was important enough to the Jews that they would know who their ancestors were. There are several different possibilities.
Matthew's genealogy is direct while Luke's included "levirate" marriages. If a married man died childless, his brother was required to marry his wife to provide a son to continue the dead man's line. While it is entirely possible that Solomon would have been willing to add his brother Nathan's widow to his long list of wives and concubines, it is highly unlikely that every single marriage after was a levirate marriage as well.
The two accounts merge within the last three generations. In this theory, Joseph's grandmother first married Matthan and gave birth to Jacob (Matthew 1:15). Matthan died, and she married Matthat and gave birth to Eli (Luke 3:24). Jacob and Eli were half-brothers on their mother's side. Joseph's mother married Jacob, but Jacob died childless. Eli married Jacob's widow, and she had Joseph. If this is the case, Joseph was biologically Eli's son and Matthat's grandson. Legally he was Jacob's son and Matthan's grandson. Thus, legally Joseph would be descended from David via Solomon and the kings of Judah, but biologically he would be descended through David's son Nathan. There is nothing in the Bible to indicate this is true. It was contrived as a possible explanation for Joseph to have two different genealogies.
Luke lied for political reasons. Luke needed to acknowledge that Jesus was a direct descendent of David to fulfill prophecy. But because he wrote to a Greek audience that had had to endure several Jewish revolts, he needed to de-emphasize that Jesus was related to David through the line of legitimate Jewish kings. Matthew's genealogy, written for the Jews, threatened Herod's tenuous hold as king of Israel and was too dangerous for Luke to use. There is no evidence to suggest this viewpoint is correct. For one, if Luke's genealogy is made up, where did he get it from? For another, if Jesus' genealogy was so dangerous, why bring it up at all? Mark and John didn't.
Luke traces Joseph's genealogy through his father, but Matthew traces Joseph's genealogy through his mother. In this view, Jacob would be Joseph's mother's father.
Matthew gives the royal line, while Luke gives Joseph's direct line. This is possible, and since Matthew is written to the Jews, the lineage of Jesus as heir to David's throne is important. But if this other direct royal line existed, it diverged from Joseph's early on, and although Jesus was directly descended from David, it was rather obliquely to the royal line.
Matthew gave Joseph's line, while Luke gave Mary's line. There was no word for "son-in-law" for Luke to use in Luke 3:23, and tradition was that the wife's father would consider his sons-in-law as sons. Matthew, writing to the Jews, would have emphasized Jesus' legal right to David's throne. Joseph would have been directly descended from the royal line of David, but since Jesus was adopted by Joseph, He would have avoided the curse in Jeremiah 22:30 that said none of the descendents of Jeconiah (the last of the direct royal line to rule before the exile to Babylon—see 2 Kings 24) would sit on David's throne. Luke, writing to Gentiles, gave Jesus' biological connection to David through Mary. In addition, Luke 1-2 suggests to Bible scholars that much of Luke's information about Jesus' early life came from Mary. She would have been able to give him her genealogy, and he may have been inclined to honor her by including it.
We don't know exactly why the Gospels include two genealogies of Jesus, but the last explanation—that Matthew's is through Joseph and Luke's through Mary—is the most likely explanation. Either way, Jesus is eligible to sit on David's throne and reign forever (see 2 Samuel 7:12-13).
What is the importance of the virgin birth of Jesus Christ?
What is the significance of the humanity of Jesus?
How is Jesus the son of David?
How is Jesus the Son of God?
How is Jesus the Son of Man?
Truth about Jesus Christ