Geometric Mean Calculator

Enter two non-negative numbers a and b. The calculator computes the geometric mean G = √(a·b). 4 and 9 give 6, 2 and 8 give 4, and 1 and 1 give 1. For positive a, b one always has G ≤ AM (AM–GM inequality). This is not an n-value list mean, not an average percent return, and not a geometric sequence.

Input

Result

Enter non-negative a and b.

Domain: a ≥ 0, b ≥ 0. A negative factor returns an error. Zero is allowed (G = 0). The panel compares G with AM and shows the product plus an exp/ln check when a, b > 0.

How it works

How √(4·9) is computed
a4
b9
√(a·b)6

The geometric mean of two non-negative numbers a and b is the square root of their product: G = √(a·b). For a = 4 and b = 9 you get √36 = 6. For 2 and 8 — √16 = 4. For 1 and 1 — 1. This is not the arithmetic mean (a+b)/2: the same 4 and 9 give AM = 6.5, while G = 6.

The domain in this calculator is a ≥ 0 and b ≥ 0. Classical AM–GM is stated for positive numbers; zero is allowed here as a limiting case (then G = 0). A negative factor has no classical real geometric mean in this model — the result is an error message, not a blank field and not a misleading zero.

The calculator uses the numbers you enter in the fields a (srednia-geometryczna-dwoch-a) and b (srednia-geometryczna-dwoch-b). It computes √(a·b), and when a > 0 and b > 0 it also shows the check exp((ln a + ln b)/2). The panel reports the product, AM, the gap AM − G, and the ratio G/AM. A bar diagram compares G with AM. Comma and period are equivalent.

The AM–GM inequality for two positives: (a+b)/2 ≥ √(a·b), with equality only when a = b. An elementary proof: (√a − √b)² ≥ 0 ⇒ a + b ≥ 2√(ab). Hardy–Littlewood–Pólya (Inequalities) and MathWorld (Geometric Mean) give the same definition and the extension to n factors.

The neighboring harmonic mean computes H = 2ab/(a+b) and satisfies H ≤ G ≤ AM. The arithmetic mean of a list lives on a separate page. Here there are exactly two fields and the square root of the product — no weights and no nth root of many factors.

Formula

G = √(a · b) for a ≥ 0, b ≥ 0.

For a > 0 and b > 0: G = exp((ln a + ln b) / 2).

AM–GM: (a + b) / 2 ≥ √(a · b), equality ⇔ a = b (when a, b > 0).

Symbols: a, b — fields srednia-geometryczna-dwoch-a / -b; G — geometric mean. Mathematical model: geometric mean of two numbers + AM–GM inequality (Hardy–Littlewood–Pólya / Cauchy).

Theory, AM–GM, and domain

Definition

The geometric mean of two non-negative numbers a and b, written G(a, b) or √(a·b), is the square root of their product. Equivalently, for a > 0 and b > 0, G = exp((ln a + ln b)/2) — the arithmetic mean of the logarithms mapped back by the exponential. The calculator computes √(a·b) and, for positive factors, shows the logarithmic check.

The definition is standard in inequality analysis (Hardy, Littlewood, Pólya, Inequalities, Cambridge University Press) and on MathWorld (Geometric Mean). The extension to n positive numbers is G = (x₁·…·xₙ)^(1/n). This page handles only n = 2.

A geometric reading: √(a·b) is the side of a square whose area equals that of a rectangle with sides a and b (geometric-mean theorem / similarity). In finance the same form appears for an average growth factor: if capital is multiplied by r₁ and r₂, the mean factor is √(r₁ r₂).

Historical and conceptual context

The geometric mean was known in Greek geometry (mean proportional of segments). Cauchy’s Cours d'analyse (1821) relates means; the modern AM–GM statement with equality at equal summands was cemented in Hardy–Littlewood–Pólya (1934/1952). Bullen (Handbook of Means and Their Inequalities, Springer, 2003) organizes the power-mean family, where the geometric mean is the limit case of exponent 0.

Conceptually G measures a multiplicative center of scale, not an additive shift. That is why it fits growth rates, indices, and ratios, and not raw temperatures on a scale with an arbitrary zero. The arithmetic mean stays appropriate for sums and shifts; the harmonic mean fits speeds in the equal-leg model 2ab/(a+b).

This calculator does not replace multi-period CAGR or a Fisher index; it shows only G of two non-negative numbers and the AM comparison on the same pair. For classroom checks, recomputing √(a·b) by hand on the worked examples (4 and 9 → 6; 2 and 8 → 4) confirms that the live panel matches the definition exactly.

Formal properties

Calculator domain: a ≥ 0, b ≥ 0. Codomain: [0, ∞). Commutativity: G(a, b) = G(b, a). Homogeneity: G(λa, λb) = λ G(a, b) for λ ≥ 0. If a = b, then G = a.

AM–GM inequality: for a, b > 0 one has (a+b)/2 ≥ √(a·b), with equality ⇔ a = b. Together with the harmonic mean: H ≤ G ≤ AM for a, b > 0, where H = 2ab/(a+b).

Logarithm link: ln G = (ln a + ln b)/2 when a, b > 0. So G is the arithmetic mean on the log scale, mapped back by exp.

Monotonicity: for fixed b > 0 the map a ↦ √(a b) increases on [0, ∞).

Full derivation

Step 1 (definition). Take G² = a·b with G ≥ 0, hence G = √(a·b) on a, b ≥ 0.

Step 2 (AM–GM). Let a, b > 0. Then (√a − √b)² ≥ 0 ⇒ a − 2√(ab) + b ≥ 0 ⇒ (a+b)/2 ≥ √(ab).

Step 3 (equality). (√a − √b)² = 0 ⇔ √a = √b ⇔ a = b (non-negative roots).

Step 4 (exp/ln form). For a, b > 0: ln(a·b) = ln a + ln b, so √(a·b) = exp(½ ln(a·b)) = exp((ln a + ln b)/2).

Step 5 (computation). √(a·b) in floating-point arithmetic; if a = 0 or b = 0 the result is 0. Negative a or b are rejected before the square root so the user is not confused by NaN or by a positive √ from a both-negative pair.

Special cases

Examples: G(4, 9) = 6; G(2, 8) = 4; G(1, 1) = 1; G(0, 9) = 0; G(4.5, 4.5) = 4.5; G(1, 4) = 2; G(16, 25) = 20. The pair (−4, 9) → domain error.

When a = b, the AM and G bars have the same height. When one factor tends to 0 with the other fixed, G tends to 0 faster than AM.

This page does not compute ⁿ√(x₁…xₙ) for n ≠ 2 and does not compute a weighted geometric mean with exponent weights.

Numerical notes

The product a·b can overflow the floating-point range for extreme inputs; then the result is out of range. For a, b > 0 the form exp((ln a + ln b)/2) can be gentler for very large or very small factors — the panel compares both forms when they are finite.

Comma and period are equivalent. The calculator does not return a complex mean or the square root of a negative product.

Educational result: matches √ in the browser, not a CAS that simplifies √(4·9) symbolically to 6 before floating point — here 6 comes out exactly.

Related notions and sources

Related: arithmetic mean, harmonic mean, AM–GM inequality, CAGR / mean growth factor, power means (Bullen). Neighboring calculators: arithmetic mean of a list, harmonic mean of two numbers, weighted mean.

Sources: Hardy, Littlewood, Pólya — Inequalities (CUP); Bullen — Handbook of Means and Their Inequalities (Springer, 2003); MathWorld — Geometric Mean; Wikipedia — Geometric mean. Educational tool.

How to use

  1. Enter a, for example 4.
  2. Enter b, for example 9.
  3. Click Calculate or wait for the live result. 4 and 9 give 6. 2 and 8 give 4. 1 and 1 give 1.
  4. Check the panel: product, AM, AM − G, G/AM, the exp/ln check, and the bar diagram.
  5. 0 and 9 give 0. −4 and 9 give an error. A list mean lives on the arithmetic-mean page; H = 2ab/(a+b) on the harmonic-mean page.

Symbol glossary

G = √(a·b). 4 and 9 give 6. For a, b > 0 one always has G ≤ AM.

G
Geometric mean √(a·b). 4 and 9 give 6. 2 and 8 give 4.
a, b
Factors in fields srednia-geometryczna-dwoch-a and -b. Require a ≥ 0, b ≥ 0.
AM
(a+b)/2. For 4 and 9 it is 6.5. AM − G ≥ 0 when a, b ≥ 0.
AM–GM
Inequality (a+b)/2 ≥ √(a·b) for a, b > 0; equality when a = b.

Examples

Example 1

  • a = 4
  • b = 9

6

What is the geometric mean of 4 and 9? 6.

Example 2

  • a = 2
  • b = 8

4

What do 2 and 8 give? √16 = 4.

Example 3

  • a = 1
  • b = 1

1

What if a = b = 1? G = AM = 1.

Example 4

  • a = 0
  • b = 9

0

Do 0 and 9 give 0? Yes; AM = 4.5.

Example 5

  • a = 4.5
  • b = 4.5

4.5

What if a = b = 4.5? G = 4.5.

Example 6

  • a = 1
  • b = 4

2

What do 1 and 4 give? √4 = 2.

Example 7

  • a = 16
  • b = 25

20

What is the mean of 16 and 25? 20.

Example 8

  • a = −4
  • b = 9

error

What if a = −4? Error — outside the domain.

Related calculators

Common questions

What is the domain of the two-number geometric mean?

The calculator requires a ≥ 0 and b ≥ 0. Classical AM–GM is stated for a, b > 0; zero is allowed here as a limiting case (G = 0). A negative factor returns an error, not a blank field and not zero.

What is the geometric mean of 4 and 9?

The result is 6, because √(4·9) = √36 = 6. That is the first example on this page and the same result after “Fill this example”. The arithmetic mean of the same numbers is 6.5.

What do 2 and 8, and 1 and 1, give?

2 and 8 give √16 = 4. 1 and 1 give √1 = 1. When a = b, equality G = AM holds.

What if one factor is negative?

The real model does not define the classical geometric mean for negative a or b. The calculator reports an error instead of √ of a negative product or a misleading zero.

Do 0 and 9 give 0?

Yes. The product is 0, so √0 = 0. The arithmetic mean is still 4.5 — the panel also shows AM and the gap AM − G.

How does this differ from the arithmetic mean?

The arithmetic mean is (a+b)/2. The geometric mean is √(a·b). For positive a, b one always has G ≤ AM, with equality only when a = b (AM–GM inequality).

How does this differ from the harmonic mean?

The harmonic mean of two positives is H = 2ab/(a+b). One has H ≤ G ≤ AM. This page computes only G = √(a·b); the harmonic mean lives on the neighboring calculator.

Does the order of a and b change the result?

No. Multiplication is commutative, so 4 and 9 and 9 and 4 both give 6.

How is G written with logarithms?

For a > 0 and b > 0, G = exp((ln a + ln b)/2). The panel shows that check beside √(a·b). With a zero the log form does not exist.

Do the currency and unit settings in the page header affect the result?

No. The result depends only on a and b. The currency and unit settings in the page header do not affect this result.

Does a comma in 4.5 work?

Yes. 4,5 and 4.5 are the same number. The pair 4.5 and 4.5 gives G = 4.5.

Where is a list mean or a weighted mean?

The arithmetic mean over many fields is on a separate page. The weighted mean is next door. Here there are exactly two factors and the square root of their product.

How do I calculate the geometric mean of two numbers?

Multiply a by b and take the square root: G = √(a·b). For 4 and 9: √36 = 6. The calculator requires a ≥ 0 and b ≥ 0.

What is the geometric mean of 16 and 25?

√(16·25) = √400 = 20. The arithmetic mean of the same numbers is 20.5 — the panel also shows AM − G.

Is this the geometric mean of many numbers (n > 2)?

No. Here there are exactly two factors and the square root of their product. For n values the formula uses an n-th root — this page does not compute that.

Is this an average percent return or growth-rate calculator?

No. You enter two non-negative numbers a and b, not a list of percent rates or growth factors. The result is √(a·b), with no percent-to-multiplier conversion.

How does the geometric mean differ from a geometric sequence?

The mean is a single number √(a·b). A geometric sequence is a list with a fixed common ratio. This card does not build a sequence or find an n-th term.

The result is G = √(a·b): for a = 4 and b = 9 it is 6. AM equals 6.5. The harmonic mean H = 2ab/(a+b) lives on the harmonic-mean page.

Knowledge sources

The definition, AM–GM, and log form below come from recognized sources.

Page updated November 3, 2026.