Variance Calculator Between 2 Numbers
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This variance calculator works out the sample variance and population variance for exactly two numbers. You enter the two values, and it returns the variance, standard deviation, and the mean, so you can see how spread out the pair is. The tool uses the standard formulas for a two-point dataset, which are the same ones used in statistics textbooks and spreadsheet functions.
Formula
For a sample of two numbers, the sample variance (s²) is calculated as:
s² = [(x� − x̄)² + (x₂ − x̄)²] / (n − 1)
where x� and x₂ are your two numbers, x̄ is their mean (average), and n is the count of numbers (here n = 2). The population variance (σ²) uses the same numerator but divides by n instead of n − 1:
σ² = [(x� − x̄)² + (x₂ − x̄)²] / n
For two numbers, the mean is simply (x� + x₂) / 2. The standard deviation is the square root of the variance. All units are the same as the units of your input numbers — if your numbers are in meters, the variance is in square meters and the standard deviation is in meters.
Worked Example
Using the default values from the calculator above: first number = 5, second number = 9.
- Calculate the mean: x̄ = (5 + 9) / 2 = 14 / 2 = 7
- Subtract the mean from each number and square: (5 − 7)² = (−2)² = 4; (9 − 7)² = (2)² = 4
- Add the squared differences: 4 + 4 = 8
- Divide by (n − 1) for sample variance: 8 / (2 − 1) = 8
- Take the square root for sample standard deviation: √8 ≈ 2.8284
The calculator shows sample variance = 8.0000 and standard deviation = 2.8284, matching the steps above. If you used the population formula, you would divide by 2 instead, giving a variance of 4 and a standard deviation of 2.
When to Use Sample vs. Population Variance
The choice between sample and population variance depends on what your two numbers represent.
- Sample variance (divide by n − 1) is used when your two numbers are a sample drawn from a larger population. For example, if you measured the heights of two randomly selected plants from a field, you would use sample variance to estimate the variability of the whole field.
- Population variance (divide by n) is used when your two numbers are the entire group you care about. For instance, if you have exactly two test scores from a class of two students, that is the whole population, so you would use population variance.
For two numbers, the difference is large: sample variance is double the population variance. This is because dividing by 1 (n − 1) amplifies the result. Many spreadsheet functions like VAR.S (sample) and VAR.P (population) follow this same distinction.
How to Read the Result
The variance itself is in squared units, which can be hard to interpret directly. For example, if your two numbers are test scores out of 100, a sample variance of 8 means the squared deviation from the mean is 8 points². The standard deviation (√8 ≈ 2.83) is more intuitive: it tells you that the typical distance from the mean is about 2.83 points.
With only two numbers, the standard deviation is always exactly half the absolute difference between the two numbers. For 5 and 9, the difference is 4, half is 2, but the sample standard deviation is 2.83 because of the n − 1 correction. The population standard deviation would be exactly 2. This is a useful sanity check when using a calculator.
Common Mistakes and Limitations
- Using the wrong denominator: Mixing up sample and population formulas is the most frequent error. Always decide which one fits your data before calculating.
- Unit confusion: Variance is in squared units. If your numbers are in dollars, variance is in dollars², which has no practical meaning — that is why standard deviation is often preferred.
- Rounding too early: If you round the mean before subtracting, you can introduce small errors. Keep full precision until the final step.
- Interpreting with only two points: Variance from two numbers is extremely sensitive to each value. It tells you nothing about the shape of a distribution or whether the numbers are typical of anything larger. It is only a crude measure of spread for a pair.
Why Variance Matters with Just Two Numbers
Even with only two numbers, variance is used in many practical contexts. For example, comparing two measurements of the same object (like two lab readings) can give you a sense of measurement precision. In quality control, two consecutive product samples might be used to estimate process variability, though more points are usually preferred. In education, comparing two student scores can show the spread, but it is rarely statistically meaningful without more data.
The key takeaway is that variance between two numbers is a simple calculation, but its statistical power is limited. It is most useful as a quick check or as a building block for larger datasets. For any serious analysis, you would want at least 10–30 data points to get a stable estimate.
Alternatives to Variance for Two Numbers
If variance feels too abstract, there are simpler measures of spread for two numbers:
- Range: The absolute difference between the two numbers (e.g., |9 − 5| = 4). Easy to understand but ignores everything in between — which is fine when there is nothing in between.
- Mean absolute deviation: The average of the absolute deviations from the mean. For two numbers, it equals half the range (2 for 5 and 9). Less common but more interpretable than variance.
- Coefficient of variation: The standard deviation divided by the mean, expressed as a percentage. Useful when comparing spread across datasets with different means.
Each of these has its own strengths, but variance and standard deviation remain the standard in statistics because of their mathematical properties, such as being used in ANOVA and regression.
Frequently Asked Questions
What is the variance of 2 and 6?
Mean = (2+6)/2 = 4. Squared deviations: (2−4)² = 4, (6−4)² = 4. Sum = 8. Sample variance = 8/(2−1) = 8. Population variance = 8/2 = 4. Sample standard deviation = √8 ≈ 2.83, population standard deviation = 2.
Why is sample variance divided by n−1?
Dividing by n−1 (Bessel’s correction) makes the sample variance an unbiased estimator of the population variance. When you use a sample to estimate the spread of a larger group, dividing by n tends to underestimate the true variance, especially with small samples. For n=2, this correction is particularly dramatic because you divide by 1.
Can variance be negative?
No. Variance is the average of squared deviations, and squares are always zero or positive. If both numbers are identical, the variance is zero. A negative variance indicates an arithmetic error, such as subtracting the mean incorrectly or using the wrong formula.
How do I calculate variance in Excel for two numbers?
Use =VAR.S(A1:A2) for sample variance or =VAR.P(A1:A2) for population variance, where A1 and A2 contain your two numbers. Excel also has =STDEV.S and =STDEV.P for standard deviation. The results will match the formulas above.
What does a standard deviation of zero mean?
It means both numbers are identical — there is no spread. For example, if both numbers are 7, the mean is 7, all deviations are 0, and both variance and standard deviation are 0. This is the minimum possible value.
Is variance the same as standard deviation?
No. Variance is the average of squared deviations, while standard deviation is the square root of that value. Standard deviation is in the same units as the original data, making it easier to interpret. For two numbers, the sample standard deviation is √(variance).
Related
Formula used
in a | First number | - | 5 | 0 in b | Second number | - | 9 | 0 out var | Sample variance | - | ((a - (a+b)/2)^2 + (b - (a+b)/2)^2) / (2 - 1) | 4 out sd | Sample standard deviation | - | sqrt(((a - (a+b)/2)^2 + (b - (a+b)/2)^2) / (2 - 1)) | 4 out mean | Mean | - | (a + b) / 2 | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.