Intro to Calculus
Calculus is the study of change. It will help us reason about change and motion and everything that is smooth. I was struggling with calculus when I was a student. I hope this little playground helps you get started on your math journey
1Derivative
The derivative is the instantaneous rate of change: the slope of the line that just touches the curve at . To find it, connect two nearby points with a secant line and let their gap shrink to nothing:
a. From secant to tangent
You can drag the point on the curve.
b. The derivative is a function
You can drag the point on the curve.
2 Differential
If moves by a small step , the function changes by . The differential is the same change measured along the tangent line instead of the curve:
The best linear approximation
You can drag the point on the curve.
3 Integral
The integral measures accumulation: the signed area under a curve. Slice the region into thin rectangles (a Riemann sum); as the sum converges to the exact area:
a. Riemann sums
Change , the limits , and how each rectangle samples the curve. Watch the sum settle onto the true area.
b. The Fundamental Theorem
The running area is drawn in green. Slide and notice its slope at equals .
The derivative measures change, the differential predicts locally, and the integral accumulates — and the Fundamental Theorem ties the two ends together: .
4 Multivariable & Partial Derivatives
So far, every function had one input: drew a curve on a flat page. In the real world, outcomes depend on multiple factors — temperature depends on position , or profit depends on price and quantity.
A function with two inputs, , takes a coordinate on the floor and assigns it a height — creating a 3D surface or terrain.
The Infinite Directions Problem
On a 1D curve, you can only step left or right. On a 3D hill, you can step in any direction. How do we measure slope when there are infinite paths?
The trick is to hold one variable constant! If you freeze , you slice the 3D surface with a vertical plane parallel to the . That slice is just a standard 1D curve, and its slope is the partial derivative .
Note on notation: We use (curly d) instead of to signal that has other variables being held temporarily still.
Slope along each axis
Slide and to move across the hill. Blue shows the east-west slope () holding constant. Red shows the north-south slope () holding constant.
5 Gradient
Stack both partials into one vector and you get the gradient — it points in the direction of steepest ascent, and its length tells you how steep that is:
Steepest ascent
Slide and to move the point. The gradient (red) points straight uphill in the ground plane.
6 Gradient Descent
Flip the gradient around and you get the direction of steepest descent. Take small steps that way, over and over, and you walk downhill toward a minimum:
Rolling downhill
This loop — compute the gradient, take a step, repeat — is how every neural network is trained. Tune the learning rate and watch the ball roll down a lopsided 3D bowl.
Partial derivatives measure slope along one axis, the gradient combines them into "which way is up," and gradient descent uses that to automatically find the bottom of a surface — whether that surface is terrain, a rendered scene, or the error of a machine learning model.