And Jesus went about all Galilee, teaching in their synagogues, and preaching the gospel of the kingdom, and healing all manner of sickness and all manner of disease among the people. And his fame went throughout all Syria: and they brought unto him all sick people that were taken with divers diseases and torments, and those which were possessed with devils, and those which were lunatick, and those that had the palsy; and he healed them. And seeing the multitudes, he went up into a mountain: and when he was set, his disciples came unto him: and he opened his mouth, and taught them, saying,Matthew 4:23-5:2
And he came down with them, and stood in the plain, and the company of his disciples, and a great multitude of people out of all Judæa and Jerusalem, and from the sea coast of Tyre and Sidon, which came to hear him, and to be healed of their diseases; and they that were vexed with unclean spirits: and they were healed. And the whole multitude sought to touch him: for there went virtue out of him, and healed them all. And he lifted up his eyes on his disciples, and said, Blessed be ye poor: for yours is the kingdom of God.Luke 6:17-20
The order of events when comparing the three synoptic gospels is sometimes quite different. This does not mean that any or all of them are inaccurate. History writers in that day were not as concerned with sequence as they were with content and evidence to prove their point or position.
When considering the major sermon(s) recorded in Matthew and Luke we find they are quite similar, and might conclude that they were the same sermon.
In favor of this position is much historical tradition. The explanation of the difference in content and length is easily answered when you consider the drastically different audiences of Matthew and Luke. Matthew includes more details concerning the law because he is writing to Jewish Christians. Luke does not include some of the details but he does teach the same message. One of the largest differences being the lack of the phrase “ye hath heard it that it hath been said…” Luke does not need this phrase because his audience has not had the tremendous exposure to Pharisaical heresy that Matthew’s audience had. We also find in support of the “same sermon position” that each of the writers has the healing of the centurion’s servant shortly after this sermons are preached.
The other opinion is that these are two separate sermons preached on separate occasions but with similar content. First of all, the content is similar but in a few cases, particularly the Beatitudes, there are some striking differences.
One might object that Jesus would never repeat Himself. That person should be wrong. Jesus had to continually teach His disciples the same lessons repeatedly. It should not surprise us that He may have preached the same material more than once. The appointing of the Apostles is also drastically different in sequence between the two writers. Luke has the sermon preached immediately after the twelve are chosen. Matthew has the sermon several chapters before the calling of the twelve.
Honestly, it does not matter which position is correct. Jesus spoke the words and we should regard them well. Regardless of which position is taken, the two sermons can be discussed simultaneously. In fact, studying them side by side might be and effective way of gleaning the truth from each by comparing and contrasting the the wording and flow of each.