# Balancer Basics

**Understanding AMMs (Automated Market Makers)**

The foundations for AMMs lie with a mathematical rule called an [**invariant**](https://en.wikipedia.org/wiki/Invariant_\(mathematics\))**.** An invariant is a property that remains unchanged even after the application(s) of transformations. In the context of AMMs, this means that the result of the function applied to the number of assets remains the same after the transaction is completed.

One of the first use-cases of an invariant in the context of AMMs was implemented in Uniswap:

$$
x*y = invariant
$$

_where x - balance of ETH, y - balance of ERC20 token_

**The Balancer AMM**

To support multi-token pools, Balancer V2 proposed a different invariant with different weights assigned to each token:

$$
V = \prod _tB_t^{W_t}
$$

_where V is constant, B is an asset's balance, and W is an asset's weight in the pool._

As the price of each token changes, arbitrageurs rebalance the pool by making trades. This maintains the desired weighting of the value of each token meanwhile collecting trading fees from the traders.

