Always take note of the women in Matthew 1. You would never expect to see women in a genealogy in that day. As you look at each one, they serve as various reminders of God’s grace. God brought Jesus through a family line that was ugly at times, but how else could He save us in our ugliness?
Matthew is writing to a Jewish audience to convince them that Jesus was the Messiah. One of his techniques is to show how Jesus’s life fulfilled Old Testament prophecy. The “out of Egypt I have called my son” is from Hosea 11:1. The Lamentations in Ramah is found in Jeremiah 31:15. The “He will be called a Nazarene” is not found in the OT, but since Nazareth had a bad reputation, Jesus coming from there could be one reason he would be rejected by the Jewish leadership.