# MIT OCW Single Variable Calculus - Week 1

### Differentiation

#### What is a derivative?

Geometric interpretation

Consider the problem of finding the tangent line to some function $$y=f(x)$$ at $$P=(x_0,y_0)$$:

The tangent line has an equation of the form $$y – y_0 = m(x – x_0)$$, where m is the slope or gradient of the line.
Finding $$y_0$$ is easy – $$y_0 = f(x_0)$$.
Finding m involves calculus – $$m = f’(x_0)$$.
That is, $$f’(x_0)$$, the derivative of $$f$$ at $$x_0$$ is the slope of the tangent line to $$y = f(x)$$ at P.

Consider the following graph:

How do we know which of these two lines is the tangent, given that both pass through the same point?
Lets define the point where the secant and the tangent intersect as P, and the other point on the secant as Q.
As the point Q gets closer to the point P, the slope of the secant line starts to match the slope of the tangent line.
Therefore:
The tangent is the limit of the secant line $$PQ$$ as the point $$Q \rightarrow P$$, assuming P is fixed.

Again consider the secant line $$PQ$$.
Calculating the gradient of $$PQ$$:
The difference between Q’s x value and P’s x value is known as $$\Delta x$$ (delta x), or the change in x.
The change in y is called $$\Delta f$$ (in this case?).
The gradient between $$P$$ and $$Q$$ is the ratio of $$\frac{\Delta f}{\Delta x}$$.
As the point Q gets closer to P, $$\Delta x$$ gets smaller.
Thus $$m = \lim_{\Delta x \to 0} \frac{\Delta f}{\Delta x}$$

If P is the point $$(x_0, f(x_0))$$, then we can represent Q as $$(x_0 + \Delta x, f(x_0 + \Delta x))$$.
Therefore $$m = \lim_{\Delta x \to 0} \frac{f(x_0 + \Delta x) – f(x_0)}{\Delta x}$$.
This is the heart of the derivative.

Example:
Consider the graph for $$\frac{1}{x}$$

Find the tanget at point $$x_0$$:
$$m = \lim_{\Delta x \to 0} \frac{ \frac{1}{x_0 + \Delta x} – \frac{1}{x_0} }{\Delta x}$$
$$m = \lim_{\Delta x \to 0} \frac{1}{\Delta x}\left( \frac{ x_0 – (x_0 + \Delta x) }{ (x_0 + \Delta x)x_0 } \right)$$
$$m = \lim_{\Delta x \to 0} \frac{1}{\Delta x}\left( \frac{ -\Delta x }{ (x_0 + \Delta x)x_0 } \right)$$
$$m = \lim_{\Delta x \to 0} -\frac{1}{ (x_0 + \Delta x)x_0 }$$
$$m \rightarrow -\frac{1}{ x_0^2 }$$

Example 2:
Find the area of the triangle formed by the axes and the curve described by $$y = \frac{1}{x}$$.
This is a word problem with only one part of calculus – the rest is regular math.
Graph the problem:

The only part of the problem that involves calculus is finding the tangent. We found the gradient $$m$$ above, so lets use that.
$$y – y_0 = -\frac{1}{x_0^2}(x – x_0)$$
To calculate the area of the triangle, we need the base length (along the $$x$$ axis) and the base height (along the $$y$$ axis).
We can find those by calculating the $$x$$ intercept and $$y$$ intercepts.
$$x$$ intercept is at $$y = 0$$, and we can express $$y_0$$ in terms of $$f(x)$$:
$$– \frac{1}{x_0} = -\frac{1}{x_0^2}(x – x_0)$$
$$– \frac{1}{x_0} = -\frac{x}{x_0^2} + \frac{1}{x_0}$$
$$\implies \frac{x}{x_0^2} = \frac{2}{x_0}$$
$$\implies x = 2x_0$$
Using symmetry, we can find the $$y$$ intercept quickly.
$$y = \frac{1}{x} \implies xy = 1 \implies x = \frac{1}{y}$$
$$\therefore y = 2y_0$$
The area of a triangle is $$\frac{1}{2}$$ base x perpendicular height.
$$\therefore area = \frac{1}{2}(2_x0)(2y_0) = 2x_0y_0$$ = 2
The area is 2 because $$y = \frac{1}{x}$$, and $$xy$$ will always equal 1.

Notation:
$$y = f(x), \Delta y = \Delta f$$
$$f’ = \frac{\delta f}{\delta x} = \frac{\delta y}{\delta x} = \frac{\delta}{\delta x}f = \frac{\delta}{\delta x}y$$

Example 3:
$$y = \frac{\delta}{\delta x}x^n$$
$$\frac{\Delta f}{\Delta x} = \lim_{\Delta x \to 0} \frac{(x + \Delta x)^n – x^n}{\Delta x}$$
In order to solve this, we need to revist the binomial theorem (algebra).
Binomial theorem states that:
$$(x + \Delta x)^n = (x + \Delta x) … (x + \Delta x)$$
$$= x^n + nx^{n-1} + O((\Delta x)^n)$$
continuing:
$$\frac{\Delta f}{\Delta x} = \frac{1}{\Delta x}\big((x + \Delta x)^n – x^n \big)$$
$$\frac{\Delta f}{\Delta x} = \frac{1}{\Delta x}\big(x^n + nx^{n-1}\Delta x + O((\Delta x)^n) – x^n \big)$$
$$\frac{\Delta f}{\Delta x} = \frac{1}{\Delta x}\big(nx^{n-1}\Delta x + O((\Delta x)^n) \big)$$
$$\frac{\Delta f}{\Delta x} = nx^{n-1} + O((\Delta x)^n)$$
$$\frac{\Delta f}{\Delta x} = \lim_{\Delta x \to 0} nx^{n-1} + O((\Delta x)^n) = nx^{n-1}$$
$$\therefore \frac{\delta}{\delta x}x^n = nx^{n-1}$$

### Rate of Change

Geometrically, a derivative can be thought of as the slope of a tangent line for a curve.
It can also be considered from the point of view of relative rate of change. That is, the change in variables $$x$$ and $$y$$ for a given function $$f(x)$$.
$$\frac{\Delta x}{\Delta y}$$ is the average rate of change – that is, the entire change over the entire interval.
$$\frac{\delta x}{\delta y}$$ is the average rate of change limited, and is the instantaneous rate of change.

Examples:
1. q = charge, $$\frac{\delta q}{\delta t}$$ = current. The rate of change in charge over time is current.
2. s = distance, $$\frac{\delta s}{\delta t}$$ = speed. The rate of change in distance over time is speed.

Consider the MIT pumpkin drop:
From the top of one of the buildings in MIT, on Halloween, students drop pumpkins from the top of building to the ground.
Assume the building is 80m high, and assume the rate of acceleration due to gravity is 5m2 (not 9.8m2).
$$h = 80 – 5t^2$$
at t = 0, h = 80
at t = 4, h = 0

The average speed is:
$$\frac{\Delta h}{\Delta t} = \frac{0 – 80}{4 – 0} = -20m/s$$

The instantaneous speed as it hits the ground is:
$$\frac{\delta}{\delta t}h = 0 – 10t$$ (differentiated the function for height)
at t = 4, instantaneous speed is -40m/s.

Examples that don’t involve time:
3. T = temperature, $$\frac{\delta T}{\delta x}$$ = temperature gradient (used in weather forecasting & airflow)
4. Sensitivity of measurements

## Limits & Continuity

Left & right hand limits.
$$\lim_{x \to x_0^+}$$ – right hand limit. Says that x is bigger than $$x_0$$ and we’re approaching $$x_0$$ with a negative $$\Delta$$
$$\lim_{x \to x_0^-}$$ – left hand limit. Says that x is smaller than $$x_0$$ and we’re approaching $$x_0$$ with a positive $$\Delta$$

Example:
$$f(x) = \left\{ \begin{array}{l l} x + 1 & \quad x > 0\\ -x + 2 & \quad x < 0\\ \end{array} \right.$$

$$\lim_{x \to x_0^+} f(x) = \lim_{x \to x_0} x + 1 = 1$$

$$\lim_{x \to x_0^-} f(x) = \lim_{x \to x_0^-} -x + 2 = 2$$

Note: we didn’t need x = 0 value.

Continuity:
$$f(x)$$ is continuous at $$x_0$$ when $$\lim_{x \to x_0} = f(x_0$$
Requirements:
- $$\lim_{x \to x_0} f(x)$$ exists (from left & right, and left & right must be the same)
- $$f(x_0)$$ is defined
- Both of the above are equal to each other

Continuous functions are easier to calculate limits for because you can just insert the $$x_0$$ term into the function and determine the limit.

Discontinuity:
If $$f(x)$$ is not continuous, then it is discontinuous.
Jump discontinuity – Limit from left and right exist but are not equal
Removable discontinuity – Limit from left and right are equal. Discontinuity can be removed by redefining the function for the point of discontinuity.
Example:
$$\begin{array}{1 1} g(x) = \frac{sin x}{x} \\ h(x) = \frac{1 – cosx}{x} \end{array}$$
g(0) is undefined, but:
$$\begin{array}{1 1} \lim_{x \to 0} \frac{sin x}{x} = 1 \\ \lim_{x \to 0} \frac{1 – cos x}{x} = 0 \end{array}$$

These functions have a removable discontinuity at x = 0

Infinite discontinuity
Consider $$\frac{1}{x}$$:
$$\begin{array}{1 1} \lim_{x \to x_0^+} \frac{1}{x} = \infty \\ \lim_{x \to x_0^-} \frac{1}{x} = -\infty \end{array}$$

Other (ugly) discontinuities
$$y = sin \frac{1}{x} \text{as} \; x \to 0$$
No left or right limit

### Differential implies continuous theorem

If f is differentiable at $$x_0$$, then x is continuous at $$x_0$$
Proof:
$$\lim_{x \to x_0} f(x) – f(x_0) = 0$$

$$\lim_{x \to x_0} \frac{f(x) – f(x_0)}{x – x_0} (x – x_0) = f’(x_0) . 0 = 0$$