Weighted average

A weighted average is the average of values which are scaled by importance. The weighted average equals the sum of weights times values divided by the sum of the weights.
Simple case.
This collection of four integers is called a multiset because the integer appears more than once:
The straight average (or arithmetic mean) of these four variables is the sum divided by :
In the above equation, we used the overline to express the fact that this is the average over four variables. These variables can also be expressed using subscripts:
You get the same answer by calculating this as "weighted average" of three variables. But you need to include a weight-value of for the integer :
Here the hat formula_5 is used to mark weight values, which represent how many times each of the three values formula_6 appear. While it is not common to put hats over numbers in calculations, this formula_7 representation allows us to see how the weights influence the calculation. We can also write the weighted average as:
In conclusion, we have shown how an "arithmetic mean" over four variables (1,3,3,5) can be understood as a weighted average over only three variables (1,3,5). This is accomplished by multiplying the repeated variable by the number of times it is repeated (two).
Summation notation.
To understand how to express this using summation notation, we shall place a tilde formula_9 over variables that involve the weighted average. First we define:
Note that the sum of the three weights equals : 
The ordinary average (with four terms) equals the weighted average (with three terms):
Simplify this by replacing formula_13 with the sum over all the weights:
padding: 5px; border-width:2px; border-style: solid; border-color: black; background-color: white; text-align: center; display: table"&gt;
formula_14 
Application to exam scores.
Given two school classes, one with 20 students, and one with 30 students, the grades in each class on a test were:
The straight average for the morning class is 80 and the straight average of the afternoon class is 90. The straight average of 80 and 90 is 85, the mean of the two class means. But this does not account for the difference in number of students in each class, so the value of 85 does not reflect the average student grade (independent of class). The average student grade can be calculated by averaging all the grades, without regard to classes (add all the grades up and divide by the total number of students):
Or, this can be accomplished by weighting the class means by the number of students in each class (using a weighted mean of the class means):
Thus, the weighted mean makes it possible to find the average student grade in the case where only the class means and the number of students in each class are available.