At its core, calculus is how neural networks learn. Think of a model with millions of weights as a massive control panel of knobs. Calculus tells the model exactly which direction to turn each knob to reduce error—finding the “downhill” path to optimization.
To understand how it works under the hood, here are the 5 core concepts broken down:
- The Infinity Principle:
Break complex structures into infinitely small parts to study them.
- Example: Finding the area of a circle by slicing it up and arranging those slices into a rectangle.

- Approximation (“Tending To”):
- Example: means X is extremely close to 2 (like 1.999999 or 2.000001), not necessarily the exact integer.
- Geometry Meets Algebra:
Every algebraic equation has a twin—a geometric shape represented visually on a graph.

-
The Idea of the Slope:
Slope measures steepness (Vertical Distance / Horizontal Distance). Depending on the graph, slopes can be constant (straight lines) or variable (curves). -
Mathematical Representation:
The formal formula for slope is expressed as:
1. Introduction to Differentiation
1.0 Core Concept: Finding the slope of a graph.
- Differentiation: The mathematical process of calculating a derivative.
- Derivative: The resulting function
1.1 Slope of a Line
- Basic Formula:
- Using Function Notation (): Replacing with gives the slope function between two points:
- Secant Line: This represents the slope of a secant line connecting two points on a curve.
1.2. From Secant to Tangent (Derivatives)
- Approximation: On a curve, a secant line approximates the slope between two points.
- Tangent Line: When the distance between the two points approaches zero (), the secant line becomes a tangent line.
- The slope of this tangent line represents the instantaneous rate of change at a single point, which is the derivative ().
1.3. The Derivative Formula:
1.4 Example: Finding the Derivative of :
Problem: Find the slope of the tangent line to at any point .
Step-by-step Solution using the limit definition:
Set up the formula:
Expand the numerator:
Simplify terms:
Evaluate the limit as :
(The slope of the tangent line to at any point is .)
- Secant line: Line passing through 2 points on curve.
- Tangent line: Line passing thriugh the curve at one point without crossing it.
1.5 Derivative Rules:
Derivative rules help make calculations easier without always needing the long limit definition.
A. Power Rule & Constant Rules:
- Power Rule:
- Constant & Linear Rules:
Examples with Special Powers:
-
Negative Power:
-
Fractional Power:
-
Polynomial Example: If , then
B. Product Rule:
Used when finding the derivative of the product of two functions ( and ).
-
Formula:
-
Example: Find derivative of
Apply rule:
Expand:
Simplify:
C. Quotient Rule:
Used when finding the derivative of a division of two functions ().
-
Formula:
-
Example: Find derivative of
Apply rule:
Simplify numerator:
D. Chain Rule (Outside-Inside Rule):
-
Formula:
-
Example: Find derivative of
Apply rule:
Simplify:
2. Partial Derivatives
-
When a function has more than one input, like , it describes a surface rather than a curve. Hill analogy: the steepness you feel depends on which way you walk.
-
Partial derivatives give the slope in two specific directions:
- : slope when you walk only along the -axis ( stays fixed).
: slope when you walk only along the -axis ( stays fixed)
- The core rule, Pick one variable, freeze the rest, and differentiate as if it were a single-variable problem.
2.0 Example:
- Derivative with respect to (treat as a constant):
, because is just a constant multiplier on , like the 5 in
, because it contains no , so it’s a constant and constants differentiate to 0.
- Derivative with respect to (treat as a constant):
2.1 Application: Neural Networks
-
“If we change one weight, how does the loss change?”
-
A neural network has a loss function that measures how wrong its predictions are, and that loss depends on thousands or millions of weights . The partial derivative tells you how much the loss changes if you tweak just that one weight.
-
Collecting all of these partial derivatives gives the gradient. Training (gradient descent) repeatedly nudges each weight in the direction that lowers the loss.
3. Numerical vs Analytical derivative
- There are 2 ways to compute derivaties:
1. Analytical: Derive the exact formula by hand using calculus rules.
2. Numerical: Calculate, using the formula with a tinyh(e.g.h = 0.001)
Here is a clear and structured explanation of your notes, which provide a fantastic intuitive breakdown of the Hessian matrix, second-order derivatives, and how they apply to optimization and Machine Learning.
4. Hessian Matrix
-
Gradient (): Represents the 1st derivative. It tells you the slope of the function at any given point (the steepness and the direction of the steepest ascent/descent).
-
Hessian Matrix (): Represents the 2nd derivative (). It tells you the shape of the landscape (curvature)—how the slope itself is changing.
4.1. The Hessian Matrix Structure (For 2 Variables: and )
For a function of two variables, , the Hessian is a matrix of second-order partial derivatives:
-
: Rate of change of the slope in the -direction.
-
: Rate of change of the slope in the -direction.
-
(and ): Mixed partial derivatives—how the slope in the -direction changes as you move in the -direction (and vice versa).
4.2 Example Analysis (“The Bowl”):
Looking at your example function :
-
First derivatives: ,
-
Second derivatives: , ,
-
Hessian Matrix:
Because both diagonal entries ( and ) are positive and constant, the surface curves upward in all directions like a bowl (a shape representing a local minimum).
4.3. Classifying Critical Points (The Determinant Test) :
At a point where the gradient is zero (flat spot), the Hessian helps determine what kind of point it is by computing the determinant :
| Condition | Result / Shape | Point Type |
|---|---|---|
| and | Bowl | Local Minimum |
| and | Dome | Local Maximum |
| Saddle | Saddle Point |
4.4. Why Derivatives Matter & Why We Use Higher Orders
-
1st Derivative: Tells you the slope.
-
2nd Derivative: Tells you the curvature and helps with optimization (knowing how fast you need to accelerate or brake).
-
3rd Derivative: Used in fields like mechanical engineering (e.g., designing smooth elevator transitions so passengers don’t experience abrupt jerks in acceleration, known as jerk).
4.5. Why the Hessian Matters in Machine Learning
Standard Gradient Descent (GD) only looks at the slope (1st derivative). Newton’s Method, however, leverages the Hessian matrix to optimize weights more intelligently:
- Standard Gradient Descent update:
- Newton’s Method update:
Key Intuition on Curvature:
-
In steep directions (high curvature/large Hessian), Newton’s method takes smaller steps to avoid overshooting.
-
In flat directions (low curvature/small Hessian), it takes larger steps to move faster through flat regions.
Production Reality:
While Newton’s method is mathematically powerful, computing and inverting a massive Hessian matrix for millions of neural network weights is computationally expensive. That is why Adam (Adaptive Moment Estimation) is typically used as the default optimizer in deep learning, striking a balance by approximating adaptive learning rates efficiently.
Final summary note highlights this evolution:
5. Chain Rule:
-
The Chain Rule is a method in calculus that helps us find the derivative of a function that is inside another function.
-
A simple example - Real-life intuition: Imagine this:
- You press the accelerator in a car.
- The engine speed (RPM) increases.
- The car’s speed increases because of the engine speed. Here, one thing affects another thing, which affects something else.
The chain rule helps us calculate how changes pass through a chain of dependent variables.
- Why is this important in Machine Learning?
Input(x) -> layer1 -> layer2 -> layer3 -> Final output
A neural network has multiple layers. Each layer depends on the previous layer.
During training, we need to understand how changing a weight affects the final error (loss). The chain rule allows us to calculate this
6. Taylor Series Approximation:
Imagine you have a complicated mathematical function, and you want to calculate its value near a point. Instead of calculating the complicated function directly, you approximate it using a simple polynomial. That is the main idea behind a Taylor Series Approximation.
- example: Suppose you want to calculate (), where () is Euler’s number.
We know that () can be complicated to calculate by hand. Taylor series lets us approximate it using:
Here, , and .
Let’s calculate ().
Substitute (x=0.1):
The actual value is approximately (1.105171). Our approximation is very close!
6.1. Why This Matters
In fields like computer vision, and machine learning optimization, computers often have to deal with complex loss functions or non-linear models where exact calculations are too computationally expensive. By using Taylor expansions (especially first-order linear approximations or second-order quadratic approximations like the Hessian), we can locally linearize or simplify complex landscapes to make gradient descent and numerical solving feasible!
These notes provide a clear, step-by-step introduction to integral calculus, moving from the basic geometric intuition of area under a curve to solving both definite and indefinite integrals using the power rule.
Here is a comprehensive breakdown of the concepts covered across your notes:
7. Integral?
-
Core Concept: An integral is essentially a continuous summation. If you slice an area under a curve into infinitely thin vertical strips () and add them all up, you get the exact area under the curve.
-
Notation: Represented by the symbol , the area under a function from a starting point to an ending point is written as:
7.1. Area Without vs. With Integrals
-
Straight-Line Graphs (No Integral Needed): For simple linear functions like , you can calculate the area under the curve using basic geometry formulas (like the area of a triangle: ).
-
Curved Graphs (Integral Needed): When a graph curves, geometric formulas no longer work directly because the top boundary is not a straight slope. This is where calculus and integration become necessary to sum up the infinite thin strips.
7.2. Definite vs. Indefinite Integrals
Your notes distinguish between two main types of integrals:
-
Definite Integrals:
-
Have lower & upper limits (numbers attached to the integral sign, e.g., ).
-
Result: Evaluates to a specific numerical value (representing an exact area).
-
Example : Evaluating yields a final area of .
-
Indefinite Integrals:
-
Do not have limits.
-
Result: Yields a general function rather than a single number. Because differentiation of a constant is zero, integration of a function leaves an unknown vertical shift, so we must add a constant of integration () where (real numbers).
7.3. Key Integration Rules & Examples Solved
The Power Rule for Integration:
Walkthrough of Examples:
- Definite Integral Example :
- Plugging in the upper limit () and lower limit ():
- Indefinite Integral with a Coefficient :
- Polynomial Integration :
-
Integrate term by term:
-
-
-
(using the rule )
-
Final Answer:
- Integration with Constants as Parameters :
-
Treating as a real number constant:
-
-
-
Final Answer: (where )
8. Multivariate Chain Rule — Explained Simply
The multivariate chain rule is a method in calculus for finding how a function changes when it depends on multiple variables, and those variables are also changing.
Think of it as: When one thing changes, it affects multiple things, which together affect the final result.
8.1. First, understand the normal chain rule
Suppose:
and
Here, depends on , and depends on .

To calculate how changes with :
We know:
Therefore:
8.2. Now, the multivariate chain rule
Imagine a function depends on two variables instead of one.
But both and depend on another variable :
Here’s the relationship:

There are two paths from to : through and through .
When changes:
- changes, affecting .
- changes, also affecting .
So, to find the total change in , we add the effects from both paths.
The formula is:
The symbol means partial derivative: differentiate with respect to one variable while treating the others as constants.
8.3. Solve the example step by step
We have:
Step 1: Find the partial derivatives.
Step 2: Find how and change with .
Step 3: Apply the multivariate chain rule.
Substitute and :
That’s it!
9. Jacobian Matrix
A Jacobian matrix is a table of derivatives that tells us how multiple outputs change when multiple inputs change.
Think of it as an extension of the ordinary derivative to functions with several inputs and outputs.
9.1. First, remember the derivative
Suppose:
Its derivative is:
At :
This means when increases by a tiny amount, increases approximately 6 times as much.
But what happens when a function has two inputs and two outputs?
That’s where the Jacobian comes in.
9.2. Imagine a machine with two inputs

Suppose the machine has these functions:
Notice:
- Inputs:
- Outputs:
We want to know how each output changes when we change either input.
9.3. Calculate the Jacobian matrix
First, calculate the partial derivatives.
For :
For :
Now arrange these derivatives into a matrix:
Substitute the derivatives:
That’s the Jacobian matrix!
Each row represents one output, and each column represents one input.
9.4. Let’s calculate with real numbers
Suppose and .
Here’s what it means:
| Value | Meaning |
|---|---|
| 4 | How fast changes with |
| 1 | How fast changes with |
| 3 | How fast changes with |
| 2 | How fast changes with |
So if we increase by a very small amount, changes approximately 4 times that amount, while changes approximately 3 times that amount.
9.5. Visual intuition: What does the Jacobian actually do?
Imagine drawing a tiny square on a rubber sheet. A mathematical transformation stretches, rotates, or shears that sheet.

The Jacobian tells us approximately how the transformation stretches, rotates, or shears a tiny region near a point.
This is especially useful in computer graphics, robotics, physics, and machine learning.
9.6. Jacobian vs Gradient vs Hessian
| Concept | What it tells us |
|---|---|
| Derivative | How one output changes with one input |
| Gradient | How one output changes with multiple inputs |
| Jacobian | How multiple outputs change with multiple inputs |
| Hessian | How the gradient itself changes |
Important connection to machine learning: The Jacobian is used in backpropagation, alongside the multivariable chain rule, to calculate how changes in model parameters affect outputs.
🎉 Congrats, you have completed Calculus Part-1.