> For the complete documentation index, see [llms.txt](https://metavision-labs.gitbook.io/balancerv2cad/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://metavision-labs.gitbook.io/balancerv2cad/understanding-balancerv2/balancerbasics.md).

# 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.
