Matthew writes to the Jews establishing "Jesus [as] the Messiah, the son of David, the son of Abraham" (Mt 1:1). By saying that he is the "son of" these ancestors Matthew's using the genealogical record proves that Christ's legal inheritance is valid. He traverses the family tree of heirs from Abraham connecting each by the phrase "the father of." This context is crucial because "the scripture . . . preached the gospel beforehand to Abraham, saying, 'All the nations will be blessed [in the future] in you'" (Gal 3:8). God said, "'In you all the families of the earth will be blessed'" (Ge 12:3). Therefore, there must be a continuity for it's fulfillment to come to pass. "Now the promises were spoken to Abraham and to his seed. He does not say, 'And to seeds,' as referring to many, but rather to one, 'And to your seed,' that is Christ" (Gal 3:16). Therefore Jesus must be a legal heir. Consequently God promised "'one who will come forth from your own body, he shall be your heir'" (Gen 15:4) also stating that "'Sarah your wife will have a son'" (18:10). Abraham cooperated and God repeated, '"In your seed all the nations of the earth shall be blessed, because you have obeyed My voice'" (22:18). God confirmed that "'through Isaac your descendants shall be named'" (21:12). Furthermore God promised Isaac himself that "'by your descendants all the nations of the earth shall be blessed'" (26:4).
Luke traces his genealogy in a natural upward direction from Christ to Adam. He concludes it saying "the son of Adam, the son of God" (Lk 3:38). This is because "the Lord God formed man" (Ge 2:7) and "put him into the garden of Eden" (:15). "But for Adam there was not found a helper suitable for him" (:20) so God fashioned a woman from Adam's rib (:22). Adam said, "'She shall be called Woman, because she was taken out of Man'" (:23) (i.e. Adam's name). Then "the man called his wife's name Eve, because she was the mother of all the living (3:20). God orchestrated the process from generation to generation. It developed within the Jewish nation. For instance, "God said to him, 'Your name is Jacob; you shall no longer be called Jacob, but Israel shall be your name'" (35:10) and "a nation . . . shall come from you'" (:11). Abraham, himself, inherited a new Jewish identity. Some kings were at war and they took possessions and captives of which Lot was one (14:1-12). "A fugitive came and told Abram the Hebrew" (:13) about it.
There are subtlties in the genealogies that are significant regarding Jesus' virgin birth. Luke relates "Jesus . . . being, as was supposed, the son of Joseph, the son of Eli" (Lk 3:23). But an angel of the Lord explains the supposition by saying "'the Child who has been conceived in her is of the Holy Spirit'" (Mt 1:20). Eli was Mary's father and Luke's genealogy is from her perspective. Matthew also relates that "Jacob was the father of Joseph the husband of Mary, by whom Jesus was born (:16). In this case he uses "husband of" instead of "father of." Individual elements must coincide with the big picture. Paul said that he was "set apart for the gospel of God, which He promised beforehand through His prophets in the holy Scriptures, concerning His Son, who was born of a descendant of David according to the flesh" (Ro 1:1-3). Joseph qualified since he "went up from Galilee . . . to the city of David . . . because he was of the house and family of David" (Lk 2:4). An "angel of the Lord appeared to him in a dream, saying, 'Joseph, son of David, do not be afraid to take Mary as your wife'" (Mt 1:20). Even though Luke's genealogy is from Mary's perspective, legal inheritance is substantiated from Joseph's. Joseph is a heir via Jacob and could lawfully marry her because her father Eli was Jacob's brother of the same tribe of Joseph. This is in accordance with the scripture where God said, "'the daughters of Zelophehad . . . must marry within the tribe of their father . . . [so that] no inheritance of the sons of Israel shall be transferred from tribe to tribe'" (Nu 36:6-7). They "are Israelites, to whom belongs the adoption as sons . . . whose are the fathers, and from whom is the Christ" (Ro 9:4-5).