Calculus

Calculus:

We'll start with limits and then move to differentials and integrals.

Nice cheat sheet showing all imp Calculus formulas => https://math.colorado.edu/math2300/resources/calc1/lamar/Calculus_Cheat_Sheet_All.pdf

 


 

Limits:

Limits are one of the easiest to master. They form the basis of calculus. When we say limit, we are trying to find the value of a function, as it approaches a particular value of a variable.

ex; Y= 2*x+5. This is a straight line, and when I say what is the value of Y at x=3, it's 2*3+5=11. No if I say, what's valve of Y as x approaches 3 from left side of graph (denoted as -> 3-), or from right side of graph (denoted as -> 3+), it's still 11. So, most of the cases limit is as simple just substituting the value.

In some, the exact value of the Func doesn't exist at that point, but in this case, limit may still exist, since Limit says it approaches that value, but is never exactly that value.

ex: Y = (x^2-4)/(x-2). Here at x=2, the function is 0/0 which is undefined. However, we can write it as Y=(x-2)(x+2)/(x-2). If x≠2, then we can cancel out (x-2) from top and bottom, and func Y=(x+2). Now as x->2 (from left or right), the value is 4. However, at exactly x=2, the value doesn't exist (you mark it as a open dot instead of a filled in dot).

When evaluating limits, Func which yield values as 0/0, ∞/∞, 0*∞ are all undefined, and hence you have to either cancel out some term, or rewrite the expression so that it can be evaluated to a known value on substitution (and NOT yield undefined values). Most of the complicated function limits are evaluated by expanding the complex function as Taylor series (i.e as polynomial function). Then something usually cancels out leading to a lmit value.

Some well known limits are:

  • Lt x->0 (sin(x))/x = 1 (write sin(x) as Taylor series and cancel out x from numerator and denominator). It's 0/0, but evaluates to 1 in limiting case.
  • Lt x->0  (1-cos(x))/x = 0 (expand using Taylor series).  It's 0/0, but evaluates to 0 in limiting case (unlike sin case above which evaluates to 1).
  • Lt x->∞  (1+1/x)^x = e. Here inside term goes to 0 while exponent term goes to ∞, so hard to see it can approach a particular value as e. 
  • More limits => https://planetmath.org/ListOfCommonLimits

 


 

Differentiation (Derivatives):

Differentiation follows from limits. A derivative of a function is the slope of a function at every point of the function. The slope at a point is defined as a line that touches the function at only 1 point. This slope itself may be another function, and it's denoted as f´(x) (i.e f with a prime on top).

Avg slope of a function b/w any 2 points x1 and x2 is = [f(x2)-f(x1)] / (x2-x1). Now if we start getting x2 closer to x1, then avg slope we get is for a narrower section of the function. If we make x2 infinitesimally close to x1, then, in the limiting case, we get the slope of the function at the point x1.

Let's rewrite x2 as x2=x1+Δx, then slope = [f(x1+Δx) - f(x)] / Δx

So,  f´(x) = Lt Δx->0  [f(x+Δx) - f(x)] / Δx => The eqn we get for derivative is the function that shows the slope of f(x) at any point x.

ex: f(x)=x^2, find f´(x). Here we find derivative using the defn above. 

f´(x) = Lt Δx->0  [f(x+Δx) - f(x)] / Δx = Lt Δx->0  [(x+Δx)^2 - x^2] / Δx = Lt Δx->0  [2.x.Δx + Δx^2]/Δx = Lt Δx->0  [Δx(2.x+Δx)] / Δx = Lt Δx->0 2.x+Δx = 2.x

So, slope of function x^2 is 2.x at any point x. We can verify this by drawing slopes at x=1, x=2, x=4, etc and confirm that the slope is indeed 2, 4, 8, which is 2.x !!

Similarly derivatives can be found for many common functions. In most cases, we have to do a Taylor series expansion to cancel out  Δx in both numerator and denominator.

f(x)=sin(x). To find f´(x), we expand sin(x) as Taylor series,, cancel out Δx, and the series left is cos(x). So, f´(x) = cos(x)

If f(x)=cos(x), then f'(x) = -sin(x)

 

Some common derivatives:

  • d/dx(e^x) = e^x (drive from defn of derivative, and then using series expansion of e^x). 
  • d/dx (a^x) = ln(a). a^x. We can derive this from differentiation of e^x. a^x can be rewritten as e^(x ln(a)). This is because if we take natural log of both sides, then ln(a^x) = ln (e^(x ln(a)) => x (ln a) = x (ln a), so both sides become equal. Now d/dx(a^x) = d/dx(e^x(ln a) = e^(x(ln a)) . d/dx(x * ln(a)) = ln (a). e^(x(ln a) = ln(a). a^x.
  • d/dx(ln x) = 1/x . Since ln (x) is inverse fn of e^x, we can use above derivative of e^x to find this one. Let y=ln(x) => x=e^y, => d/dx(x) = d/dx(e^y) => 1 = d/dy(e^y).dy/dx => 1=e^y.dy/dx => dy/dx = 1/e^y = 1/x  
  • d/dx(logax) = d/dx(ln(x)/ln(a)) = 1/(x.ln(a)).
  • d/dx(tan(x)) = d/dx((sin(x)/cos(x)). Using quotient rule, we get f'(x)= sec2(x)=1/cos2(x)
  • d/dx(cot(x)) = d/dx((cos(x)/sin(x)). Using quotient rule, we get f'(x)= -cosec2(x) = -1/sin2(x). Or other way is by using d/dx(1/f(x)) where f(x)=tan(x). So, d/dx(1/tan(x)) = -1/tan2(x).d/dx(tan(x)) = -1/tan2(x).(1/cos2(x)) = -1/sin2(x)

 Link for common derivatives and rules => https://www.mathsisfun.com/calculus/derivatives-rules.html

 ex: d/dx(x^x). Take y=x^x => ln(y)=xln(x) => d/dx(ln(y)) = d/dx(xln(x)) => 1/y*dy/dx=ln(x) + 1 => dy/dx=y[1+ln(x)] =>  d/dx(x^x) = x^x * [1+ln(x)] 

 

Maxima/Minima:

Derivatives can be used to find maxima and minima if functions. This is one of the most used application of derivatives in real life.

Following defn used to describe shapes of func when dealing with max/min:

  • Convex func: (aka Concave upward or convex downward): Any func whose slope increases is convex or concave up (like a rice bowl kept on table), i.e slope goes from -ve to 0 to +ve or any part where slope is increasing. 
  • Concave func (aka concave downward or convex upward): Any func whose slope decreases is concave or convex up (like a rice bowl kept upside down on table), i.e slope goes from +ve to 0 to -ve or any part where slope is decreasing.
  • Infection point: This is the point where the func changes from convex to concave or vice versa.

A continuous and smooth function (most of the real functions are smooth, an exception is absolute value func) will have it's slope=0 at maxima and minima. These are local max/min, as many of these local max/min may exist. There's no way known to find the absolute max/min of any func. Over a limited domain of x values (i.e x goes from x1 to x2), we can determine absolute max/min by looking at all points where slope is 0, undefined or at end points. Whether the point is maxima or minima is determined by 2nd derivative.

  • 1st derivative: Given f(x), find first derivative f'(x). If f'(x) =0 at x=x1, it's either a maxima, a minima or a infection point. An infection point is a point where slope is 0, but instead of reversing direction (i.e slope), it keeps on moving in same direction.
  •  2nd derivative: Now find 2nd derivative f''(x) at x=x1. Depending on 2nd derivative sign, we can determine whether it's max or min
    • Maxima: If f''(x1) < 0, then x1 is a point of local maxima. This is because, at maxima, it's concave, so slope of this func goes from +ve to -ve (decreasing). Then, derivative of this slope (i.e f''(x)) will be -ve. If you don't want to check for 2nd derivative, then you can also check sign of first derivative, f'(x). If f'(x) changes sign from +ve to -ve when going thru x1, then it's a maxima.
    • Minima:  If f''(x1) > 0, then x1 is a point of local minima. This is because, at minima, it's convex, so slope of this func goes from -ve to +ve (increasing). Then, derivative of this slope (i.e f''(x)) will be +ve.  If you don't want to check for 2nd derivative, then you can also check sign of first derivative, f'(x). If f'(x) changes sign from -ve to +ve when going thru x1, then it's a minima.
    • Infection point: Here, func changes from convex to concave or vice versa, implying f''(x) changes sign from +ve to -ve or vice versa. Basically f''(x)=0 at point of infection (as sign change can only happen when it passes thru 0). At infection point, slope of the original func, f(x), may or may not be 0 (i.e f'(x)=0 or f'(x)≠0). 
      • If f'x(0)=0 and f''(x)=0, then func continues going in same dirn after hitting a flat portion. No max or min exists, though slope of f(x) does go to 0
      • If f'x(0)≠0 and f''(x)=0, then func is changing shape from convex to concave or vice versa. No max or min exists as slope of f(x) never goes to 0

 


 

Integration (Integral):

Integration is inverse of differentiation. Integral is the inverse function of derivative. We denote it as ∫ f(x). Given function f(x), if  F´(x) = f(x), then ∫ f(x) = F(x). F(x) (denoted with capital F) is the inverse func of f(x). See Inverse function in other sections.

F(x) -> differentiate -> f(x).  F´(x) = f(x),

F(x) <- integrate <- f(x). F(x) = ∫ f(x).

Why is integration area under a curve? Let's say A(x) is some function of f(x). At x=x1, A(x) is A(x1). Now, if we take incremental "dx" at x=x1, and compute f(x).dx, then f(x).dx gives area of the incremental rectangle formed. So, incremental increase in area is f(x).dx. So, A(x) must be the area of the function, as incremental area dA(x)=f(x).dx => dA(x)/dx = f(x). Or A(x) =   ∫ f(x).dx

This vid shows it formally by using MVT => https://www.youtube.com/watch?v=U3u0PF7n-xg

Integration is usually taught as avg value of a continuous func. To make it easier, we divide f(x) into N discrete sections and then find avg value.

Then avg = [∑f(x) ] / N, where summation is over N points, and each point is spaced apart by dx, so no. of points N = (b-a)/dx. So, area =  Avg height of f(x) * base = [∑f(x) ] / (b-a) * dx * (b-a) =  [∑f(x) ] * dx where a,b are endpoints on x axis

Now if we start taking limit dx->0, then avg value of this func approaches closer to it's real value. So, Area = Limit dx->0  [∑f(x) ] * dx =  b
a
∫ f(x).dx

Fundamental Thm of Calculus:  b
a
∫ f(x).dx = F(b) - F(a) where  F´(x) = f(x). What's insane is that the area of the whole curve can be found by just looking at the values of antiderivative at the endpoints o the curve !! We'll see why that happens below. 

Essence of Calculus explaining Integration as area under curve => https://www.3blue1brown.com/lessons/integration

We learn integration as the area under the curve. However, the function that we get via integration F(x) is actually the inverse function of f(x), i.e F´(x) = f(x). But differentiation gives the slope, while it's inverse func gives the area. How is the slope and area related? This fundamental question is explained nicely here => https://www.3blue1brown.com/lessons/area-and-slope

To see this relationship, 2 key points to observe:

  1. Avg slope for any func can be calculated by just looking at End Points: If you were given a bunch of numbers in any order, would you be able to calculate it's avg just by looking at 1st and last number? Answer is => You won't be as the avg is decided by all the numbers. Now consider continuous plot of such numbers. Again, it's the same thing => you won't be able to calculate the avg of this continuous func, just by looking at the 2 endpoints of the curve. But now, let's say, I calculate the slope of this function, and plot this new function which is the slope of our original function at every point of the graph. Can I calculate the avg of this slope function, by just looking a the 2 endpoints?  Surprisingly, you can now. Why does this happen. Because, with slope, if the slope goes up a certain magnitude above the avg, the slope has to come down the same magnitude below the avg, to give us the avg. It also follows from Mean Value Thm and from intuition. So, the jist is => The avg slope of any function could be found by just looking at the slope at the 2 endpoints.
  2. Area of a function: it can be calc as avg height of func multiplied by the width of the base. The avg slope of any func as seen above = [F(b)-F(a)]/(b-a), where a,b are endpoints on x axis. If we plot the slope function (i.e a function f(x) that is the slope of F(x) for all points on x axis), then the area of f(x) will be = Avg height of f(x) * base. But avg height of f(x) = avg slope of F(x) (as f(x) is slope func of F(x)). Since avg slope of F(x) =  [F(b)-F(a)]/(b-a),  that's the avg height of f(x). So, ares of f(x) = avg height of f(x) * base =  [F(b)-F(a)]/(b-a) * (b-a) = [F(b)-F(a), which proves the theorem.

Diagram showing proof of Fundamenal Thm of Calculus