Does the difference in the genealogies of Jesus Christ in the gospels of Matthew and Luke present a problem for Christian faith by challenging historicity of Christ? Perhaps you have heard this difference explained by claiming that Matthew is tracing the ancestry of Christ's father and Luke the ancestry of his mother. But that's not the full story.
In reality, both evangelists are tracing genealogy of Christ through his father, but Matthew follows the biological ancestry while Luke follows legal ancestry. This divergency exists because of a common ancient near eastern custom of levirate marriage. Since women in the ancient world did not have the right to own land, they risked losing all their property if their husbands died before they had a mature son. A mature male relative closest to her husband, however, could rescue the widow and her children from the doom of poverty by marrying her. This way he would preserve her estate, becoming her legal guardian and redeemer, but by doing so he would legally assume the identity of her deceased husband and would have to give up the rights to inheritance he could receive from his father. Such an act was often seen as heroic charity, especially if the redeemer came from a wealthier family, as it can be seen in the book of Ruth.
In the genealogy of Christ, there are at least three levirate marriages, although it is possible that there were more. For obvious reasons, they are a source of confusion for us, because we are unfamiliar with the laws and customs of the ancient world. Thankfully, we have our wonderful church fathers Africanus, Eusebius, John of Damascus, Andrew of Crete, Epiphanius the Monk, and others to clear things up for us. The information they give is also partially supported by Talmud and a couple of ancient rabbis, which are quite critical of Jesus, giving us confidence in the overlapping data sets. The key to this is the fact that Joseph, the father of Jesus, had two fathers who were uterine brothers, sons of Estha. Eli, Joseph's legal father, married Estha first but died soon leaving her a childless widow. Jacob, Joseph's biological father, redeemed Eli's widow through levirate marriage.
The difference in genealogies is not based on a legal technicality alone, however. It had also a lot to do with the first recepients of the gospels. Matthew, clearly writing his gospel to the Jews and wanting to convince them that Jesus is their true messiah, traces Christ's genealogy through Jacob who is related to most of the kings of Judah. Luke, writing his gospels to a Roman court official Theophilus as a prequel to Acts in defense of Paul's innocense during his trial, is far more interested in giving Theophilus information that could stand in a Roman court of law verified with legal census records. Roman ancestry was always traced through the legal father. For the Jews, things were more complicated with a variety of rabbinic approaches emerging during that time due to routine destruction of paternal records in purges and exiles.
For your convenience, I made a combined chart of Christ's ancestry. It forks after David with Matthew's presentation on the left (yellow) and Luke's on the right (green). Please note that a large portion of the tree overlaps and that many parts are supported by the records in Genesis, Ruth, Kings, and Chronicles.