Average Calculator
In colloquial language, an average is a single number taken as representative of a list of numbers. Different concepts of average are used in different contexts.
Averages are different ways to summarize a set of numbers depending on what you want to emphasize. The most common ones are arithmetic, geometric, harmonic, and a few others used in specific contexts. In statistics, mean, median, and mode are all known as measures of central tendency, and in colloquial usage any of these might be called an average value.
Try our online AVERAGE CALCULATOR!
Most used average formulations
1. Arithmetic Mean (most common “average”)
Formula: (x[0] + x[1] + ... + x[n-1]) / n
Use when: No0rmal averaging (scores, temperatures, etc.)
public static double ArithmeticMean(IEnumerable<double> values)
{
return values.Average();
}
2. Geometric Mean
Formula: nth sqrt(x[0] ⋅ x[1] ⋅ ... ⋅ x[n-1])
Use when:
• Growth rates
• Percent changes
• Multiplicative processes
Requires all values > 0
public static double GeometricMean(IEnumerable<double> values)
{
double product = 1.0;
int count = 0;
foreach (var v in values)
{
if (v <= 0)
throw new ArgumentException("All values must be > 0 for geometric mean.");
product *= v;
count++;
}
return Math.Pow(product, 1.0 / count);
}
3. Harmonic Mean
Formula: n / ∑(1 / x[i])
Use when:
• Rates (speed, efficiency, cost per unit)
• Averaging ratios
public static double HarmonicMean(IEnumerable<double> values)
{
double sum = 0.0;
int count = 0;
foreach (var v in values)
{
if (v == 0)
throw new ArgumentException("Values cannot be zero for harmonic mean.");
sum += 1.0 / v;
count++;
}
return count / sum;
}
4. Weighted Mean
Formula: ∑(x[i] ⋅ w[i]) / ∑(x[i])
Use when: Some values matter more than others (grades, financial models)
public static double WeightedMean(double[] values, double[] weights)
{
if (values.Length != weights.Length)
throw new ArgumentException("Arrays must have same length.");
double sum = 0.0;
double weightSum = 0.0;
for (int i = 0; i < values.Length; i++)
{
sum += values[i] * weights[i];
weightSum += weights[i];
}
return sum / weightSum;
}
5. Quadratic Mean (RMS)
Formula: sqrt((x[0]^2 + x[1]^2 + ... + x[n-1]^2) / n)
Use when:
• Signal processing
• Physics (effective voltage/current)
public static double RootMeanSquare(IEnumerable<double> values)
{
double sumSquares = 0.0;
int count = 0;
foreach (var v in values)
{
sumSquares += v * v;
count++;
}
return Math.Sqrt(sumSquares / count);
}