The beginning of Matthew gives the lineage of Mary, not Joseph, her husband. A lot of varying theology and conjecture is put forward regarding this but God’s checks and balances shows otherwise.
1. The book of the generation of Jesus Christ, the son of David, the son of Abraham. 2. Abraham begat Isaac; and Isaac begat Jacob; and Jacob begat Judas and his brethren; 3. And Judas begat Phares and Zara of Thamar; and Phares begat Esrom; and Esrom begat Aram; 4. And Aram begat Aminadab; and Aminadab begat Naasson; and Naasson begat Salmon; 5. And Salmon begat Booz of Rachab; and Booz begat Obed of Ruth; and Obed begat Jesse; 6. And Jesse begat David the king; and David the king begat Solomon of her that had been the wife of Urias; 7. And Solomon begat Roboam; and Roboam begat Abia; and Abia begat Asa; 8. And Asa begat Josaphat; and Josaphat begat Joram; and Joram begat Ozias; 9. And Ozias begat Joatham; and Joatham begat Achaz; and Achaz begat Ezekias; 10. And Ezekias begat Manasses; and Manasses begat Amon; and Amon begat Josias; 11. And Josias begat Jechonias and his brethren, about the time they were carried away to Babylon: 12. And after they were brought to Babylon, Jechonias begat Salathiel; and Salathiel begat Zorobabel; 13. And Zorobabel begat Abiud; and Abiud begat Eliakim; and Eliakim begat Azor; 14. And Azor begat Sadoc; and Sadoc begat Achim; and Achim begat Eliud; 15. And Eliud begat Eleazar; and Eleazar begat Matthan; and Matthan begat Jacob; 16. And Jacob begat 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 until the carrying away into Babylon are fourteen generations; and from the carrying away into Babylon unto Christ are fourteen generations. 18. Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost.
The text divides the generations into fourteen. The total from Abraham to David is fourteen. From David to (the carrying away) Jechonias is fourteen. But from Jechonias to Jesus by this record is only thirteen. The apparent contradiction is in the translation. Rather than research deeper the theologins like to guess and the unbelievers like to point out the error or discrepancy. It’s very simple. Even though most versions translate Joseph, the husband of Mary, it’s really her father Joseph, which now fits and adds up to fourteen. A woman can marry a man with the same name as her father. The word translated husband can be also translated father.
To use God’s checks and balances lets look at a verse that proves this is an error in translation. Joseph’s father was not named Jacob.
And Jesus himself began to be about thirty years of age, being (as was supposed) the son of Joseph, which was the son of Heli,
Joseph, the husband of Mary, had a father named Heli. Matthew 1 is not speaking of the husband of Mary but her father, which now adds up the lineage of Jesus to the fourteenth on his mother’s side. Now you can believe the word and not have to squeeze or guess.