The constant-product formula is the pricing rule used by many automated market makers, including Uniswap version 2. A liquidity pool holds two tokens, and any trade must leave the product of the two balances unchanged:
Here and are the pool's balances of the two tokens and is the constant. With 100 ETH and 200,000 USDC, and the spot price is 2,000 USDC per ETH. A trader adding 10,000 USDC, ignoring fees, raises to 210,000, so must fall to ETH. The trader receives 4.762 ETH, an average price of about 2,100 USDC. That gap is slippage, and it grows with trade size relative to the pool. Because prices move as balances change, liquidity providers face impermanent loss when the market price shifts.
Ref 1070001128