Univariate Calculus: Continuity and Differentiability
Machine Learning Foundations: Recap of Univariate Calculus
Overview of Continuity and Differentiability
- The lecture begins with a recap of continuity and differentiability, focusing on real-valued one-dimensional functions f: mathbbR to mathbbR .
- A function f is continuous at a point x^* in mathbbR if for all sequences converging to x^* , the function values converge to f(x^*) .
- This can be expressed compactly as:
- If x_i to x^* , then f(x_i) to f(x^*).
Example 1: Continuity of f(x) = x^2
- Testing continuity at x^* = 2:
- Any sequence converging to 2 should have its function values converge to 4.
- An example sequence converging to 2 is given (e.g., 3, 2.5, 2.25), showing that as these approach 2, their squares approach 4.
- Concludes that the function f(x)=x^2 is continuous everywhere.
Example 2: Discontinuity in Piecewise Function
- Introduces a piecewise function defined as:
- f(x) = -1 if x < 0,
- f(0)=0,
- f(x)=1 if x > 0.
- Two sequences are considered that both converge to zero but yield different limits for their respective function values:
- First sequence yields constant value of one.
- Second sequence yields constant value of minus one.
Analysis of Discontinuity
- The first sequence converges to zero while the second does not match this limit, violating the definition of continuity.
- Even if we redefine the value at zero (e.g., setting it to +1), discontinuity remains due to conflicting limits from different sequences.
General Definition and Examples
- A function is continuous at all points in its domain; thus, it’s classified as continuous overall only when this holds true universally across its domain.
- Provides an example where the function is continuous everywhere (f(x)=x^2) versus another example which demonstrates discontinuity (f(x)) due to undefined behavior at certain points.
Additional Examples
- Discusses another piecewise-defined function:
- Defined as:
- For x > 1,;f(x)=2x+1
- For x ≤ 1,;f(x)=3
Understanding Continuity and Differentiability in Functions
The Concept of Infinity and Function Limits
- Infinity is not a valid real number; thus, defining limits around it can be problematic. For instance, the sequence x_i = 1/2, 1/4, ldots converges to zero while f(x_i) = 1, 2, 4, 8, ldots does not converge.
- The function f(x) = 1/x is continuous only when restricted to positive values. However, including zero in its domain results in discontinuity.
Examples of Discontinuous Functions
- Another example is f(x) = sin(1/x) . Using the same sequence as before shows that while x_i to 0 , f(x_i) = cos(1), cos(2), ... does not converge.
- This demonstrates that both functions discussed are examples of discontinuous functions due to their behavior near zero.
Differentiability Defined
- A function f: R to R is differentiable at a point x^* in R if the limit
[
lim_xto x^* (f(x)-f(x^))/(x-x^)
]
exists. If this limit exists, it represents the derivative denoted as f'(x^*).
- If a function is not continuous at a point x^* , it cannot be differentiable there. However, continuity does not guarantee differentiability.
Non-Differentiable Continuous Functions
- An example of a continuous but non-differentiable function is f(x)=|x| . At x^*=0, different sequences approaching zero yield different limits for the derivative expression.
- Specifically:
- For positive sequences: Limit converges to 1.
- For negative sequences: Limit converges to -1.
This discrepancy indicates that the derivative does not exist at this point.
Further Examples of Differentiability
- Consider two piecewise functions:
- Function A:
- If x ≥ 2: f(x)=4x+2
- If x < 2: f(x)=2x+8
This function is discontinuous at x^*=2.
- Function B:
- If x ≥ 2: f(x)=4x+2
- If x < 2: f(x)=2x+6
This function is continuous but still non-differentiable at that point due to differing left-hand and right-hand limits.
Understanding Derivatives Through Limits
Definition of the Derivative
- The derivative f'(x^) is defined as the limit of the difference quotient as x approaches x^ .
- This can be expressed mathematically as:
[
f'(x^) = lim_x to x^ f(x) - f(x^)/x - x^
]
- An alternative expression for the derivative is:
[
f'(x^) = lim_h to 0 f(x^ + h) - f(x^*)/h
]
Interpretation of Limits
- The second expression is often easier to interpret, especially when considering sequences approaching zero (e.g., h = 1/2, 1/4, ...).
- For example, if we set x^* = a , then we can visualize points on a graph corresponding to these limits.
Visualizing Derivatives with Triangles
- By plotting points such as (x^, f(x^)) , (x^* + h, f(x^* + h)), and others, one can form a triangle that helps in understanding the slope.
- The vertical side length represents the change in function values: f(x^* + h) - f(x^*).
Reducing Interval Size
- As we reduce h, for instance from 1 to 0.5 or smaller fractions, we observe how this affects our triangle's dimensions and thus our slope approximation.
- Continuing this reduction leads us closer to finding the true derivative value.
Convergence Towards Derivative
- As h approaches zero, the line connecting points becomes more accurate in representing the function's behavior at that point.