# The mathematics of every AMM family, compared

> Canonical: https://blazephoenix.xyz/learn/amm-math-taxonomy
> License: CC BY 4.0 (attribution + link) · © 2026 BlazePhoenix
> Updated: 2026-07-29

Constant product, concentrated liquidity and the stable invariants are three geometries, not three implementations of one idea: closed-form and honest, closed-form only inside a band and able to over-promise beyond it, and no closed form at all. Their depth figures are not even the same unit.

An automated market maker replaces the order book with a curve. Every design in production is a choice of curve, and that choice determines three things at once: the output you receive for a given input, how depth should be measured, and where the design fails. Treating the families as interchangeable is the most common source of integration error, because the arithmetic genuinely differs.

## Family one: constant product

The oldest and simplest: the product of the two reserves is held constant across a swap. Its output function is closed-form and needs only the two reserve balances, which makes it cheap to quote and impossible to get subtly wrong. Fee is applied to the input before the curve is walked.

Its properties follow directly. Liquidity is spread over every price from zero to infinity, so it never runs out but is thin everywhere; depth is naturally measured by the smaller reserve; and price impact is a smooth, convex function of size with no discontinuities. Nothing about it can lie to you — the reserves are the state, and the state is the price.

> equation: out = (Δin · f · R_out) / (R_in + Δin · f), f = 1 − fee — Constant-product exact output. Two reserves and a fee are the entire model; no other state exists.

## Family two: concentrated liquidity

Providers place liquidity inside a chosen price band rather than across the whole curve. Within a band, the pool behaves like a constant-product pool with a much larger virtual reserve — the same capital, deeper where it matters. State is a square-root price and an active liquidity figure, and the swap walks the price along that curve.

This is where the arithmetic becomes dangerous, and the danger is specific. The single-band formula models the CURRENT liquidity as though it extended across every price. It does not. When the swap is large enough to leave the band, real execution crosses into ranges where liquidity may be far thinner or absent, while the single-band formula happily quotes a number that assumes the deep band continues forever.

The consequence is that a concentrated pool can quote an output larger than the entire balance it holds — a promise it is physically unable to keep. The correct treatment is therefore twofold: bound any single-band quote by what the pool actually holds, and, when precision matters, obtain the number from the pool's own execution path rather than from a re-implementation of its tick mathematics.

> equation: zeroForOne: √P' = (L·√P) / (L + Δin·√P/Q96), out = L·(√P − √P')/Q96 — Concentrated-liquidity single-band step in square-root price space. Valid only while the swap stays inside the active band.

## Family three: the stable invariants

For assets that should trade near parity, the constant-product curve wastes capital: it charges meaningful impact for a trade between two things worth the same. The stable families replace it with a curve that is nearly flat near the balance point and steepens sharply away from it, concentrating depth exactly where the assets are supposed to sit.

Two shapes dominate. One blends a constant-sum and a constant-product term with an amplification coefficient controlling the flatness. The other uses a quartic invariant. Both share a defining property: neither has a clean closed-form solution for the output, so the answer must be found by iteration — and the iteration is where implementations diverge from each other and from the pool itself.

A naive iteration seeded at the wrong starting point converges to a subtly wrong answer on lopsided pools, silently. There are two defensible responses: solve properly, seeding the iteration where convergence is provable and clamping the step so it cannot overshoot; or do not solve at all and ask the pool for its own number, since the code that computes it is the code that will settle the trade.

## Depth is not one quantity

This is the practical trap that survives every correct output formula. Each family reports "depth" in a unit that is not comparable with the others: constant-product reports reserve balances, concentrated liquidity reports a liquidity constant that is not denominated in tokens at all, and pool-quoted families report an output figure. These are different dimensions.

Any allocator that ranks candidates by comparing these numbers directly is comparing apples with square roots of oranges — and it will systematically over-allocate to whichever family happens to produce the largest raw figure. The only measure comparable across all families is the one that requires capital to fake: the real token balance the pool holds, read from the chain.

## Why one formula cannot serve them all

Summarised as a table you can act on: constant product is closed-form and honest; concentrated liquidity is closed-form only inside a band and can over-promise beyond it; stable invariants have no closed form and must be iterated or asked. The fee model differs too — some charge a fixed fraction, some read a dynamic fee that changes with conditions, and using a stale fee produces a quote the pool will reject outright.

The engineering conclusion is not that one family is better. It is that a system quoting across all of them needs a dispatcher: closed-form mathematics where the formula IS the truth, bounded by real holdings where the formula can over-promise, and ask-the-pool where re-implementing the curve would risk diverging from the code that settles. Anything simpler is a bug waiting for the right pool.

**Verify it yourself:** Take one pool from each family, quote the same size against all three with a single generic formula, then compare each answer against the pool's own quoting function — the divergence is not noise, it is the family difference this article describes

Related: https://blazephoenix.xyz/learn/the-mathematics · https://blazephoenix.xyz/learn/eightfold-dispatcher · https://blazephoenix.xyz/learn/what-is-an-amm · https://blazephoenix.xyz/learn/capacity-clamp
