Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesiTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
The constant product formula is x × y = k. In a basic two-token automated market maker (AMM), x and y are the pool’s token reserves, and k is their product. When a trade changes the reserves, it also changes their ratio—and therefore the pool’s implied exchange price.
What do x, y, and k represent?
In a two-token pool, x is the reserve quantity of one token and y is the reserve quantity of the other. The value k is the product of those balances, not a token price. For example, if a simplified pool holds 100 units of one token and 200 units of another, its reserve product is 20,000. The units belong to different tokens, so that product is a mathematical invariant—not a standalone currency amount.
The formula describes a curve of reserve combinations that the pool can trade along. In the basic no-fee model, a trade moves the pool from one point on that curve to another while keeping the product unchanged. The equation is the defining shorthand for this basic constant-product model, not a formula that applies to every AMM design. For an academic discussion of constant-product market makers and related variants, see About constant-product automated market makers.
How does the formula determine a pool’s price?
The reserve ratio implies the pool’s spot exchange rate. If a pool has reserves x and y, its marginal price is based on how much of one token the pool holds relative to the other. Uniswap describes this as algorithmic pricing from reserves in its developer documentation.
#1 Best Overall
That spot price is not necessarily the price a trader receives for an entire swap. A finite trade moves the reserves along the curve, so the ratio changes while the trade is being executed. The trader’s average execution price reflects that movement as well as any fee charged by the implementation.
What happens during a swap?
Suppose a trader adds Δx units of token x and receives Δy units of token y. In the simplified zero-fee model, the post-trade reserve product equals the starting product:
(x + Δx)(y − Δy) = xy
Solving for the amount of y paid out gives:
Δy = yΔx / (x + Δx)
This relationship shows why the output per additional unit of input falls as the trade grows: the pool has progressively less y relative to x. A larger trade compared with the pool’s depth therefore causes more price impact than a smaller trade. The impact is nonlinear; it is not simply proportional to trade size.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThis equation is a conceptual, zero-fee derivation. A real swap quote also depends on the pool’s fee, integer precision, and configuration.
Rank #3
Does k stay exactly constant after every trade?
Only in the simplified no-fee derivation is the reserve product unchanged. Uniswap’s documentation says k must stay constant or increase after a trade; when fees remain in the pool, the measured reserve product can increase. So “constant product” names the model’s invariant relationship, but it should not be read as a guarantee that reserve balances multiplied together will be numerically identical after every fee-bearing trade.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Does this formula describe every AMM?
No. It describes the basic two-reserve constant-product model. AMMs can use other invariants or distribute liquidity differently across prices, so the equation is not a universal description of decentralized exchanges.
There is also version-specific context for Uniswap: its documentation describes v3 and v4 liquidity as concentrated within a liquidity provider’s chosen price range. In those versions, do not assume that every position behaves like an unrestricted pool funded uniformly across all prices. The Uniswap V3 Development Book’s explanation of constant-function market makers provides additional background on the model.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

