I believe the careful Bible student is likely to conclude that Matthew and
Luke present two different genealogies. Following through the genealogies,
one will notice that there are some names which are common to both, but
also, an great number of differences. Matthew begins at the patriarch
Abraham, and works his way to Jesus the Christ. Luke begins at Jesus,
and works his way back to Adam. There are two genealogies, with two
distinct purposes. Matthew, it appears reveals the genealogy of Joseph,
and Luke, presents the genealogy of Mary.
Matthew, penning his gospel with the Jews in mind sets out to establish
Jesus' qualifications to be the Messiah through Joseph's genealogy. Thus,
beginning with Abraham, he maps the Lord's genealogy through David, and
the kings which followed. He presents Jesus royal lineage (through the
males) through "...Joseph, the husband of Mary, of whom was born
Jesus..."
Luke, writes to the Gentiles with a view toward the humanity of Christ. The
concept of one being both God and man would seem strange and foreign
to those accustomed to Greek and Roman gods. Thus, Luke begins at
Jesus, and follows the genealogy of Mary, passing through the patriarchs,
ending with the very first man, Adam.
If Luke is tracing the genealogy of Mary, why does he cite Joseph's name?
Today, it would be politically incorrect to map a woman's genealogy through
her husband, however, in Luke's day, it was proper and correct. Luke
follows Mary's genealogy, beginning with the name of Joseph, her husband,
Heli's son-in-law (in legal terms, his son by marriage).
There is no contradiction.