\documentclass{article}
\usepackage{amssymb,amsmath,hyperref,enumerate}
\begin{document}
\providecommand{\at}{\restriction}
\providecommand{\ddx}{\frac{d}{dx}}
\renewcommand{\o}{\circ}

## Newton's method

\[ x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} \]

Example:
    \[ e^{\sin(\frac{\pi}{2} x)} = x \]
    Let $f(x) = e^{\sin(\frac{\pi}{2} x)} - x$
    \[ f'(x) = \frac{\pi}{2}\cos(\frac{\pi}{2}x)e^{\sin(\frac{\pi}{2} x)} - 1
    \]

    \begin{align*}
      x_0 &= 2\\
      x_1 &= 1.6110154703516575\\
      x_2 &= 1.6609035259641185\\
      x_3 &= 1.6611375113211584\\
      x_4 &= 1.6611375194231848\\
      x_5 &= 1.6611375194231848\\
    \end{align*}
    
    but

    \begin{align*}
      x_0 &= 3,
      x_1 &= 0.36787944117144233\\
      x_2 &= -0.7004442394773245\\
      x_3 &= 0.8682758685413106\\
      x_4 &= 13.55349391880111\\
      \ldots
      x_{100} &= -201.15250823446343\\
      \ldots
      x_{130} &= 1.6611375194231848\\
    \end{align*}

Failure:
    \[ f(x) := x^{1/3} \]
    \[ f'(x) = (1/3)x^{-2/3} \]
    \[ \frac{f(x)}{f'(x)} = 3x \]
    So $x_{n+1} = -2x_n$, so diverges unless $x_0=0$.

## Chain rule

\[ (f \o g)' = g' (f' \o g) \]

Explanation in terms of linear approximations:
    Near $b$, $g(x) ~~ g(b) + g'(b)(x-b)$
    Near $g(b)$, $f(u) ~~ f(g(b)) + f'(g(b))(u-g(b))$
    So near $b$,
	\begin{align*}
	    f(g(x))
	    &~~ f(g(b) + g'(b)(x-b)) \\
	    &~~ f(g(b)) + f'(g(b))(g(b)+g'(b)(x-b)-g(b)) \\
	    &= f(g(b)) + g'(b)f'(g(b))(x-b)
	\end{align*}

Example:
    \[ \ddx e^{\sin(x)} = (\exp \o \sin)'(x) = \sin'(x) \exp'(\sin(x))
    = \cos(x) e^{\sin(x)} \]

Alternative notation:
    if $u$ is a function of $x$ and $y$ is a function of $u$, say
    $u=g(x)$ and $y=f(u)=f(g(x))$, then
    \[ \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx} \]

Example:
    \[\ddx (x^3-1)^9\]
    $y:=(x^3-1)^9$, $u:=x^3-1$, so $y=u^9$;
    so 
    \[\ddx \sqrt{x^3-1} = \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx}
    = 9u^8 3x^2 = 27x^2(x^3-1)^8 .\]


# Differentiating invertible functions
Suppose $f$ is invertible, so $x=f^{-1}(f(x))$.

Suppose $f^{-1}$ is differentiable. Chain rule:
  \[ 1 = \ddx x = \ddx f^{-1}(f(x)) = f'(x)f^{-1}{'}(f(x)) \]
so
  \[ f^{-1}{'}(f(x)) = \frac{1}{f'(x)} .\]
Fact:
  If $f$ is invertible and is differentiable at $x$, then $f^{-1}$ is
  differentiable at $f(x)$, and $f^{-1}{'}(f(x)) = \frac{1}{f'(x)}$.

Examples:
    \[ \ln'(\exp(x)) = \frac{1}{\exp'(x)} = \frac{1}{\exp(x)} \]
i.e.
    \[ \ln'(y) = \frac{1}{y} .\]

    \[ \arcsin'(\sin(x)) = \frac{1}{\cos(x)} \]
Now $cos(x) = \sqrt{1-sin(x)^2}$, so
    \[ \arcsin'(y) = \frac{1}{\sqrt{1-y^2}} \]

    \[ \arctan'(\tan(x)) = \cos^2(x) = \frac{1}{1+\tan^2(x)}\]
    \[ \arctan'(y) = \frac{1}{1+y^2} \]

Power rule:
    For $t$ a real number,
    \[ \ddx x^t = \ddx e^{\ln x^t} = \ddx e^{t \ln x} = \frac{t}{x} e^{t\ln x}
    = tx^{t-1} \]

## Implicit differentiation
Suppose we know some relation between $x$ and $y$, e.g.
    \[ x^2 + y^2 = 1 .\]
Here, $y$ isn't a function of $x$.

But if we restrict attention to $y >= 0$, then $y$ is a function of $x$;
similarly for $y <= 0$. These functions are /implicitly/ defined by
$x^2+y^2=1$.

Restricting to a function in this way, it makes sense to differentiate with
respect to $x$:
    \[ 0 = \ddx 1 = \ddx (x^2+y^2) = \ddx x^2 + \ddx y^2 = 2x +
    \frac{dy}{dx}2y \]
and we conclude that, whichever function we chose,
  \[ \frac{dy}{dx} = \frac{-2x}{2y} = -\frac{x}{y} \]
for all $x$ at which the function is differentiable.

Confirm this agrees with the chain rule.

Another example: TODO

\end{document}
