The best known of the five big sermons in Matthew is the Sermon on the Mount. We may miss some profound aspects of this grand sermon if we merely think of it as a sermon Jesus gave on one particular occasion. By the time you finish this book, you will hopefully realize that the main goal of the Gospel writers was not merely to record the things Jesus said and did but also to tell us truths about Jesus by the way they presented the things Jesus said and did.
For example, some of the material in the Sermon on the Mount is in both Matthew 5-7 and Luke 6. Now it is quite possible that Jesus preached similar things on more than one occasion, but that is not the best explanation for what we find in these chapters. We have good reason to conclude that Matthew and Luke were drawing on a common source for this material.  If this idea is true, then the differences between the two are significant, because they probably represent something Matthew (or Luke) was meaning to say about Jesus.
What is the significance of the fact that the Sermon on the Mount is on a mountain? Is it merely the fact that Jesus said these words on a mountain? Or has Matthew set these teachings of Jesus on a mountain in order to tell us something about Jesus? Again, this whole line of thinking can be a little troubling when you hear it for the first time. We are programmed merely to think of the Gospels as historical presentations without realizing that ancient writers felt freer to be creative in the way they presented history than we would expect.
So is it possible that Matthew wanted us to think of another word from God that was given on a mountain in the Old Testament? Is it possible that Matthew wanted his original Jewish audience to think of Moses and the Law when they read the Sermon on the Mount? If so, then the key verses of the sermon, 5:17-21, take on a rich meaning.
Matthew 5:17 says, "Do not think that I have come to abolish the Law or the Prophets; I have not come to abolish them but to fulfill them." Now the Law and the Prophets is a shorthand for the entire Old Testament Scriptures.  But the next couple verses go on to talk about commandments in the Law and the rest of the chapter shows how Jesus fulfills the Law.
The point is that the Sermon on the Mount gives Jesus' authoritative interpretation of the Law. It implicitly compares Jesus to Moses as the law-giver. Moses gave the Law. Now in this sermon Jesus gives the fulfilled Law. The sermon closes with the people getting the point: "When Jesus had finished saying these things, the crowds were amazed at his teaching, because he taught as one who had authority, and not as their teachers of the law" (7:28-29).
 Because it was German scholars who first explored this issue, they called the hypothetical source "Q" after the first letter of the German word for "source," Quelle. Scholars like Mark Goodacre believe it is more likely that Luke used Matthew as a source directly for this sort of material ***. My point in the main text comes to the same conclusion either way.
 The three sections of the Old Testament in the Jewish division are the Law, the Prophets, and the Writings. The "Law and the Prophets" is thus a shorthand way of referring to the whole Old Testament by referring to its two main parts.