"All scripture is given by inspiration of God, and is profitable for doctrine, for reproof, for correction, for instruction in righteousness: That the man of God may be perfect, thoroughly furnished unto all good works." (2 Timothy 3:16-17, emphasis mine)
The bible and historic Christianity both claim that the bible is inerrant. The basic meaning of inerrancy means that the text, in this case the bible, is accurate, truthful, and totally free of error in its original autographs or writings.
If the original autographs or writings were inerrant, we must answer the question how is it the case? It is because of what is known as the doctrine of inspiration. Paul in the above passage asserts that all of the Old Testament writings were breathed out by God. In some fashion unknown to us, God “breathed” his words into the various writers who then wrote the very words of God.
Inspiration has been under attack since shortly after the individual books of the bible were written. Since mankind as a whole refuses to be placed under the authority of God’s word contained in the bible, mankind has sought to destroy, dilute, defuse, and to discount the fact that these various men could have written within the scope of their own personality the very words of God. Various theories have been developed to destroy this very precious doctrine of inspiration.
An example of this is the ridiculous assertion that Matthew, and Luke had to have another document, in addition to Mark from which to copy when they wrote their respective gospels. The theory was developed that a document which no longer exists must have existed in order to provide the material that they would need to complete their gospels.
Q is the term given to the second source supposedly used by Matthew and Luke in addition to their copy of Mark. The siglum, a symbol used to denote a manuscript, “Q” derives from the German word "Quelle," which means "Source." It is thought that Q is a written collection of various oral sayings and teachings supposedly used by Matthew and Luke. It is thought that in order to have written their gospels they had to copy from Mark and a second source, a “mysterious document” called Q.
The existence of Q has been challenged by many scholarly critics. I for one do not believe that first, it ever existed, and secondly that it was ever needed. There is neither doubt nor harm in thinking that both Matthew and Luke had a copy of Mark available to them while they were writing their gospels. However, I strenuously reject the idea that Matthew and Luke could not have written their gospels without copying from Mark and this mysterious source called Q.
Matthew and Luke, not to mention Mark all wrote under or by the inspiration of God. Luke states that he painstakingly researched his material. Luke was able to talk to many eye-witnesses including Mary the mother of Jesus. Matthew recorded information from a first hand, eye-witness perspective. After all, he was present throughout the ministry of Jesus, beginning with the baptism of Jesus all the way to the resurrection. The events or teaching that Matthew and Luke were not privy to was given to them by the Holy Spirit through the doctrine of inspiration.