Skip to main content
Welcome — I’m Alan Chapman from KodeKloud. In this lesson we introduce derivatives: the mathematical tool that measures change. You’ll learn an intuitive, visual interpretation of derivatives using distance–time graphs, see how derivatives quantify instantaneous rates (like speed), and discover how these ideas apply to real-world systems such as self-driving cars and image-recognition models. We also preview the power rule so you can compute derivatives algebraically.
The image features a person in a dark shirt standing next to text detailing three objectives related to derivatives, with an animated cat character on the left.
Why focus on derivatives? Because analyzing how things change lets models make better decisions — from avoiding collisions in autonomous vehicles to improving image recognition. Derivatives provide the quantitative measure of that change.
The image shows a person speaking next to a graphic with three cars on lanes and the text "Derivative Means 'Rate of Change'."
Derivatives measure rate of change. In physics, speed is the rate of change of distance with respect to time. In machine learning, derivatives (and gradients) measure how model outputs change with respect to parameters — information that optimization algorithms use to improve performance.
The image shows a presentation slide titled "Derivative in IT Jobs," with illustrations of a "Machine Learning Engineer" and a "Data Scientist," alongside a person giving the presentation.
Self-driving cars give a concrete example. They rely on sensors and math (no instincts). To travel safely they must monitor distances, adjust speed smoothly, and stop or change lanes when necessary. Those decisions all depend on knowing how speed or distance are changing over time — exactly what derivatives tell us. Consider this roadworks scenario: cones, a narrow lane, and a car approaching at speed. The vehicle must evaluate whether to brake, hold speed, or change lanes. To choose correctly it needs the rate at which its speed or distance to obstacles is changing — this is derivative information.
The image shows a woman speaking in front of a presentation slide about "Making Decisions" related to driving, which includes illustrations of cars, traffic cones, and questions about speed and obstacles.
A simple, concrete example helps build intuition. Meet Julia.
  • She travels toward the library and hits traffic.
  • For the first period she moves steadily: 30 metres every 15 seconds.
  • After 45 seconds she has covered 90 metres — that’s 2 metres per second.
On a distance–time graph, steady motion shows up as a straight line. The slope of that line (rise over run) equals her speed; in this case the slope is 2 m/s. After 45 seconds Julia stops for 15 seconds, then turns back home. The distance–time graph therefore has three phases: rising (moving away), flat (stopped), and falling (returning). Each phase corresponds to a different derivative value:
  • Rising straight line → positive slope → moving away.
  • Horizontal line → zero slope → stopped.
  • Falling line → negative slope → getting closer (negative rate).
The image shows a graph of distance versus time with a line that rises, levels, and then falls, and a person explaining the graph. There's also an animated character in a car with a speech bubble questioning the line's downward trend, suggesting reversal.
Key intuition at a glance:
Slope (tangent)Meaning
Steep upwardLarge positive rate — fast increase (high speed)
Gentle upwardSmall positive rate — slow increase
HorizontalZero rate — no change (stopped)
DownwardNegative rate — decrease (moving toward start)
In the real world, motion is usually smooth rather than piecewise-linear. Julia doesn’t stop or start instantly — she accelerates and decelerates smoothly, producing a curved distance–time plot. To find her instantaneous speed at any moment on that smooth curve, we draw a tangent at the point and compute its slope. That slope is the derivative at that instant. A tangent line gives local, instantaneous information:
  • A steep tangent → high instantaneous speed.
  • A flatter tangent → slower instantaneous speed.
  • A horizontal tangent → zero instantaneous speed.
  • A negative tangent → distance decreasing (moving back).
Self-driving systems use the same concept to estimate instantaneous velocities and make split-second decisions: should the car brake now, or is it safe to change lanes? To understand passing an obstacle: imagine the car approaching a roadworks site. If the distance from the car to the works is plotted versus time, the graph will dip as the car approaches (negative slope) and then rise after passing (positive slope). The moment when the driver (or autopilot) begins braking is a point on that curve — the instantaneous speed there equals the tangent slope.
The image shows a graph of distance versus time with a curved line and marked "accelerate," alongside a person smiling and a cartoon animal character. A speech bubble asks if computers draw tangents every time.
Computers don’t literally draw geometric tangents each time. Instead they use algebraic formulas from calculus (and numerical methods) to compute derivatives quickly. These computations let systems evaluate rates of change in real time for control and optimization tasks.
Next step: basic algebraic differentiation. The power rule is the simplest and most commonly used formula for derivatives. It states:
If f(x) = x^n, then f'(x) = n * x^(n-1)
Example:
f(x) = x^3
f'(x) = 3x^2
Using formulas like the power rule, a program can compute instantaneous rates without geometric construction. Those computed derivatives are the building blocks for gradients, which guide optimization algorithms in machine learning. Further reading and references: In the next lesson we’ll apply the power rule and begin computing derivatives for functions that commonly appear in machine learning models.

Watch Video