Calculate Contraharmonic Mean
Online calculator to calculate the contraharmonic mean of a data series
Contraharmonic Mean Calculator
Contraharmonic Mean
The contraharmonic mean is the ratio of sum of squares to sum of values. It is complementary to the harmonic mean and greater than the arithmetic mean.
Contraharmonic Mean Concept
                                    
                                    The contraharmonic mean is the ratio of sum of squares to sum.
                                    
                                    It favors larger values more strongly than the arithmetic mean.
                                
■ Input Values ■ Squares ■ Contraharmonic Mean
What is the Contraharmonic Mean?
The contraharmonic mean is a less-known but important measure of position:
- Definition: Sum of squares divided by sum of values
- Calculation: C = Σ(xᵢ²) / Σ(xᵢ)
- Complementary: To harmonic mean H: H · C = A²
- Property: Always ≥ arithmetic mean
- Application: Signal processing, image processing, statistics
- Weighting: Strongly favors larger values
Calculating the Contraharmonic Mean
Calculation is done in four steps:
1. Square
                                        Form squares:
                                        x₁², x₂², ..., xₙ²
                                    
2. Sum Squares
                                        Sum of squares:
                                        S₂ = Σ(xᵢ²)
                                    
3. Sum Values
                                        Sum of values:
                                        S₁ = Σ(xᵢ)
                                    
4. Divide
                                        Divide S₂ by S₁:
                                        C = S₂ / S₁
                                    
Applications of Contraharmonic Mean
The contraharmonic mean finds application in specialized fields:
Signal Processing
- Noise suppression (pepper noise)
- Image smoothing and filtering
- Contrast enhancement
- Edge detection
Statistics and Mathematics
- Estimation theory (robust against small values)
- Averaging for skewed distributions
- Complementary consideration to harmonic mean
- Lehénian means (special case for r=1)
Formulas for Contraharmonic Mean
Contraharmonic Mean
Sum of squares divided by sum of values
Explicit Form
Explicit representation without sum notation
Relationship to Other Means
Harmonic · Contraharmonic = Arithmetic²
For Two Values
Simplified form for two values
Symbol Explanations
| \(C\) | Contraharmonic mean | 
| \(x_i\) | Individual data value | 
| \(n\) | Number of values | 
| \(\sum\) | Sum sign | 
| \(H, A, G\) | Harmonic, Arithmetic, Geometric | 
| \(x_i^2\) | Square of xᵢ | 
Example Calculations for Contraharmonic Mean
Example 1: Basic Calculation
Calculate: Contraharmonic mean of 5 values
1. Form Squares
Square all values
2. Form Sums
Sum of squares and sum of values
3. Calculate Mean
Divide sum of squares by sum
Example 2: Comparison of Means
Compare: All classical means
Harmonic
Smallest mean
Geometric
Second smallest
Arithmetic
Second largest
Contraharmonic
Largest mean
Important Order
                                            H ≤ G ≤ A ≤ C: The contraharmonic mean (6.27) is the largest,
                                            followed by arithmetic (3.67), geometric (2.52), and harmonic (1.68) is the smallest.
                                            Relationship: H · C = A² → 1.68 · 6.27 ≈ 10.5 ≈ 3.67² ≈ 13.5 (approximately, due to rounding)
                                            Observation: The contraharmonic mean is strongly influenced by the largest value (8).
                                        
Example 3: Image Processing (Pepper Noise)
One black pixel (0) = pepper noise in bright area
Arithmetic Mean
Problem: The outlier (0) pulls the mean strongly downward.
Contraharmonic Mean
Advantage: Robust against small values (pepper noise). Result closer to actual pixel values.
Application in Image Processing
The contraharmonic mean is used in image processing as a contraharmonic mean filter. It is particularly effective against pepper noise (black pixels in bright areas) because it suppresses small values and favors larger values. This leads to better results than the arithmetic mean, which is strongly influenced by outliers.
Mathematical Foundations of Contraharmonic Mean
The contraharmonic mean is an important measure of position with special properties, which is significant in signal processing and statistical estimation theory.
Properties of Contraharmonic Mean
The contraharmonic mean has characteristic mathematical properties:
- Inequality: C ≥ A ≥ G ≥ H (largest of classical means)
- Complementary: H · C = A² (product of harmonic and contraharmonic = square of arithmetic)
- Weighting: Strongly favors larger values, suppresses small values
- Square-Based: Uses squares of values in numerator
- Lehénian Means: Special case for r = 1: M₁ = C
Relationship to Other Means
Complementarity to Harmonic Mean
                                        The most important relationship is: H · C = A²
                                        The contraharmonic mean is complementary to the harmonic mean.
                                        If H is small (dominated by small values), C is large (dominated by large values).
                                    
Order of Means
                                        H ≤ G ≤ A ≤ C
                                        The contraharmonic mean is always the largest. Equality holds only when all values are identical.
                                        The difference increases with greater dispersion.
                                    
Application in Image Processing
Contraharmonic Mean Filter
The contraharmonic mean filter is a nonlinear filter for noise suppression:
- Pepper Noise: Black pixels (small values) → C favors large values and suppresses pepper noise
- Salt Noise: White pixels (large values) → Harmonic mean is better (favors small values)
- Parameter Q: Extended form with exponent Q: C_Q = Σ(x^(Q+1)) / Σ(x^Q)
- Q > 0: Eliminates pepper noise; Q < 0: Eliminates salt noise; Q = 0: Arithmetic mean
Generalization: Lehénian Means
Definition
The contraharmonic mean is a special case of Lehénian means (Power means): M_r = (Σx^(r+1) / Σx^r)^(1/1) for r = 1
Other Special Cases
- r = -1: Harmonic mean
- r = 0: Geometric mean (limit)
- r = 1: Contraharmonic mean
- r → ∞: Maximum
Practical Considerations
When to Use Contraharmonic?
- Pepper Noise: Eliminate black pixels in images
- Small Outliers: Robustness against small values
- Large Values Important: When larger values should have more weight
- Complementary Analysis: Together with harmonic mean
Be Careful With
- Large Outliers: C is strongly influenced by large values
- Salt Noise: For white pixels, harmonic mean is better
- Zero Values: Zero in denominator possible if all values are zero
- Interpretation: Less intuitive than arithmetic mean
Summary
The contraharmonic mean is a specialized measure of position that strongly favors larger values and suppresses small values. It is complementary to the harmonic mean with the relationship H · C = A². Its main application is in image processing for elimination of pepper noise (black pixels). As part of Lehénian means, it offers together with the harmonic mean a complete view of data distribution. While the harmonic mean emphasizes small values, the contraharmonic mean highlights large values – this complementarity makes both means together very valuable for robust data analysis.
|  |