# How does the math work in jdecision?

Jdecision uses the Decision Matrix technique, sometimes called Grid Analysis or Pugh Matrix. In essence, considerations are weighted based on importance and opinions are scored across each consideration. Jdecision then uses a weighted average and shows the winner. Let's take the Which car should I buy? example. You start with some basic considerations and then specify how important each consideration is by assigning a weight between 0 and 5 with 5 being most important. You can see that Style is the most important factor in our decision.

Consideration Weight
Style 4
Gas mileage 3
Price 2

You then add some options such as BMW and Camry and score each option across the three considerations. You can specify how well the option satisfies the consideration by assigning a score between 0 and 5.

Consideration Camry Score BMW Score
Style 1 4
Gas mileage 3 3
Price 4 1

Jdecision multiplies the consideration weight by the option's score for that consideration.

Consideration Camry: weight*score BMW: weight*score
Style 4 * 1 = 4 4 * 4 = 16
Gas mileage 3 * 3 = 9 3 * 3 = 9
Price 2 * 4 = 8 2 * 1 = 2

Then add up the products for each option.

Consideration Camry: weight*score BMW: weight*score
Style 4 16
Gas mileage 9 9
Price 8 2
Total 21 27

The absolute scores 21 and 27 aren't very meaningful by themselves because we don't know the total possible score. To calculate the total possible score for either car, you multiply each consideration's weight by the highest possible score (5) and then add the products together. So the total possible score in this example is 45.

Consideration Weight Total possible score Product
Style 4 5 20
Gas mileage 3 5 15
Price 2 5 10
Total     45

To calculate an option's score as a percentage of its potential score, just take the score and divide it by it's highest possible score.

Option Score Total possible score % of it's potential
Camry 21 45 21/45 = 47%
BMW 27 45 27/45 = 60%

To get the score on a 0-5 star scale, we multiply the percentage by 5 stars to get the final score.

Option % of score potential Stars
Camry 47% 47% * 5 = 2.5 (rounded)
BMW 60% 60% * 5 = 3