

# Definitions and key concepts



A **limit** is a way to describe the behavior of a function as it approaches a certain value. It allows us to understand how a function behaves near a point, even if the function is not defined at that point.

The **limit of a function** is denoted by the symbol $\lim_{x \to a} f(x)$. It represents the value that the function approaches as $x$ gets arbitrarily close to $a$.

A function is said to be **continuous** at a point $a$ if it has a limit at that point and the limit is equal to the value of the function at $a$. In other words, a function is continuous at $a$ if it does not have any discontinuity at that point.

A function is said to be **discontinuous** at a point $a$ if it does not have a limit at that point or the limit is not equal to the value of the function at $a$.

## Exercise
Define the following terms: limit, function, continuous, discontinuous.

# Approaching limits



There are two common approaches to finding the limit of a function: the **direct substitution method** and the **squeeze theorem**.

The **direct substitution method** involves substituting the limit value into the function and simplifying the expression. For example, to find the limit of $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches $1$, we can substitute $x = 1$ into the function:

$$\lim_{x \to 1} f(x) = \frac{(1)^2 - 1}{(1) - 1} = \frac{0}{0}$$

The limit is undefined because the function is not defined at $x = 1$.

The **squeeze theorem** is a method to find the limit of a function by comparing it to other functions that are easier to analyze. For example, to find the limit of $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches $1$, we can compare it to the function $g(x) = x + 1$:

$$\lim_{x \to 1} f(x) \le \lim_{x \to 1} g(x) = 2$$

Since $f(x) \le g(x)$ for all $x$ in a neighborhood of $1$, we can conclude that the limit of $f(x)$ as $x$ approaches $1$ is also $2$.

## Exercise
Find the limit of the function $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches $1$ using the direct substitution method.

# Limits of functions



The limit of a **polynomial function** as $x$ approaches infinity is determined by the highest degree term of the polynomial. For example, the limit of $f(x) = x^3 - 2x^2 + 3x$ as $x$ approaches infinity is $+\infty$.

The limit of a **rational function** as $x$ approaches infinity is determined by the highest degree term in the numerator and the highest degree term in the denominator. For example, the limit of $f(x) = \frac{x^2 + 1}{x - 2}$ as $x$ approaches infinity is $+\infty$.

The limit of an **exponential function** as $x$ approaches infinity is determined by the base of the exponential function. For example, the limit of $f(x) = 2^x$ as $x$ approaches infinity is $+\infty$ if the base is greater than $1$.

## Exercise
Find the limit of the function $f(x) = x^3 - 2x^2 + 3x$ as $x$ approaches infinity.

# Continuity and discontinuity



A function is said to be **continuous** at a point $a$ if it has a limit at that point and the limit is equal to the value of the function at $a$. In other words, a function is continuous at $a$ if it does not have any discontinuity at that point.

There are several types of discontinuities:

- **Jump discontinuity**: A function has a jump discontinuity at a point $a$ if the left-hand limit and the right-hand limit are not equal. For example, the function $f(x) = |x|$ has a jump discontinuity at $x = 0$.

- **Removable discontinuity**: A function has a removable discontinuity at a point $a$ if the left-hand limit and the right-hand limit exist and are equal, but the function is not defined at $a$. For example, the function $f(x) = \frac{x^2 - 1}{x - 1}$ has a removable discontinuity at $x = 1$.

## Exercise
Determine whether the function $f(x) = \frac{x^2 - 1}{x - 1}$ is continuous at $x = 1$.

# Derivatives and their applications



The **derivative** of a function is a way to measure the rate of change of the function with respect to its variable. It is denoted by the symbol $f'(x)$ or $\frac{dy}{dx}$.

The **product rule** states that if $f(x) = u(x)v(x)$, then $f'(x) = u'(x)v(x) + u(x)v'(x)$.

The **chain rule** states that if $y = u(v(x))$, then $\frac{dy}{dx} = \frac{du}{dv} \cdot \frac{dv}{dx}$.

## Exercise
Find the derivative of the function $f(x) = x^3 - 2x^2 + 3x$ using the product rule.

# Divergence and convergence of sequences



A sequence is said to be **convergent** if it approaches a limit as $n$ approaches infinity. The limit of a convergent sequence is the value that the sequence approaches.

There are several types of divergence:

- **Divergence to infinity**: A sequence diverges to infinity if its terms approach infinity as $n$ approaches infinity. For example, the sequence $a_n = n$ diverges to infinity.

- **Oscillatory divergence**: A sequence diverges if its terms do not approach a limit as $n$ approaches infinity. For example, the sequence $a_n = (-1)^n$ diverges by oscillation.

## Exercise
Determine whether the sequence $a_n = n$ is convergent or divergent.

# Applying limits and continuity to Python programs



To find the limit of a function in Python, we can use the `math` library to perform mathematical operations. For example, to find the limit of the function $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches infinity, we can write the following code:

```python
import math

def f(x):
    return (x**2 - 1) / (x - 1)

x = 10000
result = f(x)

print(result)
```

To determine whether a function is continuous at a point, we can check whether the function is defined at that point and whether its left-hand and right-hand limits are equal. For example, to determine whether the function $f(x) = \frac{x^2 - 1}{x - 1}$ is continuous at $x = 1$, we can write the following code:

```python
def f(x):
    if x != 1:
        return (x**2 - 1) / (x - 1)
    else:
        return None

left_limit = f(1 - 1e-9)
right_limit = f(1 + 1e-9)

if left_limit == right_limit:
    print("The function is continuous at x = 1.")
else:
    print("The function is not continuous at x = 1.")
```

## Exercise
Write a Python program to find the limit of the function $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches infinity.

# Real-world examples



The concept of limits is widely used in physics, particularly in the study of motion and forces. For example, the limit of a function that describes the acceleration of an object as its velocity approaches infinity can be used to determine the maximum force that can be applied to the object.

Continuity is also important in computer graphics, where functions are used to create shapes and images. For example, a function that describes the height of a mountain as a function of its latitude and longitude must be continuous to ensure that the mountain appears smooth and realistic.

## Exercise
Discuss the application of limits and continuity concepts in the study of motion in physics and the creation of shapes in computer graphics.

# Practice problems and solutions



**Problem 1**: Find the limit of the function $f(x) = \frac{x^2 - 1}{x - 1}$ as $x$ approaches $1$.

**Solution**: Using the direct substitution method, we can substitute $x = 1$ into the function:

$$\lim_{x \to 1} f(x) = \frac{(1)^2 - 1}{(1) - 1} = \frac{0}{0}$$

The limit is undefined because the function is not defined at $x = 1$.

**Problem 2**: Determine whether the function $f(x) = \frac{x^2 - 1}{x - 1}$ is continuous at $x = 1$.

**Solution**: To determine whether the function is continuous at $x = 1$, we can check whether the function is defined at $x = 1$ and whether its left-hand and right-hand limits are equal.

The function is not defined at $x = 1$, so it is not continuous at $x = 1$.

**Problem 3**: Find the limit of the sequence $a_n = n$ as $n$ approaches infinity.

**Solution**: The sequence $a_n = n$ diverges to infinity as $n$ approaches infinity.