How Does the Constant Product Formula Work in a Basic AMM?
The constant product formula, $x y = k$, ensures that the product of the quantities of the two tokens in the pool ($x$ and $y$) always remains equal to a constant ($k$). When a token is bought, its quantity decreases, and the other's increases, automatically adjusting the price to maintain the constant $k$.