Al-qiyās therefore refers exclusively to the use of one thing to make a judgment about something else, and its root verb qāsa yaqīsu is used in this same sense. Mere likeness between two things is not analogy; qiyās is not said unless the two are correlated such that a judgment incumbent upon one is applied to the other. In this sense, God (be He exalted) might well be called al-Qāyis ["The Analogist"], for the likeness He enforces between the unbelieving and the dead (35:22), the believer and the living (36:70), unbelief and darkness (6:122) and belief and light (61:8).
Whoever defines analogy as "the abstraction of what is true from what is invalid" is way off. This may define something, but it can't be called analogy. Here is an example of analogy: "If a good person is susceptible to committing an offense that a wise man is not, then the good person is liable to a penalty that the wise man is not." In the parlance of legal scholars, it is to hold a "branch" [i.e. the case under consideration] against a "root" [a precedent case whose judgment is secure] in order that the rationale of the latter ruling be applied to the former.
The original meaning of ijtihād is "utmost exertion." One can be said to "exert one's utmost" in carrying a stone, but in carrying a date pit there is no exertion. Theologians define it as the process that determines the preponderance of one opinion [above all others] in matters that call for judgment, such that all who practice it will reach the same conclusion. And their reference to statements by "the people of qiyās" and "the people of ijtihād" proves that these methods are not the same. Analogy is more specialized than ijtihād, which includes analogy and other methods besides. [Even so,] al-Shāfi‘ī says that ijtihād and analogy are the same thing; according to his definition, al-ijtihād means applying the rationale of legal precedent to the exclusion of all else. Legal scholars define it as exerting one's utmost in figuring out how the law applies to a given situation, in a way that is neither obvious nor coeval with the law's original intent.
This is what Mu‘ādh [ibn Jabal] meant by saying: "I will exert my utmost to reach an opinion [ajtahidu ra’yī] in those cases wherein I find no answer in the Qur'ān nor sunna." "Opinion" [al-ra’ī] here is the outcome of deduction and analogy applied toward legal judgment. ‘Umar [ibn al-Khaṭṭāb once reprimanded a scribe who concluded a legal brief with the words: "This is the opinion of God and ‘Umar." Seizing the document, he crossed them out and] wrote: "This is the opinion of 'Umar." And ‘Alī, peace be upon him, once said: "My opinion and the opinion of 'Umar is that [slave women who have borne children to their masters] must not be sold." Those who denigrate opinion are refuted by these statements, which uphold the validity of rulings based on rationale and report, when these have been tested against an opposing view.
Ijtihād is said only for reasoning applied to legal matters. [...] The study of physics cannot be spoken of as a form of ijtihād in the way that ijtihād is applied to inheritance law. Nor is ijtihād applicable to calculations like the ratio of five dirhams to a hundred dirhams, on which there is no difference of opinion. Qiyās, on the other hand, is applicable to a variety of intellectual pursuits. The difference between them is therefore clear.
Abū Hilāl al-‘Askarī, The Book of Lexical Distinctions