AMMs rely on mathematical formulas to determine prices. For example, Uniswap uses the constant product formula:x⋅y=k
where:
(x) and (y) represent the quantities of two tokens in the liquidity pool.
(k) is a constant.
When a trade occurs, the product of the token quantities remains constant.
The price of one token in terms of the other can be calculated from this equation.