Introduction to Probability

Multivariable Calculus

Algorithms: Part II

Algorithms: Part I

Introduction to Software Design and Architecture

Calculus Two: Sequences and Series

LAFF Linear Algebra

Stanford Machine Learning

Calculus One

Computational Thinking

Effective Thinking Through Mathematics

CS50 Introduction to Computer Science


Week 11-12 - Antidifferentiation & Integration


  • Anti-differentiation is a bridge between the differentiation and the integration.
  • Theorem If ff is an antiderivative of ff on an interval I, then the most general antiderivative of ff on I is F(x)+CF(x) + C where C is an arbitrary constant.
  • the sum of antiderivatives
    • (f(x)+g(x))dx=(f(x))dx+(g(x)dx\int(f(x) +g(x)) dx = \int(f(x)) dx + \int(g(x) dx
  • The antiderivative of f(mx+b)f(mx+b)
    • f(mx+b)dx=F(mx+b)m+C\int f(mx+b) dx = \dfrac{F(mx+b)}{m} + C


Summation Notation

The Area Problem

  • Find the area of the region S that lies under the curve y=f(x)y = f(x) from a to b.
  • Riemann Sum:
    • Patition the intervel [a,b][a, b] and x0=a<x1<x2<<xn=bx_0 = a < x_1 < x_2 < \ldots < x_n = b. Choose sample points xix_i, then $$\text{Area}\ \approx \sum_{i=1}^nf(x_i) \cdot (x_i - x_{i-1})$$
    • Left Riemann Sum: xi=xi1x_i^* = x_{i-1}
      • i=1nf(xi1)(xixi1)\displaystyle\sum_{i=1}^nf(x_{i-1}) \cdot (x_i-x_{i-1})
    • Right Riemann Sum: xi=xix_i^* = x_{i}
      • i=1nf(xi)(xixi1)\displaystyle\sum_{i=1}^nf(x_{i}) \cdot (x_i-x_{i-1})
    • PS: xix_i^* can be any number in the ith subinterval [xi1,xi][x_{i-1}, x_i].

Definition of a Definite Integral

  • If ff is a function defined for axba \le x \le b, we divide the interval [a,b][a, b] into n subintervals of equal width Δx=(ba)/n\Delta x = (b - a)/n. We let x0(=a),x1,x2,,xn(=b)x_0(=a), x_1, x_2, \ldots, x_n(=b) be the endpoints of these subintervals and we let x1,x2,,xnx_1^*, x_2^*, \ldots, x_n^* be any samples points in these subintervals, so xx^* lies in the ith subinterval [xi1,xi][x_{i-1}, x_i]. Then the definite integral of f from a to b is $$\int_a^bf(x)dx = \lim_{n \to \infty}^n f(x_i^*) \Delta x$$
  • provided that this limit exists and gives the same value for all possible choices of sample points. If it does exist, we say that f is integrable on [a,b][a, b].

Compute Integrals

  • What is the integral of x^2 from x=0 to 1? (01x2dx\int_0^1 x^2 dx)
    • 01x2dx=i=1nf(xi)(xixi1)\displaystyle \int_0^1 x^2 dx = \sum_{i=1}^n f(x_i^*) \cdot (x_i - x_{i-1})
    • Each rectangle has width 1n\frac{1}{n} and the heights are the values of the function f(x)=x2f(x) = x^2 at the points 1n,2n,,nn\frac{1}{n}, \frac{2}{n}, \ldots, \frac{n}{n}; that is, the heights are (1n)2,(2n)2,,(nn)2(\frac{1}{n})^2, (\frac{2}{n})^2, \ldots, (\frac{n}{n})^2.
    • 01x2dx=limni=1n(in)21n=limn1n2i=1ni21n=limn1n3i=1ni2=limn(1n3(n)(n+1)(2n+1)6)=limn(1n32n3+3n2+n6)=13\begin{aligned}\int_0^1 x^2 dx &= \lim_{n \to \infty} \sum_{i=1}^n (\frac{i}{n})^2 \cdot \frac{1}{n} \\ &= \lim_{n \to \infty} \frac{1}{n^2} \sum_{i=1}^n i^2 \cdot \frac{1}{n} = \lim_{n \to \infty} \frac{1}{n^3} \cdot \sum_{i=1}^n i^2 \\ &= \lim_{n \to \infty}(\frac{1}{n^3} \cdot \frac{(n)(n+1)(2n+1)}{6}) \\ &= \lim_{n \to \infty}(\frac{1}{n^3} \cdot \frac{2n^3+3n^2+n}{6}) \\ &= \frac{1}{3} \end{aligned}
    • So, 301x2dx=013x2dx=13\int_0^1 x^2 dx = \int_0^1 3x^2 dx = 1: like stretching the area vertically, then we get 013x2dx\int_0^1 3x^2 dx
  • What is the integral of x^3 from x = 1 to 2?
    • i=1nf(xi)(xixi1)=i=1nf(2ni)2n=i=1n(2ni)32n=i=1n16n4i3\begin{aligned} \sum_{i=1}^n f(x_i^*) \cdot (x_i - x_{i-1}) &= \sum_{i=1}^n f(\frac{2}{n} \cdot i) \cdot \frac{2}{n} \\ &= \sum_{i=1}^n (\frac{2}{n} \cdot i)^3 \cdot \frac{2}{n} \\ &= \sum_{i=1}^n\frac{16}{n^4} \cdot i^3 \end{aligned}

    • 02x3dx=limni=1n16n4i3=limni=1n16n4i=1ni3=limni=1n16n4(i=1ni)2=limni=1n16n4((n)(n+1)2)2=limn4n2(n+1)2n4=4\begin{aligned}\int_0^2 x^3 dx &= \lim_{n \to \infty} \sum_{i=1}^n \frac{16}{n^4} \cdot i^3 \\ &= \lim_{n \to \infty} \sum_{i=1}^n \frac{16}{n^4} \cdot \sum_{i=1}^n i^3 = \lim_{n \to \infty} \sum_{i=1}^n \frac{16}{n^4} \cdot (\sum_{i=1}^n i)^2 \\ &= \lim_{n \to \infty} \sum_{i=1}^n \frac{16}{n^4} \cdot (\frac{(n)(n+1)}{2})^2 = \lim_{n \to \infty} \frac{4n^2(n+1)^2}{n^4} \\ &= 4 \end{aligned}

    • Use same deduction, we get 01x3dx=14\displaystyle\int_0^1 x^3 dx = \frac{1}{4}
    • Then 02x3dx=01x3dx+12x3dx=1/4+4\displaystyle\int_0^2 x^3 dx = \displaystyle\int_0^1 x^3 dx + \displaystyle\int_1^2 x^3 dx = 1/4 + 4

Properties of the Integral

  • abcdx=c(ba)\displaystyle \int_a^b c dx = c(b-a), where c is any constant
  • ab[f(x)+g(x)]dx=abf(x)dx+abg(x)dx\displaystyle \int_a^b [f(x) + g(x)] dx = \int_a^b f(x) dx + \int_a^b g(x) dx
  • ab[f(x)g(x)]dx=abf(x)dxabg(x)dx\displaystyle \int_a^b [f(x) - g(x)] dx = \int_a^b f(x) dx - \int_a^b g(x) dx
  • abcf(x)dx=cabf(x)dx\displaystyle \int_a^b c f(x) dx = c \int_a^b f(x) dx
  • acf(x)dx+cbf(x)dx=abf(x)dx\displaystyle \int_a^c f(x) dx + \int_c^b f(x) dx = \int_a^b f(x) dx

The Accumulation Function Increasing/Decreasing

  • If f takes on both positive and negative values, as in the figure below, then the Riemann sum is the sum of the areas of the rectangles that lie above the x-axis and the negatives of the areas of the rectangles that lie below the x-axis (the areas of the blue rectangles minus the areas of the gold rectangles).
  • So when f is positive, A(x) increasing, and A’(x) > 0. In other way, when f is negative, A(x) decreasing, and A’(x) < 0.

The Integral of Sin x From -1 To 1

  • 11sinxdx=10sinxdx+01sinxdx=01sin(x)dx+01sinxdx=01sinxdx+01sinxdx=01sinxdx+01sinxdx=0\begin{aligned} \int_{-1}^1 \sin x dx &= \int_{-1}^0 \sin x dx + \int_0^1 \sin x dx \\ &= \int_0^1 \sin (-x) dx + \int_0^1 \sin x dx \\ &= \int_0^1 - \sin x dx + \int_0^1 \sin x dx \\ &= - \int_0^1 \sin x dx + \int_0^1 \sin x dx \\ &= 0 \end{aligned}

  • So, symmetry can be exploited to calculate some integrals.