# Basic Mathematics

Lets assume a protocol with a token $$T\_P$$. On an initial cycle is going to be paired with an USD-pegged stablecoin such as **USDC**. In that way, the LP is going to be $$\frac{T\_P}{USDC}$$, and the bonding curve formula given by Uniswap is:

$$x \cdot y = K$$

Hence,

$$T\_P \cdot USDC = K$$

This formula is responsible for calculating prices, and deciding how much $$T\_P$$ token would be received in exchange for a certain amount of USDC, or vice versa.

The formula states that $$K$$ is a constant no matter what the reserves (*x* or *y*) are. Every swap increases the reserve of either USDC or $$T\_P$$ token and decreases the reserve of the other.

$$(x + \Delta x) \cdot (y - \Delta y) = K$$

Where $$\Delta x$$ is the amount being provided by the user for sale, and $$\Delta y$$ is the amount the user is receiving from the DEX in exchange for $$\Delta x$$.

Since $$K$$ is a constant, we can asume that:

$$x \cdot y = (x + \Delta x) \cdot (y - \Delta y)$$

Before any swap is being made, we know the exact values of *x*, *y*, and $$\Delta x$$ (given by the input). In that way, we are interested in calculating $$\Delta y$$, which is the amount of USDC or $$T\_P$$ token the user will receive:

$$y - \Delta y = \frac{x \cdot y}{x + \Delta x}$$

$$-\Delta y = \frac{(y \cdot \Delta x)}{(x + \Delta x)} - y$$

$$-\Delta y = \frac{x \cdot y - y(x + \Delta x) }{x+ \Delta x}$$&#x20;

$$-\Delta y = \frac{x \cdot y - y \cdot x - y \cdot \Delta x}{x+\Delta x}$$

$$-\Delta y = \frac{-y \cdot \Delta x}{x+ \Delta x}$$

Hence, after simplyfing the above equation to obtain $$\Delta y$$ , we get the following:&#x20;

$$\Delta y = \frac{(y \cdot \Delta x)}{(x + \Delta x)}$$


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://artichoke.gitbook.io/abstract/single-sided-lp-mechanics/basic-mathematics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
