> For the complete documentation index, see [llms.txt](https://artichoke.gitbook.io/abstract/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://artichoke.gitbook.io/abstract/single-sided-lp-mechanics/basic-mathematics.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
