Analytic Hierarchy Process Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Enter a 4×4 pairwise comparison matrix using Saaty's 1-9 scale. The diagonal is fixed at 1.

Understanding the Analytic Hierarchy Process

The Analytic Hierarchy Process (AHP) is a decision-making framework developed by Thomas L. Saaty in the 1970s. It provides a structured technique for tackling complex decisions by breaking them into a hierarchy of more manageable sub-problems. At its core lies the idea of pairwise comparison. Decision makers compare criteria or alternatives two at a time, expressing how much more one is preferred over the other. These comparisons populate a reciprocal matrix from which a priority vector—a set of weights reflecting the relative importance of elements—is derived. Our calculator implements AHP for a single level of four criteria, allowing users to explore the method without external libraries or server-side code.

Each entry aij in the comparison matrix represents the judgment of criterion i relative to criterion j. If aij equals 3, criterion i is considered moderately more important than criterion j. The reciprocal property requires aji to equal 1aij, ensuring consistency of opposing comparisons. Diagonal entries are always one because a criterion is equally important as itself. Saaty proposed a nine-point scale: 1 indicates equal importance, 3 moderate importance, 5 strong importance, 7 very strong, 9 extreme, with 2,4,6,8 for intermediate judgments. The table below summarizes this scale.

IntensityDescription
1Equal importance
3Moderate importance
5Strong importance
7Very strong importance
9Extreme importance
2,4,6,8Intermediate values

Once the pairwise matrix is filled, we compute the priority vector. While the original AHP uses the principal eigenvector of the matrix, an efficient approximation is the geometric mean method. For each row i, we calculate the product of its entries and take the fourth root because there are four criteria:

wi=aij4

The weight vector is then normalized so that the weights sum to one:

pi=wiwi

Our script follows this approach because it balances accuracy with simplicity and runs entirely in the browser.

After obtaining the weights, we evaluate the consistency of the judgments. Perfectly rational comparisons would yield a matrix whose principal eigenvalue λmax equals the matrix size n. In reality, human judgments are imprecise, so this eigenvalue exceeds n. We compute it by multiplying the comparison matrix by the weight vector, dividing the resulting vector element-wise by the weights, and averaging:

λmax=1n(Aw)iwi

The consistency index is CI=λmax-nn-1, and the consistency ratio CR=CIRI, where RI is a random index representing the average inconsistency of a large set of random matrices. For n=4, RI=0.90. If CR is less than 0.1, judgments are generally considered acceptably consistent.

The algorithm implemented here mirrors these steps. It first parses the matrix from the input fields, ensuring all entries are positive. Next, it calculates each row's geometric mean and normalizes these values to produce the priority weights. To measure consistency, it forms the matrix-vector product and derives the eigenvalue along with CI and CR. Results are displayed in a table with four rows, one for each criterion, showing weights and the intermediate product (Aw)i. The calculator flags whether the consistency ratio falls below the conventional 0.1 threshold.

Why is consistency important? Suppose criterion A is strongly preferred to B, and B is strongly preferred to C. If a user also claims that C is strongly preferred to A, the comparisons are contradictory. AHP's consistency ratio quantifies the degree of such contradictions. High inconsistency suggests that the decision maker should revisit judgments. Conversely, a low ratio implies a coherent set of comparisons that can be trusted to guide decision making. Mathematically, the ratio compares the deviation from perfect consistency to a benchmark derived from random matrices, making it a dimensionless measure.

AHP's strength lies in its versatility. It can incorporate tangible and intangible factors, merge group judgments, and extend to multiple hierarchical levels where criteria are subdivided into subcriteria. Although our calculator focuses on a single tier of four criteria, the same principles apply when expanding the hierarchy. At each level, pairwise comparisons yield weights that synthesize into overall scores. The method has been applied to fields ranging from engineering design and resource allocation to healthcare prioritization and environmental management.

The pairwise comparison matrix also allows for sensitivity analysis. Changing one judgment will shift the priority weights and may affect the ranking of alternatives. By experimenting with the input values, users can see how robust their decisions are. In addition, the geometric mean method used here is one of several weighting techniques. Others include the eigenvector method, which solves the equation Aw=λmaxw, and the logarithmic least squares method. For small matrices the differences are minor, but in large, inconsistent matrices the choice of method can influence the results.

Because this calculator runs entirely in the browser, it is ideal for educational use or quick analyses. No data leaves your computer, and there are no external dependencies. Students can study how weights change as they edit the matrix, developing intuition about proportional reasoning and the implications of inconsistency. Decision analysts can employ the tool as a lightweight sanity check before deploying more comprehensive software. By reading through the extended explanation here and experimenting with the form, users gain an appreciation of both the strengths and limitations of AHP.

To illustrate the process, imagine evaluating four potential suppliers based on cost, quality, reliability, and responsiveness. After entering pairwise comparisons reflecting your preferences, the calculator might produce weights such as 0.4 for cost, 0.3 for quality, 0.2 for reliability, and 0.1 for responsiveness. If the consistency ratio is below 0.1, the judgments are consistent enough to proceed. You could then rate each supplier according to these criteria and compute weighted scores to choose the best partner.

In conclusion, the Analytic Hierarchy Process converts subjective assessments into quantitative priorities while checking for logical coherence. Its foundation in linear algebra and matrix theory provides a rigorous basis, yet it remains accessible through simple calculations. This web-based calculator demystifies the method by letting users manipulate the comparison matrix directly and see how weights and consistency emerge from their own judgments.

Related Calculators

Hilbert Transform Calculator - Analytic Signal Explorer

Compute the discrete Hilbert transform of a sequence to build an analytic signal and study amplitude and phase.

hilbert transform calculator analytic signal instantaneous phase

Penrose Process Energy Extraction Calculator

Estimate the maximal energy obtainable from a rotating black hole via the Penrose process.

Penrose process calculator Kerr black hole energy ergosphere

Polytropic Process Calculator

Solve gas relationships and work for a polytropic process using initial state, final volume, and polytropic exponent.

polytropic process calculator thermodynamics gas work