How do we know Jesus descends from David, as prophesied?
The short answer
Matthew and Luke record Joseph's genealogy, and as Mary's husband Joseph was Jesus' legal father, with the rights of a real father. People usually married within their clan, so Mary was likely of David's house, as early Fathers testify. Paul also says Jesus was descended from David according to the flesh.
There is no record of Jesus' genealogy through Mary, but Matthew (1:2-16) and Luke (3:23-38) both thought it important to record Joseph's.
The Navarre Bible commentary on Matthew explains why: Jewish genealogies followed the male line, and Joseph, as Mary's husband, was Jesus' legal father, equal to a real father in rights and duties. Since people usually married within their clan, Mary can be concluded to belong to the house of David. Several early Fathers testify to this, such as Ignatius, Irenaeus, Justin and Tertullian, relying on unbroken tradition.
There is other evidence too: Paul says Jesus was "descended from David according to the flesh" (Romans 1:3).