Recap: What is k?
At last, we’ve arrived at the core concept – the product constant k. But is it really as straightforward as it seems?
From our earlier discussions, we know that k is simply the product of reserves in a decentralized exchange liquidity pool:
Here, x1 and y1 represent the reserves of Token X and Token Y, respectively.
Theoretical Scenario: A DEX with No Fees
To build a solid intuition around k, let’s first examine a simplified, fee-free DEX environment. This theoretical approach helps clarify how k behaves under different conditions.
k Remains Constant During Swaps
When a trader swaps x₂ of Token X for y₂ of Token Y, the product k stays unchanged.
Using this relationship, we can derive the amount of Token Y (y₂) the trader receives:
This ensures that k remains balanced before and after the swap.

k Changes When Adding or Removing Liquidity
Unlike swaps, liquidity provision and withdrawal directly impact k.
Adding Liquidity Expands k
If a liquidity provider deposits x₂ and y₂ tokens in the correct ratio, the new k becomes:
Since both reserves increase, k grows proportionally. The magnitude of this expansion depends on the size of the new deposits relative to the existing reserves.

To illustrate how liquidity provision affects the product constant k, let’s consider a DEX pair with initial reserves of 10,000 Token X and 10,000 Token Y. In this scenario, liquidity providers deposit additional tokens at 10%, 25%, and 50% of the existing reserves.
Initial State (Before Adding Liquidity)
The starting value of k is calculated as:
After Adding 10% Liquidity
New reserves: 11,000 Token X and 11,000 Token Y
After Adding 25% Liquidity
New reserves: 12,500 Token X and 12,500 Token Y
After Adding 50% Liquidity
New reserves: 15,000 Token X and 15,000 Token Y
Notice how k increases quadratically with proportional liquidity additions. A 10% increase in reserves leads to a 21% rise in k, while a 50% increase more than doubles k (from 100mm to 225mm).
This demonstrates how liquidity expansion directly amplifies the pool’s depth and trading capacity. In the next section, we’ll examine how k behaves when liquidity is withdrawn.
Removing Liquidity Contracts k
Conversely, when a liquidity provider withdraws x₂ and y₂ tokens (in the correct ratio), k decreases:
With both reserves reduced, k shrinks accordingly.

Let’s examine a practical example of how removing liquidity affects the product constant k. We’ll analyze a DEX pool containing 10,000 Token X and 10,000 Token Y, where liquidity providers withdraw 10%, 25%, and 50% of the current reserves.
Initial State (Before Removing Liquidity)
The starting value of k is calculated as:
After Removing 10% Liquidity
New reserves: 9,000 Token X and 9,000 Token Y
After Removing 25% Liquidity
New reserves: 7,500 Token X and 7,500 Token Y
After Removing 50% Liquidity
New reserves: 5,000 Token X and 5,000 Token Y
k decreases quadratically when liquidity is withdrawn proportionally. A 10% reserve reduction lowers k by 19% (from 100mm to 81mm), while a 50% reserve reduction causes k to drop by 75% (from 100mm to 25mm).
Key Takeaways
- Swaps: keep k constant (assuming no DEX fees).
- Deposits: increase k by expanding reserves.
- Withdrawals: decrease k by reducing reserves.