Elementary calculus with a real life example

Bagavathy Priya
7 min readAug 13, 2022

--

In this blog, we are going to see about differential calculus. Calculus is a study of change and derivative ( or differentiation) is a fundamental tool of calculus. This writing is a part of my learning journey and here I want to share things in an easy and elegant manner.

Derivative :

It tells the slope or steepness of a curve. The slope is calculated from the tangent line that touches the curve at only one point. Every point of the curve has a different tangent line. If the curve is a linear line then the slope is the same in every part of the line.

y = 2x

For the above curve slope = 2. For a unit change on the x-axis, there is a 2-unit change on the y-axis. (ie) when x = 2 then y = 4
when x = 4 then y = 8. Similarly the slope is 2 for every part of the line.

But if we look at the above curve it is not linear. So the slope is different at different parts of the graph based on whether the curve is dropping or increasing.

The slope can be calculated by taking any two points (x,f(x)) and (x+h, f(x+h)). h is the distance between the taken two points on the x-axis. Then the slope can be computed by the distance between the y-axis divided by the distance between the x-axis (formula in the below figure).

But the above formula gives an approximate value of the derivative. We can find the accurate value of the slope by narrowing the line or secant ( h value close to 0). Then the slope of the secant becomes the slope of the tangent. The closer the two points the more accurate the estimate is for the slope at that point. This is the main ingredient of calculus. To make the result more accurate we can shorten the length of the tangent infinitesimally small.

So in short, the slope tells how a curve is changing/ behaving at its points.

First order derivative :

The slope we calculate from a curve is the first-order derivative. It is also called the gradient. We take gradients from every point of the curve f(x) to draw the gradient curve f`(x). It tells the behavior of the base function f(x).

Here the red curve is f(x) and the blue curve is the gradient curve f`(x). In the left side of f(x) the curve is dropping (or decreasing) and correspondingly the f`(x) has negative values. Similarly, the right side of f(x) is increasing and its f`(x) has positive values in the gradient curve. At (0,0) the f(x) is flat so the f`(x) is also 0, indicating there is no change at that point. Thus for every point of x, the gradient curve tells the behavior of change by its sign ( positive or negative) and the scale of steepness by the value.

The point where the f`(x) is zero is the stationary point. Using this we can calculate the maximum or minimum point of a curve based on the concavity.

For the curve f(x) = x²-x , the derivative function is f`(x) = 2x -1 (Note: f`(x) is a function as the value changes based on the x value). The red curve is flat at x = 0.5 so the blue gradient curve is at zero for that x- value. So the stationary point of a curve can be found by equating the first derivative function to zero. Here it can be computed by

f(x) = x² -x , f`(x) = 2x-1

To calculate stationary point(s)

f`(x) = 2x -1 = 0

2x = 1

x = 1/2 = 0.5

If we substitute this x = 0.5 in f(x), we get y = -0.25

So, (0.5,-0.25) is the stationary point.

Second order derivative:

The second order derivative is the derivative of the first order derivative. Like we used the first derivative to find the slope of the function. We can use a second-order derivative to determine the concavity of the curve.

Here the blue curve is the first order derivative of f(x). Notice that the curve f(x) is always going up and so the f`(x) represents the same. Based on the steepness of f(x) , the value of f`(x) is dropping (on left) and raising (on right) but it’s having only positive values.

Now let’s move on to second order derivative. That will be based on the change of slope in the first order derivative function.

The purple line here is the second order derivative f``(x). This is calculated based on the derivative of first order derivative. f``(x) is -ve on the left as f`(x) is dropping and +ve on the right as f`(x) is increasing. The point where the gradient (f`(x)) stops increasing and starts decreasing or vice versa is the point of inflexion (POI). Here at (0,0) the slope stops decreasing and starts increasing. And POI is also the point where the function changes concavity.

if f``(x) > 0 then concave up

if f`(x) <0 then concave down

if f`(x) = 0 then possible POI (where the concavity of curve changes)

With the concavity and stationary point informations, we can find the maximum or minimum points of the curve.

If the curve is concave up, the stationary point will be the flat part at the top so that is the maximum point and if it is concave down, the stationary point is the flat part at the bottom so that is the minimum point.

In the above curve, it is concave down in the left so -1 is the minimum point. And in the right, the curve is concave up, so 1 is the maximum point. And at (0,0) the curve changes from concave down to concave up so that is the point of inflection.

Till now we have covered what is the slope, first order, and second order derivatives. And covered two critical points (ie) stationary point and point of inflection. Now let’s solve a simple real-life example using the above concepts.

Problem:

A rectangle is formed with a tube of perimeter 16m. The problem is to find the sides of rectangle to get maximum area.

Solution:

Let’s consider a side of a rectangle as x meter and its opposite side also must be x meter
Hence the sum of the other two sides would be (16–2x)/2. So the other two sides will be 8-x individually.

Rectangle

Area of rectangle = l x b = (8-x)*x

f(x) = 8x-x²

f`(x) = 8–2x

f``(x) = -2

Here f``(x) is negative, so the function f(x) is concave down. Then the stationary point is the maximum point.

To find stationary point, f`(x) = 0

8–2x = 0

2x = 8

x = 4

When x = 4, 8-x = 4, we obtain the maximum area.

Perimeter = 4+4+4+4 = 16 m

When x=4 , Area of rectangle = (4)*(8–4) = 16 m²

If x = 2, Area of rectangle = (2)*(8–2) = 12 m²

If x = 3, Area of rectangle = (3)*(8–3) = 15 m²

So when we form the area with sides of 4 m, we will get the maximum area.

TADAAAAA 🎉🎉🎉🎉🎉🎉 We solved a problem !!!

Likewise, we can take any use case with metrics and values to find the max/min value that helps to optimize the metric. We can solve various problems using differential calculus like how to maximize profit, minimize expenses, and other optimization problems.

Let me know if at any point this blog taught you something or helps you. If so, don’t forget to give some claps here.

--

--

Bagavathy Priya

Data science aspirant loves to read , write , and play with codes and data