Do you really know what the derivative is?

Explanation via a real-world example:​

Let's think of an infinitely long road. There is this certain car which is initially stationary at the x = 0 point of this road. If I was to tell you that this car changes its location from x = 0 to x = 25 in 5 seconds and ask you its average velocity, you would instantly say 5m/s, right? Well, you wouldn't be wrong. But what if I were to ask whether you can be certain that the velocity of 5 m/s was consistently maintained throughout the entire movement? Can you confidently say that at the 3rd second of its motion, the car was moving with a velocity of 5 m/s? You simply cannot.

For better understanding, let's think of the travel distance as a function of t, where t is the time elapsed. Our first function will be f_1(t) = 5t. We can clearly see that at the end of its 5 seconds of travel, the car indeed finishes the 25 meter long road.

2023-09-26 09_39_32-.png


Now let me confuse you a little bit. To do this, I will create a different function for the same movement: f_2(t) = t^2. We can clearly observe that the car with this function as the travel distance vs time elapsed also has a displacement of 25 meters at the end of 5 seconds.

2023-09-26 09_40_03-.png


But why do they look different? In both cases:
  • The car was initially stationary at x = 0.
  • The car reached x = 25 in 5 seconds.
  • Car's average velocity is 5 m/s.
So, why on earth these two graphs look different? And could they be more different? Well, they can. I, hereby, introduce you the f_3(t) = t^3 - 4t^2:

2023-09-26 10_04_01-.png


Python:
import matplotlib.pyplot as plt
import numpy as np

# since t always goes from 0 to 5
t = np.arange(0.0, 5.0, 0.01)

# labels are the same
plt.xlabel("Time elapsed (seconds)")
plt.ylabel("Distance (meters)")


# function definitions
def f_1(t):
    return [5*i for i in t]


def f_2(t):
    return [i*i for i in t]


def f_3(t):
    return [i**3 - 4*(i**2) for i in t]


# f_1(t)
#plt.plot(t, f_1(t))

# f_2(t)
#plt.plot(t, f_2(t))

# f_3(t)
#plt.plot(t, f_3(t))

plt.show()

OK but what changes? Instantaneous velocity changes. To find the instantaneous velocity, we must take derivatives of those location functions. To take the derivative of a function, we must first determine the variable with respect to which we will take the derivative of it. It is pretty easy in our cases, because there is only one variable in all of those functions: t.

We denote the derivative of f as f'. To take the derivative, we reduce the variable's exponent by 1 and multiply the variable by its old exponent. Let's take derivatives of those 3 functions and see what changes:
  • f_1'(t) = 5
  • f_2'(t) = 2t
  • f_3'(t) = 3t^2 - 8t
Now if we evaluate those derived functions for t values of [0, 1, 2, 3, 4, 5], we can see how the instantaneous velocity changes:
  • f_1' -> [5, 5, 5, 5, 5, 5]
  • f_2' -> [0, 2, 4, 6, 8, 10]
  • f_3' -> [0, -5, -4, 3, 16, 35]
Instantaneous velocity never varied in the first function, why? Because its instantaneous acceleration is 0. How to calculate the instantaneous acceleration? We should take the first time derivative of the velocity functions or the second time derivative of the location functions:
  • f_1''(t) = 0
  • f_2''(t) = 2
  • f_3''(t) = 6t - 8
It clearly can be observed that the first function has 0 acceleration, that means the car was moving with a constant velocity in the first scenario.

Definition of derivative:​

Derivative is defined using a limit. Since we are trying to find the instantaneous change, we must think of an infinitely small change of time. And the concept of limit fits perfectly to our intentions.

2023-09-26 11_07_48-Derivative - Wikipedia.png


As h approaches but never reaches to 0, we can be sure that we are talking about an infinitely small rate of change in our function. In our case, that h is t and stands for time.

First order derivative of a function of x also gives the slope of the function at that point. Let's examine that feature using f_1', f_2' and f_3'.

f_1'(t) = 5:​

2023-09-26 15_13_42-.png


We don't need to compare this graph and the graph of f_1 because f_1 is a linear function and its slope on any of its points is always 5. (Notice now the y-label is velocity and not distance.)

f_2'(t) = 2t:​

2023-09-26 15_18_24-.png


f_2 was a quadratic function, now we can observe its derivative is a linear function.

f_3'(t) = 3t^2 - 8t:​

2023-09-26 15_28_13-.png


Python:
import matplotlib.pyplot as plt
import numpy as np

# since t always goes from 0 to 5
t = np.arange(0.0, 5.0, 0.01)

# labels are the same
plt.xlabel("Time elapsed (seconds)")
plt.ylabel("Velocity (meter/seconds)")


# function definitions
def f_1_prime(t):
    return [5 for i in t]


def f_2_prime(t):
    return [2*i for i in t]


def f_3_prime(t):
    return [3*(i**2) - 8*i for i in t]


# f_1_prime(t)
#plt.plot(t, f_1_prime(t))

# f_2_prime(t)
#plt.plot(t, f_2_prime(t))

# f_3_prime(t)
#plt.plot(t, f_3_prime(t))

plt.show()

Now let's check if this slope-derivative relation is actually correct. Below, is the graph of f_2(t) = t^2 and g(t) = 6t - 9. This g function is the function which passes through the point (3, 9) (as f_2 does) and has a slope of 6 (since f_2(3) = 6). If this relation is correct, we should see that g(t) slightly touches to f_2(t) where t = 3:

2023-09-26 15_54_44-.png


Let's zoom in a bit:

2023-09-26 15_51_32-Figurea 1.png


It can clearly be observed that first order derivative of a function indeed gives us the slope of the function at given point.

Python:
import matplotlib.pyplot as plt
import numpy as np

# since t always goes from 0 to 5
t = np.arange(0.0, 5.0, 0.01)


# function definitions
def f_2(t):
    return [i*i for i in t]


def g(t):
    return [6*i - 9 for i in t]


# f_2(t)
plt.plot(t, f_2(t))

# g(t)
plt.plot(t, g(t))

plt.show()
 

Yeni konular

Geri
Yukarı