AMM = Automated Market Makers.

Spot price means how much B will I get for a given A. A and B being the two tokens of an AMM.

Screenshot 2022-10-18 at 1.04.13 PM.png

Screenshot 2022-10-18 at 1.04.35 PM.png

Geometry approach

Screenshot 2022-10-18 at 1.13.25 PM.png

If we do trade like this we get dy tokens doe providing dx tokens and the slope will be dy/dx.

Now, if I do a smaller trade like this:

Screenshot 2022-10-18 at 1.14.01 PM.png

Note the blue line. And doing an even smaller trade:

Note the orange line.

Screenshot 2022-10-18 at 1.15.25 PM.png

As you can see the smaller the dx the slope starts to look like the tangent of the curve.

According to the constant product formulla the follwing equation must always hold.

Screenshot 2022-10-18 at 1.16.30 PM.png

Now, lets derive:

Screenshot 2022-10-18 at 1.17.32 PM.png

Now, as dx goed to 0:

Screenshot 2022-10-18 at 1.17.54 PM.png