Impermanent loss

Impermanent loss (commonly abbreviated as IL) is one of the fundamental concepts introduced by DeFi. It is the main risk, beside token volatility of the user who wishes to provide liquidity in AMMs. Impermanent loss causes most LP position to be unprofitable and, given its non-intuitive nature, is often misunderstood by beginners.

Definition

Impermanent loss is the loss an LP (liquididy provider) is potentially subject to when he provides liquidity in a AMM pool. The greater the price movement between the two (or more) assets in the pool, the greater the loss. Impermanent loss is always calculated confronting the returns of an LP position (without taking trading fees into account) against holding the same amount of tokens without putting them into a liquidity pool.

Calculate impermanent loss

The following formula[1] calculates impermanent loss for a 2 tokens pool with 50/50 weightings (ex. Uniswap pools), where k reprents the price change:
 
As you can see, IL gets greater as the price moves, especially on the downside. Impermanent loss is always calculated taking into account price movement of one token relative to the other. Most pools are of the TOKEN/STABLECOIN kind, so the price change considerated is against the US dollar, but when two volatile assets are paired together, one must consider the relative price changes.

Why it happens

Liquidity pool based AMMs (like Uniswap, PancakeSwap or SushiSwap) all work under one simple formula: x * y = k, where x and y are the amount of tokens in the pool, and k is their product, which has to remain constant. Understanding this mechanism is pivotal to understand why impermanent loss really happens. Since k, the product of the two pool reserves, must remain constant, whenever the price of one token changes relatively to the other, so will the reserves. In particular, the pool always tries to keep a balanced proportion of the two assets: when the price of token A drops relatively to token B, there will be more of token A and less of token B in the pool. Thus a liquidity provider, which owns a portion of the pool, will see its token A holdings grow and its token B holdings shrink. Since A's price has dropped, he's now suffered impermanent loss.

Sources