Skip to main content

Mathematic for Artificial Intelligence : Calculus

 A simplified guide on how to prep up on Mathematics for Artificial Intelligence, Machine Learning and Data Science: Calculus (Important Pointers only)

Module - II : Calculus 

I. Limits and Continuity.

 -> Limits, functions, derivatives, integrals, and infinite series. 

1. Limits

The limit of f(x)f(x) as x approaches aa is LL if, as xx gets arbitrarily close to aa, f(x)f(x) gets arbitrarily close to LL. This is written as: limxaf(x)=L

 ε-δ Definition :

 limxaf(x)=L

if for every ϵ>0\epsilon > 0, there exists a  δ>0\delta > 0 such that   0<xa<δ0 < |x - a| < \delta implies f(x)L<ϵ.

One-Sided Limits: 

  • Right-hand limit: limxa+f(x)\lim_{{x \to a^+}} f(x)
  • Left-hand limit: limxaf(x)\lim_{{x \to a^-}} f(x)

Infinite Limits and Limits at Infinity:

  • limxaf(x)=\lim_{{x \to a}} f(x) = \infty
  • limxf(x)=L

2. Continuity

A function ff is continuous at a point  aa if:

 
  • is defined.
  • limxaf(x) exists.\lim_{{x \to a}} f(x)
  • limxaf(x)=f(a)\lim_{{x \to a}} f(x) = f(a)
  • If a function is continuous at every point in an interval, it is continuous on that interval.

    Types of Discontinuities

    • Removable Discontinuity: A hole in the graph (can be "fixed" by redefining the function at that point).
    • Jump Discontinuity: A sudden jump in function values.
    • Infinite Discontinuity: The function goes to infinity at the point.

    Important Theorems :

    • Intermediate Value Theorem: If  ff is continuous on  [a,b][a, b] and   NN is between   f(a)f(a) and   f(b)f(b), then there exists some  c(a,b)c \in (a, b) such that   f(c)=N.
    • Extreme Value Theorem: If ff is continuous on [a,b][a, b], then ff attains its maximum and minimum values, each at least once, on [a,b][a, b].

    II. Derivatives and Differentiation Rules.

    1. Derivatives

    The derivative of a function ff at a point xx, denoted by f(x)f'(x) or ddxf(x)\frac{d}{dx}f(x), is defined as: f(x)=limh0f(x+h)f(x)hf'(x) = \lim_{{h \to 0}} \frac{f(x + h) - f(x)}{h}

    The derivative at a point is the slope of the tangent line to the function's graph at that point.

    2. Differentiation Rules

    (i). Power Rule

    If f(x)=xnf(x) = x^n, then f(x)=nxn1f'(x) = nx^{n-1}.

    (ii). Constant Rule

    If f(x)=cf(x) = c, where cc is a constant, then f(x)=0.

    (iii). Constant Multiple Rule

    If f(x)=cg(x)f(x) = c \cdot g(x), where cc is a constant, then f(x)=cg(x)f'(x) = c \cdot g'(x).

    (iv). Sum Rule

    If f(x)=g(x)+h(x)f(x) = g(x) + h(x), then f(x)=g(x)+h(x)f'(x) = g'(x) + h'(x).

    (v). Difference Rule

    If f(x)=g(x)h(x)f(x) = g(x) - h(x), then f(x)=g(x)h(x)f'(x) = g'(x) - h'(x).

    (vi). Product Rule

    If f(x)=g(x)h(x)f(x) = g(x) \cdot h(x), then f(x)=g(x)h(x)+g(x)h(x)f'(x) = g'(x) \cdot h(x) + g(x) \cdot h'(x).

    (vii). Quotient Rule

    If f(x)=g(x)h(x)f(x) = \frac{g(x)}{h(x)}, then f(x)=g(x)h(x)g(x)h(x)h(x)2f'(x) = \frac{g'(x) \cdot h(x) - g(x) \cdot h'(x)}{h(x)^2}

    (viii). Chain Rule

    If f(x)=g(h(x))f(x) = g(h(x)), then f(x)=g(h(x))h(x)f'(x) = g'(h(x)) \cdot h'(x)

    3. Higher-Order Derivatives

    The second derivative of ff, denoted by f(x)f''(x) or d2dx2f(x)\frac{d^2}{dx^2}f(x), is the derivative of the derivative of ff. Higher-order derivatives are found as per above rules.

    Notation

    • First derivative: f(x)f'(x) or ddxf(x)\frac{d}{dx}f(x)
    • Second derivative: f(x)f''(x) or d2dx2f(x)\frac{d^2}{dx^2}f(x)
    • nth derivative: f(n)(x)f^{(n)}(x) or dndxnf(x)\frac{d^n}{dx^n}f(x)


    III. Partial Derivatives.

    If ff is a function of two variables, xx and yy, the partial derivative of ff with respect to xx is denoted by fx\frac{\partial f}{\partial x} and is defined as: fx=limh0f(x+h,y)f(x,y)h\frac{\partial f}{\partial x} = \lim_{{h \to 0}} \frac{f(x+h, y) - f(x, y)}{h}

    Similarly, the partial derivative of ff with respect to yy is denoted by fy\frac{\partial f}{\partial y} and is defined as: fy=limh0f(x,y+h)f(x,y)h\frac{\partial f}{\partial y} = \lim_{{h \to 0}} \frac{f(x, y+h) - f(x, y)}{h}

     Notations:

    • fx\frac{\partial f}{\partial x} or fxf_x for the partial derivative with respect to xx
    • fy or fyf_y for the partial derivative with respect to yy

    Higher-Order Partial Derivatives

    • The second partial derivative with respect to xx: 2fx2\frac{\partial^2 f}{\partial x^2}
    • The mixed partial derivative with respect to xx and then yy: 2fxy\frac{\partial^2 f}{\partial x \partial y}

    If ff is a function of nn variables x1,x2,,xn, the notation extends similarly.

     Eg: 

    Let f(x,y)=exyf(x, y) = e^{xy}.

    • First partial derivatives: fx=yexy\frac{\partial f}{\partial x} = y e^{xy} and  fy=xexy\frac{\partial f}{\partial y} = x e^{xy}

    • Second mixed partial derivatives:

       2fxy=y(yexy)=exy+xyexy 

      2fyx=x(xexy)=exy+xyexy\frac{\partial^2 f}{\partial y \partial x} = \frac{\partial}{\partial x} \left( x e^{xy} \right) = e^{xy} + xy e^{xy}

    By Clairaut's theorem, if the mixed partial derivatives are continuous, they are equal: 2fxy=2fyx\frac{\partial^2 f}{\partial x \partial y} = \frac{\partial^2 f}{\partial y \partial x}

     

    IV. Gradient and Directional Derivatives.

    1. Gradient

    The gradient of a scalar function f(x1,x2,,xn)f(x_1, x_2, \ldots, x_n) is a vector that points in the direction of the greatest rate of increase of the function. It is denoted by for grad f and is defined as: f=(fx1,fx2,,fxn)\nabla f = \left( \frac{\partial f}{\partial x_1}, \frac{\partial f}{\partial x_2}, \ldots, \frac{\partial f}{\partial x_n} \right) 

    Eg:

    Let f(x,y,z)=x2+y2+z2.

    The gradient of ff is: f=(fx,fy,fz)=(2x,2y,2z)\nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right) = (2x, 2y, 2z)

    Properties

    • The gradient vector points in the direction of the steepest ascent.
    • The magnitude of the gradient vector represents the rate of the steepest ascent.

     2. Directional Derivative

     The directional derivative of a function ff at a point a=(a1,a2,,an)\mathbf{a} = (a_1, a_2, \ldots, a_n) in the direction of a unit vector u=(u1,u2,,un)\mathbf{u} = (u_1, u_2, \ldots, u_n) is the rate at which ff changes at a\mathbf{a} in the direction of u\mathbf{u}. It is denoted by Duf(a)D_{\mathbf{u}} f(\mathbf{a}) and is defined as: Duf(a)=f(a)u=i=1nfxi(a)uiD_{\mathbf{u}} f(\mathbf{a}) = \nabla f(\mathbf{a}) \cdot \mathbf{u} = \sum_{i=1}^{n} \frac{\partial f}{\partial x_i} (\mathbf{a}) u_i

    Properties

    • The directional derivative is the rate of change of the function in the direction of u\mathbf{u}.
    • It reduces to the partial derivative when u\mathbf{u} is aligned with one of the coordinate axes.

    3. Relationship Between Gradient and Directional Derivative

    The directional derivative in the direction of a unit vector u\mathbf{u} can be expressed as the dot product of the gradient and the unit vector: 

    Duf(a)=f(a)uD_{\mathbf{u}} f(\mathbf{a}) = \nabla f(\mathbf{a}) \cdot \mathbf{u}

    This relationship shows that the gradient vector provides all the information needed to compute the directional derivative in any direction.

     

    V. Definite and Indefinite Integrals.

    1. Definite Integral

    The definite integral of f(x)f(x) from aa to bb is written as: abf(x)dx\int_{a}^{b} f(x) \, dx

    It is calculated as the difference in the values of an antiderivative F(x)F(x evaluated at the upper and lower limits:

     abf(x)dx=F(b)F(a)\int_{a}^{b} f(x) \, dx = F(b) - F(a)

    It represents the area under the curve of a function between two points on the x-axis. It is a number, not a function, and it accounts for the actual area bounded by the function and the x-axis between two specified limits.

    2. Indefinite Integral

    The indefinite integral of a function f(x)f(x) with respect to xx is written as: f(x)dx\int f(x) \, dx

    The result is a function F(x)F(x) plus an arbitrary constant CC, because the derivative of a constant is zero: 

    f(x)dx=F(x)+C\int f(x) \, dx = F(x) + C

    Here, F(x)=f(x)F'(x) = f(x)

    Basic Rules of Indefinite Integrals

    • Power Rule: xndx=xn+1n+1+C(n1)\int x^n \, dx = \frac{x^{n+1}}{n+1} + C \quad (n \neq -1)
    • Constant Multiple Rule: kf(x)dx=kf(x)dx
    • Sum Rule: (f(x)+g(x))dx=f(x)dx+g(x)dx

    3. Fundamental Theorem of Calculus

    This theorem connects the concept of differentiation and integration and has two parts:

    • First Part: If FF is an antiderivative of ff on an interval [a,b][a, b], then: abf(x)dx=F(b)F(a)\int_{a}^{b} f(x) \, dx = F(b) - F(a)
    • Second Part: If ff is continuous on [a,b][a, b] and FF is defined by: F(x)=axf(t)dt

      Then FF is continuous on [a,b][a, b], differentiable on (a,b)(a, b), and F(x)=f(x)F'(x) = f(x).

     

    VI. Techniques of Integration.

    1. Substitution

    Substitution, or uu-substitution, is used to simplify integrals by making a substitution that transforms the integral into a simpler form.

    Steps:

    • Choose a substitution u=g(x)u = g(x).
    • Compute du=g(x)dx.
    • Rewrite the integral in terms of uu and dudu.
    • Integrate with respect to uu.
    • Substitute back to the original variable.

    2. Integration by Parts

    Integration by parts is based on the product rule for differentiation and is useful for integrating products of functions.

    udv=uvvdu\int u \, dv = uv - \int v \, du

    Steps:

    1. Identify parts of the integrand to set uu and dvdv.
    2. Differentiate uu to find dudu, and integrate dvdv to find vv.
    3. Apply the above formula.

    3. Trigonometric Integrals

    Integrating products of trigonometric functions often involves using trigonometric identities to simplify the integrand.

    Eg:

    Evaluate sin2(x)dx.

    • Use the identity
      sin2(x)=1cos(2x)2\sin^2(x) = \frac{1 - \cos(2x)}{2}.
    • The integral becomes
      1cos(2x)2dx=12(1cos(2x))dx
    • Integrate:
      12(xsin(2x)2)+C=x2sin(2x)4+C\frac{1}{2} \left( x - \frac{\sin(2x)}{2} \right) + C = \frac{x}{2} - \frac{\sin(2x)}{4} + C

    4. Trigonometric Substitution

    Trigonometric substitution is used to simplify integrals involving square roots of quadratic expressions.

     Rules:


     

     

     

     

    5. Partial Fraction Decomposition

    Partial fraction decomposition is used to integrate rational functions by expressing them as a sum of simpler fractions.

    Steps

    • Factor the denominator.
    • Decompose the fraction into partial fractions.
    • Integrate each partial fraction.

    6. Integration by Partial Fractions

    Integration by partial fractions is particularly useful for rational functions where the degree of the numerator is less than the degree of the denominator.

    Eg:

    Evaluate 2x+3x2x6dx\int \frac{2x+3}{x^2-x-6} \, dx.

    • Factor the denominator:
      x2x6=(x3)(x+2)x^2 - x - 6 = (x-3)(x+2).
    • Decompose:
      2x+3(x3)(x+2)=Ax3+Bx+2\frac{2x+3}{(x-3)(x+2)} = \frac{A}{x-3} + \frac{B}{x+2}
    • Find AA and BB:
      2x+3=A(x+2)+B(x3)2x + 3 = A(x + 2) + B(x - 3).
      Solving gives A=1, B=1B = 1.
    • The integral becomes
      (1x3+1x+2)dx=1x3dx+1x+2dx
    • Integrate:
      lnx3+lnx+2+C=ln(x3)(x+2)+C

     

    VII. Multiple Integrals.

    The concept of integration to functions of more than one variable, enabling the calculation of volumes, areas, and other quantities in higher dimensions.

    1. Double Integrals

    The double integral of f(x,y)f(x, y) over a region RR in the xy-plane is written as:

     Rf(x,y)dA\iint_R f(x, y) \, dA

    If RR is a rectangular region [a,b]×[c,d][a, b] \times [c, d], the double integral can be expressed as an iterated integral: 

    Rf(x,y)dA=abcdf(x,y)dydx\iint_R f(x, y) \, dA = \int_{a}^{b} \int_{c}^{d} f(x, y) \, dy \, dx

    Eg:

    Evaluate R(x+y)dA\iint_R (x + y) \, dA, where RR is the rectangle [0,1]×[0,2][0, 1] \times [0, 2].

    R(x+y)dA=0102(x+y)dydx\iint_R (x + y) \, dA = \int_{0}^{1} \int_{0}^{2} (x + y) \, dy \, dx

    First, integrate with respect to yy:

    02(x+y)dy=[xy+y22]02=2x+2\int_{0}^{2} (x + y) \, dy = \left[ xy + \frac{y^2}{2} \right]_{0}^{2} = 2x + 2

    Next, integrate with respect to xx:

    01(2x+2)dx=[x2+2x]01=1+2=3\int_{0}^{1} (2x + 2) \, dx = \left[ x^2 + 2x \right]_{0}^{1} = 1 + 2 = 3

    So, R(x+y)dA=3\iint_R (x + y) \, dA = 3

    2. Triple Integrals

    To integrate functions of three variables over a three-dimensional region.

    The triple integral of f(x,y,z)f(x, y, z) over a region QQ in three-dimensional space is written as:
    Qf(x,y,z)dV

    If QQ is a rectangular box [a,b]×[c,d]×[e,f][a, b] \times [c, d] \times [e, f], the triple integral can be expressed as an iterated integral:  

    Qf(x,y,z)dV=abcdeff(x,y,z)dzdydx\iiint_Q f(x, y, z) \, dV = \int_{a}^{b} \int_{c}^{d} \int_{e}^{f} f(x, y, z) \, dz \, dy \, dx

     

    VIII. Line and Surface Integrals.

    1. Line Integrals

    Line integrals, also known as path integrals, integrate a function along a curve.

    For a scalar field f(x,y,z)f(x, y, z) and a curve CC parameterized by r(t)=x(t),y(t),z(t)\mathbf{r}(t) = \langle x(t), y(t), z(t) \rangle with tt in [a,b][a, b], the line integral of ff along CC is:

    Cfds=abf(r(t))r(t)dt\int_C f \, ds = \int_a^b f(\mathbf{r}(t)) \|\mathbf{r}'(t)\| \, dt

    For a vector field F=P,Q,R\mathbf{F} = \langle P, Q, R \rangle, the line integral along CC is:


    C
    Fdr=abF(r(t))r(t)dt

    2. Surface Integrals

    Surface integrals integrate a function over a surface in three-dimensional space.

    For a scalar field f(x,y,z)f(x, y, z) and a surface SS parameterized by r(u,v)=x(u,v),y(u,v),z(u,v)\mathbf{r}(u, v) = \langle x(u, v), y(u, v), z(u, v) \rangle with (u,v)(u, v) in a region DD, the surface integral is:

    SfdS=Df(r(u,v))ru×rvdudv\iint_S f \, dS = \iint_D f(\mathbf{r}(u, v)) \|\mathbf{r}_u \times \mathbf{r}_v\| \, du \, dv

    For a vector field F=P,Q,R\mathbf{F} = \langle P, Q, R \rangle, the surface integral over SS is:


    S
    FdS=DF(r(u,v))(ru×rv)dudv
    \iint_S \mathbf{F} \cdot d\mathbf{S} = \iint_D \mathbf{F}(\mathbf{r}(u, v)) \cdot (\mathbf{r}_u \times \mathbf{r}_v) \, du \, dv


    Popular posts from this blog

    Artificial intelligence on Cloud

      Cloud computing is a technology model that enables convenient, on-demand access to a shared pool of computing resources (such as servers, storage, networking, databases, applications, and services) over the internet. Instead of owning and maintaining physical hardware and infrastructure, users can access and use computing resources on a pay-as-you-go basis, similar to a utility service.  Cloud computing also has deployment models, indicating how cloud services are hosted and made available to users: Public Cloud: Services are provided over the public internet and are available to anyone who wants to use or purchase them. Examples include AWS, Azure, and Google Cloud. Private Cloud: Cloud resources are used exclusively by a single organization. Private clouds can be hosted on-premises or by a third-party provider. Hybrid Cloud: Combines elements of both public and private clouds. It allows data and applications to be shared between them, offering greater flexibility a...

    Mathematics for Artificial Intelligence : Multivariate Analysis

     A simplified guide on how to prep up on Mathematics for Artificial Intelligence, Machine Learning and Data Science: Multivariate Analysis (Important Pointers only)   Module VIII : Multivariate Analysis  Multivariate analysis is a branch of statistics that deals with the observation and analysis of more than one statistical outcome variable at a time. It is used to understand the relationships between multiple variables simultaneously and to model their interactions. I. Principal Component Analysis (PCA). Principal Component Analysis (PCA) is a statistical technique used to simplify a dataset by reducing its dimensions while retaining most of the variance in the data. Important Concepts: Dimensionality Reduction : PCA reduces the number of dimensions (features) in the dataset while preserving as much variability (information) as possible. Principal Components : These are new, uncorrelated variables formed from linear combinations of the original variables. The first prin...

    Natural Language Processing - I

        Natural Language Processing is a subfield of AI that focuses on the interaction between computers and human languages. The primary goal of NLP is to enable machines to understand, interpret, and generate human language in a way that is both meaningful and valuable. NLP in AI involves the development of algorithms and models that allow computers to process and analyze natural language data. This includes tasks such as text parsing, sentiment analysis, language translation and speech recognition. NLP applications can be found in various domains, including virtual assistants, chatbots, language translation services and sentiment analysis tools.  Tasks of NLP :   Text Classification: Sentiment Analysis: Determining the sentiment expressed in a piece of text (positive, negative, neutral). Topic Classification: Categorizing a document or piece of text into predefined topics or categories. Named Entity Recognition (NER): Identifying and classifying entiti...