# Calculus/Derivatives

## Derivative of a function ${\displaystyle f}$ at a number ${\displaystyle a}$

### Notation

We denote the derivative of a function ${\displaystyle f}$ at a number ${\displaystyle a}$ as ${\displaystyle f'(a)\,\!}$.

### Definition

The derivative of a function ${\displaystyle f}$ at a number ${\displaystyle a}$ a is given by the following limit (if it exists):

${\displaystyle f'(a)=\lim _{h\rightarrow 0}{\frac {f(a+h)-f(a)}{h}}}$

An analagous equation can be defined by letting ${\displaystyle x=(a+h)}$. Then ${\displaystyle h=(x-a)}$, which shows that when ${\displaystyle x}$ approaches ${\displaystyle a}$, ${\displaystyle h}$ approaches ${\displaystyle 0}$:

${\displaystyle f'(a)=\lim _{x\rightarrow a}{\frac {f(x)-f(a)}{x-a}}}$

### Interpretations

#### As the slope of a tangent line

Given a function ${\displaystyle y=f(x)\,\!}$, the derivative ${\displaystyle f'(a)\,\!}$ can be understood as the slope of the tangent line to ${\displaystyle f(x)}$ at ${\displaystyle x=a}$:

##### Example

Find the equation of the tangent line to ${\displaystyle y=x^{2}}$ at ${\displaystyle x=1}$.

##### Solution

To find the slope of the tangent, we let ${\displaystyle y=f(x)}$ and use our first definition:

${\displaystyle f'(a)=\lim _{h\rightarrow 0}{\frac {f(a+h)-f(a)}{h}}\Rightarrow \lim _{h\rightarrow 0}{\frac {\color {Blue}(a+h)^{2}-(a)^{2}}{h}}\Rightarrow \lim _{h\rightarrow 0}{\frac {\color {Blue}a^{2}+2ah+h^{2}-a^{2}}{h}}\Rightarrow \lim _{h\rightarrow 0}{\frac {\color {Blue}h(2a+h)}{h}}\Rightarrow \lim _{h\rightarrow 0}{\color {Blue}(2a+h)}}$

It can be seen that as ${\displaystyle h}$ approaches ${\displaystyle 0}$, we are left with ${\displaystyle f'(a)={\color {Blue}2a}\,\!}$. If we plug in ${\displaystyle 1}$ for ${\displaystyle a}$:

${\displaystyle f'({\color {Red}1})=2({\color {Red}1})\Rightarrow {\color {Red}2}}$

So our preliminary equation for the tangent line is ${\displaystyle y={\color {Red}2}x+b}$. By plugging in our tangent point ${\displaystyle (1,1)}$ to find ${\displaystyle b}$, we can arrive at our final equation:

${\displaystyle {\color {Red}1}=2({\color {Red}1})+b\Rightarrow -1=b}$

So our final equation is ${\displaystyle y=2x-1\,\!}$.

#### As a rate of change

The derivative of a function ${\displaystyle f(x)}$ at a number ${\displaystyle a}$ can be understood as the instantaneous rate of change of ${\displaystyle f(x)}$ when ${\displaystyle x=a}$.

## The derivative as a function

So far we have only examined the derivative of a function ${\displaystyle f}$ at a certain number ${\displaystyle a}$. If we move from the constant ${\displaystyle a}$ to the variable ${\displaystyle x}$, we can calculate the derivative of the function as a whole, and come up with an equation that represents the derivative of the function ${\displaystyle f}$ at any arbitrary ${\displaystyle x}$ value. For clarification, the derivative of ${\displaystyle f}$ at ${\displaystyle a}$ is a number, whereas the derivative of ${\displaystyle f}$ is a function.

### Notation

Likewise to the derivative of ${\displaystyle f}$ at ${\displaystyle a}$, the derivative of the function ${\displaystyle f(x)}$ is denoted ${\displaystyle f'(x)\,\!}$.

### Definition

The derivative of the function ${\displaystyle f}$ is defined by the following limit:

${\displaystyle f'(x)=\lim _{h\rightarrow 0}{\frac {f(x+h)-f(x)}{h}}}$

Also,

${\displaystyle f'(x)=\lim _{h\rightarrow x}{\frac {f(x)-f(h)}{x-h}}}$

or

${\displaystyle f'(x)=\lim _{h\rightarrow 0}{\frac {f(x+h)-f(x-h)}{2h}}}$

## ${\displaystyle {\frac {d(x^{n})}{dx}}}$

 Consider the sequences: ${\displaystyle y=x^{2};\ y+\Delta y=(x+h)^{2}=x^{2}+2xh+h^{2}}$ ${\displaystyle y=x^{3};\ y+\Delta y=(x+h)^{3}=x^{3}+3x^{2}h+3xh^{2}+h^{3}}$ ${\displaystyle y=x^{4};\ y+\Delta y=(x+h)^{4}=x^{4}+4x^{3}h+6x^{2}h^{2}+4xh^{3}+h^{4}}$ ${\displaystyle y=x^{5};\ y+\Delta y=(x+h)^{5}=x^{5}+5x^{4}h+10x^{3}h^{2}+10x^{2}h^{3}+5xh^{4}+h^{5}}$ ${\displaystyle y=x^{6};\ y+\Delta y=(x+h)^{6}=x^{6}+6x^{5}h\ +}$ many terms containing ${\displaystyle h^{2}}$ ${\displaystyle y=x^{n};\ y+\Delta y=(x+\Delta x)^{n}=x^{n}+nx^{n-1}\Delta x\ +}$ many terms containing ${\displaystyle (\Delta x)^{2}}$ ${\displaystyle \Delta y=nx^{n-1}\Delta x\ +}$ many terms containing ${\displaystyle (\Delta x)^{2}}$ Therefore: ${\displaystyle {\frac {\Delta y}{\Delta x}}=nx^{n-1}\ +}$ many terms containing ${\displaystyle \Delta x}$ ${\displaystyle {\frac {dy}{dx}}=\lim _{\Delta x\rightarrow 0}{\frac {\Delta y}{\Delta x}}}$ ${\displaystyle {\frac {d(x^{n})}{dx}}=nx^{n-1}}$ read as "derivative with respect to ${\displaystyle x}$ of ${\displaystyle x}$ to the power ${\displaystyle n}$." Later it will be shown that this is valid for all real ${\displaystyle n}$, positive or negative, integer or fraction.

### Examples

${\displaystyle {\frac {d(x^{4})}{dx}}=4x^{(4-1)}=4x^{3}}$

${\displaystyle {\frac {d(7x^{5})}{dx}}=7{\frac {d(x^{5})}{dx}}=7(5x^{4})=35x^{4}}$

${\displaystyle {\frac {d(p^{3})}{dx}}={\frac {d(p^{3})}{dp}}}$${\displaystyle {\frac {dp}{dx}}=3p^{2}}$${\displaystyle {\frac {dp}{dx}}}$

${\displaystyle {\frac {d(2t^{2}-7T^{3}+x^{7})}{dx}}=4t}$${\displaystyle {\frac {dt}{dx}}-7(3T^{2})}$${\displaystyle {\frac {dT}{dx}}+7x^{6}}$

${\displaystyle {\frac {d(x^{\frac {1}{3}})}{dx}}={\frac {1}{3}}x^{{\frac {1}{3}}-1}={\frac {1}{3}}x^{-{\frac {2}{3}}}}$

## Product Rule

Let ${\displaystyle y=u}$${\displaystyle v}$ where ${\displaystyle u=U(x);\ v=V(x)}$

${\displaystyle y+\Delta y=(u+\Delta u)}$${\displaystyle (v+\Delta v)=u}$${\displaystyle v+u}$${\displaystyle \Delta v+v}$${\displaystyle \Delta u+\Delta u}$${\displaystyle \Delta v}$

${\displaystyle \Delta y=u}$${\displaystyle \Delta v+v}$${\displaystyle \Delta u+\Delta u}$${\displaystyle \Delta v}$

${\displaystyle {\frac {\Delta y}{\Delta x}}=u}$${\displaystyle {\frac {\Delta v}{\Delta x}}+v}$${\displaystyle {\frac {\Delta u}{\Delta x}}+{\frac {(\Delta u)(\Delta v)}{\Delta x}}}$

${\displaystyle {\frac {dy}{dx}}=u}$${\displaystyle {\frac {dv}{dx}}+v}$${\displaystyle {\frac {du}{dx}}}$

### Examples

 Let ${\displaystyle y=x^{\frac {m}{n}}.}$ Calculate ${\displaystyle {\frac {dy}{dx}}}$ ${\displaystyle y^{n}=x^{m}}$ Differentiate both sides. ${\displaystyle ny^{n-1}\cdot {\frac {dy}{dx}}=mx^{m-1}}$ ${\displaystyle {\frac {dy}{dx}}={\frac {mx^{m-1}}{ny^{n-1}}}}$ ${\displaystyle ={\frac {mx^{m-1}}{n(x^{\frac {m}{n}})^{n-1}}}}$ ${\displaystyle ={\frac {mx^{m-1}}{nx^{m-{\frac {m}{n}}}}}}$ ${\displaystyle ={\frac {m}{n}}\cdot x^{m-1-m+{\frac {m}{n}}}}$ ${\displaystyle ={\frac {m}{n}}\cdot x^{{\frac {m}{n}}-1}}$ This shows that ${\displaystyle {\frac {d(x^{n})}{dx}}}$ as above is valid when ${\displaystyle n}$ is a positive fraction.
 Let ${\displaystyle y=x^{-n}={\frac {1}{x^{n}}}}$. Calculate ${\displaystyle {\frac {dy}{dx}}}$. ${\displaystyle yx^{n}=1}$ Differentiate both sides. ${\displaystyle ynx^{n-1}+x^{n}{\frac {dy}{dx}}=0}$ ${\displaystyle {\frac {dy}{dx}}=-{\frac {ynx^{n-1}}{x^{n}}}=-{\frac {nx^{n-1}}{x^{n}x^{n}}}=-nx^{n-1}x^{-2n}=-nx^{-n-1}}$ This shows that ${\displaystyle {\frac {d(x^{n})}{dx}}}$ as above is valid for negative ${\displaystyle n}$.
 Let ${\displaystyle y=x^{-{\frac {m}{n}}}}$. Calculate ${\displaystyle {\frac {dy}{dx}}}$. ${\displaystyle y^{n}=x^{-m}}$ Differentiate both sides. ${\displaystyle ny^{n-1}{\frac {dy}{dx}}=-mx^{-m-1}}$ ${\displaystyle {\frac {dy}{dx}}=-{\frac {mx^{-m-1}}{ny^{n-1}}}=-{\frac {mx^{-m-1}}{n(x^{-{\frac {m}{n}}})^{n-1}}}}$ ${\displaystyle =-{\frac {mx^{-m-1}}{nx^{-m+{\frac {m}{n}}}}}}$ ${\displaystyle =-{\frac {m}{n}}x^{-m-1+m-{\frac {m}{n}}}}$ ${\displaystyle =-{\frac {m}{n}}x^{-{\frac {m}{n}}-1}}$ This shows that ${\displaystyle {\frac {d(x^{n})}{dx}}}$ as above is valid when ${\displaystyle n}$ is a negative fraction.

## Quotient rule

Used where ${\displaystyle y={\frac {U(x)}{V(x)}}}$

${\displaystyle y={\frac {u}{v}}}$

${\displaystyle yv=u}$

${\displaystyle yv'+vy'=u'}$

${\displaystyle vy'=u'-yv'=u'-{\frac {uv'}{v}}}$

${\displaystyle y'={\frac {u'}{v}}-{\frac {uv'}{v^{2}}}={\frac {vu'}{v^{2}}}-{\frac {uv'}{v^{2}}}={\frac {vu'-uv'}{v^{2}}}}$

## Derivatives of trigonometric functions

### sine(x)

${\displaystyle y=\sin(x)}$

${\displaystyle y+\Delta y=\sin(x+\Delta x)=\sin(x)\cos(\Delta x)+\cos(x)\sin(\Delta x)}$

${\displaystyle \Delta y=\sin(x)\cos(\Delta x)+\cos(x)\sin(\Delta x)-\sin(x)}$

${\displaystyle {\frac {\Delta y}{\Delta x}}=\sin(x)}$${\displaystyle {\frac {\cos(\Delta x)-1}{\Delta x}}+\cos(x)}$${\displaystyle {\frac {\sin(\Delta x)}{\Delta x}}}$

The value ${\displaystyle {\frac {\cos(\Delta x)-1}{\Delta x}}}$:

>>> # python code
>>> [ (math.cos(Δx)-1)/Δx for Δx in (.1,.01,.001,.0001,.0000_1,.0000_01,.0000_001,.0000_0001,.0000_0000_1) ]
[-0.049958347219742905, -0.004999958333473664, -0.0004999999583255033,
-4.999999969612645e-05, -5.000000413701855e-06, -5.000444502911705e-07,
-4.9960036108132044e-08, 0.0, 0.0]
>>>


${\displaystyle \lim _{\Delta x\rightarrow 0}{\frac {\cos(\Delta x)-1}{\Delta x}}=\lim _{\Delta x\rightarrow 0}{\frac {-\sin(\Delta x)}{1}}=0}$ by L'Hôpital's rule.

The value ${\displaystyle {\frac {\sin(\Delta x)}{\Delta x}}}$:

>>> # python code
>>> [ math.sin(Δx)/Δx for Δx in (.1,.01,.001,.0001,.0000_1,.0000_01,.0000_001,.0000_0001,.0000_0000_1) ]
[0.9983341664682815, 0.9999833334166665, 0.9999998333333416,
0.9999999983333334, 0.9999999999833332, 0.9999999999998334,
0.9999999999999983, 1.0, 1.0]
>>>


${\displaystyle \lim _{\Delta x\rightarrow 0}{\frac {\sin(\Delta x)}{\Delta x}}=\lim _{\Delta x\rightarrow 0}{\frac {\cos(\Delta x)}{1}}=1}$ by L'Hôpital's rule.

${\displaystyle {\frac {dy}{dx}}=\sin(x)}$${\displaystyle 0+\cos(x)}$${\displaystyle 1=\cos(x)}$

#### Proof of 2 limits

 Figure 1: ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}:}$ Area of sector ${\displaystyle AOB\ \geq }$ area of triangle ${\displaystyle COB.}$ Area of triangle ${\displaystyle COB\ \geq }$ area of sector ${\displaystyle COD.}$ ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}:}$ In the diagram ${\displaystyle OA=OB=1.}$ ${\displaystyle OC=OD=\cos(\theta ).}$ ${\displaystyle CB=\sin(\theta ).}$ Let ${\displaystyle S}$ be the area of a sector of a circle. Then ${\displaystyle {\frac {S}{\pi r^{2}}}={\frac {\theta }{2\pi }}}$ and ${\displaystyle S={\frac {\theta r^{2}}{2}}.}$ Area of sector ${\displaystyle COD={\frac {\theta \cos ^{2}(\theta )}{2}}.}$ Area of triangle ${\displaystyle OCB={\frac {\sin(\theta )\cos(\theta )}{2}}.}$ Area of sector ${\displaystyle AOB={\frac {\theta \cdot 1^{2}}{2}}={\frac {\theta }{2}}.}$ Therefore ${\displaystyle {\frac {\theta }{2}}\ \geq \ {\frac {\sin(\theta )\cos(\theta )}{2}}\ \geq \ {\frac {\theta \cos ^{2}(\theta )}{2}}.}$ ${\displaystyle \theta \ \geq \ \sin(\theta )\cos(\theta )\ \geq \ \theta \cos ^{2}(\theta ).}$ ${\displaystyle {\frac {\theta }{\theta \cos(\theta )}}\ \geq \ {\frac {\sin(\theta )\cos(\theta )}{\theta \cos(\theta )}}\ \geq \ {\frac {\theta \cos ^{2}(\theta )}{\theta \cos(\theta )}}}$ ${\displaystyle {\frac {1}{\cos(\theta )}}\ \geq \ {\frac {\sin(\theta )}{\theta }}\ \geq \ \cos(\theta )}$ ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {1}{\cos(\theta )}}\ \geq \ \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}\ \geq \ \lim _{\theta \rightarrow 0}\cos(\theta )}$ ${\displaystyle 1\ \geq \ \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}\ \geq \ 1}$ Therefore ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}=1.}$
 ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {\cos(\theta )-1}{\theta }}:}$ ${\displaystyle {\frac {\cos(\theta )-1}{\theta }}}$ ${\displaystyle =(-1)\cdot {\frac {1-\cos(\theta )}{\theta }}}$ ${\displaystyle =(-1)\cdot {\frac {1-\cos(\theta )}{\theta }}\cdot {\frac {1+\cos(\theta )}{1+\cos(\theta )}}}$ ${\displaystyle =(-1)\cdot {\frac {\sin(\theta )}{\theta }}\cdot {\frac {\sin(\theta )}{1+\cos(\theta )}}}$ ${\displaystyle \lim _{\theta \rightarrow 0}{\frac {\cos(\theta )-1}{\theta }}}$ ${\displaystyle =\lim _{\theta \rightarrow 0}(-1)\cdot {\frac {\sin(\theta )}{\theta }}\cdot {\frac {\sin(\theta )}{1+\cos(\theta )}}}$ ${\displaystyle =(-1)\cdot \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{\theta }}\cdot \lim _{\theta \rightarrow 0}{\frac {\sin(\theta )}{1+\cos(\theta )}}}$ ${\displaystyle =(-1)\cdot 1\cdot {\frac {0}{1+1}}=0.}$

### cosine(x)

${\displaystyle y=\cos(x)={\sqrt {1-\sin ^{2}(x)}}}$

${\displaystyle y^{2}=1-\sin(x)}$${\displaystyle \sin(x)}$

Differentiate both sides:

${\displaystyle 2y}$${\displaystyle {\frac {dy}{dx}}=-(2\sin(x)\cos(x))}$

${\displaystyle {\frac {dy}{dx}}=-{\frac {\sin(x)\cos(x)}{\cos(x)}}=-\sin(x).}$

### tan(x)

${\displaystyle y=\tan(x)={\frac {\sin(x)}{\cos(x)}}}$

${\displaystyle y\cos(x)=\sin(x)}$

Differentiate both sides:

${\displaystyle y(-\sin(x))+\cos(x)}$${\displaystyle {\frac {dy}{dx}}=\cos(x)}$

${\displaystyle \cos(x)}$${\displaystyle {\frac {dy}{dx}}=\cos(x)+y\sin(x)}$

${\displaystyle {\frac {dy}{dx}}={\frac {\cos(x)+\tan(x)\sin(x)}{\cos(x)}}=1+\tan ^{2}(x)=\sec ^{2}(x)}$

## Derivatives of inverse trigonometric functions

### arcsine(x)

 Figure 2: Graph of ${\displaystyle y=\arcsin(x)}$ and associated curves. ${\displaystyle y=\arcsin(x);\|x\|<=1}$ ${\displaystyle x=\sin(y)}$ ${\displaystyle {\frac {dx}{dy}}=\cos(y)}$ ${\displaystyle {\frac {dy}{dx}}={\frac {1}{\cos(y)}}={\frac {1}{\sqrt {1-\sin ^{2}(y)}}}={\frac {1}{\sqrt {1-x^{2}}}}}$ In the figure to the right you can see that the curves ${\displaystyle y=\arcsin(x),\ x=\sin(y)}$ are the same curve. However curve ${\displaystyle y=\arcsin(x)}$ is limited to ${\displaystyle {\frac {\pi }{2}}>=y>={\frac {-\pi }{2}}.}$ The derivative ${\displaystyle {\frac {dy}{dx}}={\frac {1}{\sqrt {1-x^{2}}}}}$ shows that the slope of ${\displaystyle y=\arcsin(x)}$ is ${\displaystyle 1}$ when ${\displaystyle x=0}$ and infinite when ${\displaystyle x=\pm 1.}$

### arccosine(x)

 Figure 3: Graph of ${\displaystyle y=\arccos(x)}$ and associated curves. ${\displaystyle y=\arccos(x);\|x\|<=1}$ ${\displaystyle x=\cos(y)}$ ${\displaystyle {\frac {dx}{dy}}=-\sin(y)}$ ${\displaystyle {\frac {dy}{dx}}={\frac {-1}{\sin(y)}}={\frac {-1}{\sqrt {1-\cos ^{2}(y)}}}={\frac {-1}{\sqrt {1-x^{2}}}}}$ In the figure to the right you can see that the curves ${\displaystyle y=\arccos(x),\ x=\cos(y)}$ are the same curve. However curve ${\displaystyle y=\arccos(x)}$ is limited to ${\displaystyle \pi >=y>=0.}$ The derivative ${\displaystyle {\frac {dy}{dx}}={\frac {-1}{\sqrt {1-x^{2}}}}}$ shows that the slope of ${\displaystyle y=\arccos(x)}$ is ${\displaystyle -1}$ when ${\displaystyle x=0}$ and infinite when ${\displaystyle x=\pm 1.}$

### arctan(x)

 Figure 4: Graph of ${\displaystyle y=\arctan(x)}$ and associated curves. ${\displaystyle y=\arctan(x)}$ ${\displaystyle x=\tan(y)}$ ${\displaystyle {\frac {dx}{dy}}=\sec ^{2}(y)}$ ${\displaystyle {\frac {dy}{dx}}={\frac {1}{\sec ^{2}(y)}}=\cos ^{2}(y)={\frac {1}{1+x^{2}}}}$ In the figure to the right you can see that the curves ${\displaystyle y=\arctan(x),\ x=\tan(y)}$ are the same curve. However curve ${\displaystyle y=\arctan(x)}$ is limited to ${\displaystyle {\frac {\pi }{2}}>y>{\frac {-\pi }{2}}.}$ The derivative ${\displaystyle {\frac {dy}{dx}}={\frac {1}{\sqrt {1+x^{2}}}}}$ shows that the slope of ${\displaystyle y=\arctan(x)}$ is ${\displaystyle 1}$ when ${\displaystyle x=0}$ and ${\displaystyle 0}$ when ${\displaystyle x=\pm \infty }$

## Derivatives of logarithmic functions

### ${\displaystyle a^{x}}$

${\displaystyle y=a^{x}}$

${\displaystyle y+\Delta y=a^{x+\Delta x}=a^{x}a^{\Delta x}}$

${\displaystyle \Delta y=a^{x}a^{\Delta x}-a^{x}=a^{x}(a^{\Delta x}-1)}$

${\displaystyle {\frac {\Delta y}{\Delta x}}=a^{x}\cdot {\frac {a^{\Delta x}-1}{\Delta x}}}$

Consider the value ${\displaystyle {\frac {a^{\Delta x}-1}{\Delta x}}}$ specifically ${\displaystyle \lim _{\Delta x\rightarrow 0}{\frac {a^{\Delta x}-1}{\Delta x}}}$. L'Hôpital's rule cannot be used here because ${\displaystyle {\frac {d(a^{x})}{dx}}}$ is what we are trying to find.

${\displaystyle a^{\frac {1}{2}}={\sqrt {a}}}$

${\displaystyle (a^{\frac {1}{2}})^{\frac {1}{2}}={\sqrt {\sqrt {a}}}}$

${\displaystyle a^{\frac {1}{2^{3}}}={\sqrt {\sqrt {\sqrt {a}}}}}$

${\displaystyle a^{\frac {1}{2^{n}}}={\sqrt {a}}}$ taken ${\displaystyle n}$ times.

We will look at the expression ${\displaystyle {\frac {a^{\Delta x}-1}{\Delta x}}}$ for different values of ${\displaystyle a}$ with ${\displaystyle \Delta x={\frac {1}{2^{70}}}=8.5e-22}$ (approx) in which case the expression becomes ${\displaystyle (a^{1/2^{70}}-1)*(2^{70})}$ where ${\displaystyle a^{1/2^{70}}}$ is ${\displaystyle {\sqrt {a}}}$ taken ${\displaystyle 70}$ times. This approach is used here because function sqrt() can be written so that it does not depend on logarithmic or exponential operations.

>>> # python code
>>> N=Decimal(2)
>>> v2 = ( [ n for n in (N,) for p in range (0,70) for n in (n.sqrt(),) ][-1] -1 )*(2**70) ; v2
Decimal('0.69314718055994530941743560122437474084363865015406919942144')
>>>
>>> N=Decimal(8)
>>> v8 = ( [ n for n in (N,) for p in range (0,70) for n in (n.sqrt(),) ][-1] -1 )*(2**70) ; v8
Decimal('2.07944154167983592825352768227031325913255072732801782513664')
>>>
>>> N=Decimal(32)
>>> v32 = ( [ n for n in (N,) for p in range (0,70) for n in (n.sqrt(),) ][-1] -1 )*(2**70) ; v32
Decimal('3.46573590279972654709124760144583715956091114572543812435968')
>>>
>>> N=Decimal(128)
>>> v128 = ( [ n for n in (N,) for p in range (0,70) for n in (n.sqrt(),) ][-1] -1 )*(2**70) ; v128
Decimal('4.85203026391961716593059535875094644210510807293198187102208')
>>>


Compare the values v8, v32, v128 with v2:

>>> v8/v2; v32/v2; v128/v2
Decimal('3.00000000000000000000176135549769209744528640235368520610520')
Decimal('5.00000000000000000000587118499230699148996545343403093128046')
Decimal('7.00000000000000000001232948848384468209997247971055570994695')
>>>


We know that ${\displaystyle 8=2^{3};\ 32=2^{5};\ 128=2^{7}}$. The values v2, v8, v32, v128 are behaving like logarithms. In fact ${\displaystyle \lim _{\Delta x\rightarrow 0}{\frac {a^{\Delta x}-1}{\Delta x}}}$ is the natural logarithm of ${\displaystyle a}$ written as ${\displaystyle \ln(a).}$

 Figure 5: Graphs of ${\displaystyle {\frac {a^{x}-1}{x}}}$ for a = ${\displaystyle 2,\ 8,\ 32,\ 128}$ . Figure 5 contains graphs of ${\displaystyle {\frac {a^{x}-1}{x}}}$ for ${\displaystyle a=2,\ 8,\ 32,\ 128}$ with graph of ${\displaystyle {\frac {e^{x}-1}{x}}}$ included for reference. All values of ${\displaystyle x}$ are valid for all curves except where ${\displaystyle x=0.}$

The correct value of ${\displaystyle \ln(2)}$ is:

>>> Decimal(2).ln()
Decimal('0.693147180559945309417232121458176568075500134360255254120680')
>>>


Our calculation produced:

Decimal('0.69314718055994530941743560122437474084363865015406919942144')


accurate to 21 places of decimals, not bad for one line of simple python code using high-school math.

 This method for calculation of ${\displaystyle \ln(a)}$ supposes that function sqrt() is available. Programming language python interprets expression a**b as ${\displaystyle a^{b}.}$ Therefore, in python, ${\displaystyle \ln(2)}$ can be calculated in accordance with the basic definition above: # python code >>> getcontext().prec 101 # Precision of 101. >>> dx = Decimal('1E-50') >>> (2**dx - 1)/dx Decimal('0.69314718055994530941723212145817656807550013436026') # ln(2) >>> (2**(-dx) - 1)/(-dx) Decimal('0.693147180559945309417232121458176568075500134360253') # ln(2) >>> 

When ${\displaystyle y=a^{x},{\frac {dy}{dx}}=a^{x}\cdot \ln(a).}$

The base of natural logarithms is the value of ${\displaystyle a}$ that gives ${\displaystyle \lim _{\Delta x\rightarrow 0}{\frac {a^{\Delta x}-1}{\Delta x}}=1.}$

This value of ${\displaystyle a}$, usually called ${\displaystyle e,=2.718281828459045235360287471352662497757247093699959574.....}$

>>> # python code
>>> N=e=Decimal(1).exp();N
Decimal('2.71828182845904523536028747135266249775724709369995957496697')
>>> ( [ n for n in (N,) for p in range (0,70) for n in (n.sqrt(),) ][-1] -1 )*(2**70)
Decimal('1.0000_0000_0000_0000_0000_0423_51647362715016770651530003719651328')
>>> # ln(e) = 1. Our calculation of ln(e) is accurate to 21 places of decimals.


When ${\displaystyle a=e,{\frac {d(e^{x})}{dx}}=e^{x}}$${\displaystyle \ln(e)=e^{x}}$${\displaystyle 1=e^{x}.}$

### ln(x)

${\displaystyle y=ln(x)}$

${\displaystyle x=e^{y}}$

${\displaystyle {\frac {dx}{dy}}=e^{y}}$

${\displaystyle {\frac {dy}{dx}}={\frac {1}{e^{y}}}={\frac {1}{x}}}$

#### Examples

 ${\displaystyle y=\ln(ax)}$ ${\displaystyle {\frac {dy}{dx}}={\frac {d}{dx}}\ln(ax)={\frac {d}{dx}}(\ln(a)+\ln(x))={\frac {d}{dx}}\ln(a)+{\frac {d}{dx}}\ln(x)={\frac {1}{x}}}$
 ${\displaystyle y=\ln(x^{a})}$ ${\displaystyle {\frac {dy}{dx}}={\frac {d}{dx}}\ln(x^{a})={\frac {d}{dx}}(a\cdot \ln(x))=a\cdot {\frac {d}{dx}}\ln(x)={\frac {a}{x}}}$
 ${\displaystyle y=x^{\frac {m}{n}}}$ Calculate ${\displaystyle {\frac {dy}{dx}}}$ ${\displaystyle y^{n}=x^{m}}$ ${\displaystyle n\cdot \ln(y)=m\cdot \ln(x)}$ ${\displaystyle n\cdot {\frac {1}{y}}\cdot {\frac {dy}{dx}}=m\cdot {\frac {1}{x}}}$ ${\displaystyle {\frac {dy}{dx}}=m\cdot {\frac {1}{x}}\cdot {\frac {y}{n}}}$ ${\displaystyle ={\frac {m}{n}}\cdot {\frac {x^{\frac {m}{n}}}{x}}}$ ${\displaystyle ={\frac {m}{n}}\cdot x^{{\frac {m}{n}}-1}}$ Careful manipulation of logarithms converts exponents into simple constants.

## Chain rule

Used where ${\displaystyle y=G(H(I(x)))}$

### Examples

 ${\displaystyle y=\cos(2x)}$ Let ${\displaystyle y=\cos(u)}$ where ${\displaystyle u=2x}$. {\displaystyle {\begin{aligned}{\frac {dy}{dx}}=&{\frac {dy}{du}}\cdot {\frac {du}{dx}}\\=&-\sin(u)\cdot 2\\=&-2\sin(2x)\\\end{aligned}}}
 ${\displaystyle y=\sin ^{2}(\ln(5x))}$ Let ${\displaystyle y=u^{2}}$ where ${\displaystyle u=\sin(v);\ v=\ln(w);\ w=5x}$. {\displaystyle {\begin{aligned}{\frac {dy}{dx}}=&{\frac {dy}{du}}\cdot {\frac {du}{dv}}\cdot {\frac {dv}{dw}}\cdot {\frac {dw}{dx}}\\=&2u\cdot \cos(v)\cdot {\frac {1}{w}}\cdot 5\\=&2\sin(v)\cdot \cos(\ln(w))\cdot {\frac {1}{5x}}\cdot 5\\=&2\sin(\ln(w))\cdot \cos(\ln(5x))\cdot {\frac {1}{x}}\\=&2\sin(\ln(5x))\cdot \cos(\ln(5x))\cdot {\frac {1}{x}}\\\end{aligned}}}

## Applications of the Derivative

### Shape of curves

The first derivative of ${\displaystyle f(x)=y'}$ or ${\displaystyle f'(x).}$ As shown above, ${\displaystyle f'(x)}$ at any point ${\displaystyle x_{1}}$ gives the slope of ${\displaystyle f(x)}$ at point ${\displaystyle x_{1}.}$

${\displaystyle f'(x_{1})}$ is the slope of ${\displaystyle f(x)}$ when ${\displaystyle x=x_{1}.}$

 Figure 1: Diagram illustrating relationship between ${\displaystyle f(x)=x^{2}-x-2}$and ${\displaystyle f'(x)=2x-1.}$When ${\displaystyle x=0.5,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=0.}$When ${\displaystyle x=0,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=-1.}$When ${\displaystyle x=1,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=1.}$Point ${\displaystyle (0.5,-2.25)}$ is absolute minimum. In the example to the right, ${\displaystyle y=f(x)=x^{2}-x-2}$ and ${\displaystyle y'=f'(x)=2x-1.}$ Of special interest is the point at which ${\displaystyle f'(x)}$ or slope of ${\displaystyle f(x)=0.}$ When ${\displaystyle f'(x)=0,\ x=0.5}$ and ${\displaystyle f(x)=0.5^{2}-0.5-2=-2.25.}$ The point ${\displaystyle (0.5,-2.25)}$ is called a critical point or stationary point of ${\displaystyle f(x).}$ Because ${\displaystyle y'}$ has exactly one solution for ${\displaystyle y'=0,\ f(x)}$ has exactly one critical point. The value of ${\displaystyle y}$ at point ${\displaystyle (0.5,-2.25)}$ is less than ${\displaystyle y}$ at both ${\displaystyle (0,-2),\ (1,-2).}$ Therefore the critical point ${\displaystyle (0.5,-2.25)}$ is a minimum of ${\displaystyle f(x).}$ In this curve ${\displaystyle y=x^{2}-x-2,}$ the point ${\displaystyle (0.5,-2.25)}$ is both local minimum and absolute minimum.
 Figure 1: Diagram illustrating relationship between ${\displaystyle f(x)={\frac {2x^{3}+3x^{2}-12x-8}{8}}}$ and ${\displaystyle f'(x)={\frac {6x^{2}+6x-12}{8}}.}$ When ${\displaystyle x=-2}$ or ${\displaystyle x=1,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=0.}$ When ${\displaystyle x=-3,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=3.}$ When ${\displaystyle x=-1,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=-1.5.}$ When ${\displaystyle x=2,}$ both ${\displaystyle f'(x)}$ and slope of ${\displaystyle f(x)=3.}$ Point ${\displaystyle (-2,1.5)}$ is local maximum. Point ${\displaystyle (1,-1{\frac {7}{8}})}$ is local minimum. In the example to the right, ${\displaystyle y=f(x)={\frac {2x^{3}+3x^{2}-12x-8}{8}}}$ and ${\displaystyle y'=f'(x)={\frac {6x^{2}+6x-12}{8}}.}$ Of special interest are the points at which ${\displaystyle f'(x)}$ or slope of ${\displaystyle f(x)=0.}$ When ${\displaystyle f'(x)=0,\ x=-2}$ and ${\displaystyle f(x)=1.5}$ or When ${\displaystyle f'(x)=0,\ x=1}$ and ${\displaystyle f(x)=-1{\frac {7}{8}}.}$ The points ${\displaystyle (-2,1.5),\ (1,-1{\frac {7}{8}})}$ are critical or stationary points of ${\displaystyle f(x).}$ Because ${\displaystyle y'}$ has exactly two real solutions for ${\displaystyle y'=0,\ f(x)}$ has exactly two critical points. Slope of ${\displaystyle f(x)}$ to the left of ${\displaystyle (-2,1.5)}$ is positive and adjacent slope of ${\displaystyle f(x)}$ to the right of ${\displaystyle (-2,1.5)}$ is negative. Therefore point ${\displaystyle (-2,1.5)}$ is local maximum. Point ${\displaystyle (-2,1.5)}$ is not absolute maximum. Adjacent slope of ${\displaystyle f(x)}$ to the left of ${\displaystyle (1,-1{\frac {7}{8}})}$ is negative and slope of ${\displaystyle f(x)}$ to the right of ${\displaystyle (1,-1{\frac {7}{8}})}$ is positive. Therefore point ${\displaystyle (1,-1{\frac {7}{8}})}$ is local minimum. Point ${\displaystyle (1,-1{\frac {7}{8}})}$ is not absolute minimum.

### Maxima and Minima

#### Electric water heater

 Figure 1(a): Graph of ${\displaystyle V=f(r)}$ and ${\displaystyle {\frac {dV}{dr}}}$ for ${\displaystyle S=100}$ with ${\displaystyle y}$ axis compressed. For maximum ${\displaystyle V,\ r={\sqrt {\frac {S}{3\pi }}}=3.257\dots }$ and ${\displaystyle V=108.578\dots }$ A cylindrical water heater is standing on its base on a hard rubber pad that is a perfect thermal insulator. The vertical curved surface and the top are exposed to the free air. The design of the cylinder requires that the volume of the cylinder should be maximum for a given surface area exposed to the free air. What is the shape of the cylinder? Let the height of the cylinder be ${\displaystyle h}$ and let ${\displaystyle h=Kr}$ where ${\displaystyle r}$ is the radius and ${\displaystyle K}$ is a constant. Surface of cylinder ${\displaystyle =S=\pi r^{2}+2\pi rh=\pi r^{2}+2\pi r(Kr)=\pi r^{2}+2\pi r^{2}K}$ Volume of cylinder ${\displaystyle =V=\pi r^{2}h=\pi r^{2}(Kr)=\pi r^{3}K}$ ${\displaystyle K={\frac {S-\pi r^{2}}{2\pi r^{2}}}}$ ${\displaystyle V=\pi r^{3}\cdot {\frac {S-\pi r^{2}}{2\pi r^{2}}}={\frac {r(S-\pi r^{2})}{2}}={\frac {rS-\pi r^{3}}{2}}}$ ${\displaystyle {\frac {dV}{dr}}={\frac {S-3\pi r^{2}}{2}}}$ For maximum volume, ${\displaystyle {\frac {dV}{dr}}=0}$ Therefore ${\displaystyle S-3\pi r^{2}=0}$ ${\displaystyle S=3\pi r^{2};\ \pi r^{2}(1+2K)=3\pi r^{2};\ 1+2K=3;\ K=1.}$ The height of the cylinder equals the radius.

#### Square and triangle

 Figure 1(b): Graph of parabola ${\displaystyle A=f(s)}$ with ${\displaystyle y}$ axis compressed. A square of side ${\displaystyle h}$ has perimeter ${\displaystyle P_{s}=4h}$ and area ${\displaystyle A_{s}=h^{2}.}$ An equilateral triangle of side ${\displaystyle s}$ has perimeter ${\displaystyle P_{t}=3s}$ and area ${\displaystyle A_{t}={\frac {\sqrt {3}}{4}}s^{2}.}$ ${\displaystyle P_{s}+P_{t}=50.}$ Total area ${\displaystyle A=A_{s}+A_{t}}$ and ${\displaystyle A}$ must be minimum. What is the value of ${\displaystyle s}$? ${\displaystyle 4h+3s=50}$ ${\displaystyle h={\frac {50-3s}{4}}}$ ${\displaystyle A_{s}=h^{2}=({\frac {50-3s}{4}})^{2}}$ ${\displaystyle ={\frac {2500-300s+9s^{2}}{16}}}$ ${\displaystyle A=A_{s}+A_{t}}$ ${\displaystyle ={\frac {2500-300s+9s^{2}}{16}}+{\frac {\sqrt {3}}{4}}s^{2}}$ ${\displaystyle ={\frac {1}{16}}(2500-300s+9s^{2}+4{\sqrt {3}}s^{2})}$ For minimum ${\displaystyle A,\ {\frac {dA}{ds}}=0.}$ ${\displaystyle -300+2(9+4{\sqrt {3}})s=0}$ ${\displaystyle (9+4{\sqrt {3}})s=150}$ ${\displaystyle s={\frac {150}{9+4{\sqrt {3}}}}}$ ${\displaystyle =9.417\dots }$

 Figure 1(c): Plan of county road between Town A and Town B to be constructed so that cost is minimum. Town B is 40 miles East and 50 miles North of Town A. The county is going to construct a road from Town A to Town B. Adjacent to Town A the cost to build a road is $500k/mile. Adjacent to Town B the cost to build a road is$200k/mile. The dividing line runs East-West 30 miles North of Town A. Calculate the position of point C so that the cost of the road from Town A to Town B is minimum. Let point ${\displaystyle C=(x,30).}$ Then distance from Town A to point ${\displaystyle C={\sqrt {x^{2}+30^{2}}}={\sqrt {x^{2}+900}}.}$ Distance from Town B to point ${\displaystyle C={\sqrt {(40-x)^{2}+20^{2}}}}$ ${\displaystyle ={\sqrt {1600-80x+x^{2}+400}}}$ ${\displaystyle ={\sqrt {2000-80x+x^{2}}}.}$
 Figure 1(d): Graphs showing cost of county road ${\displaystyle (f(x))}$ and ${\displaystyle f'(x).}$ Curve showing ${\displaystyle (f(x))}$ is actually ${\displaystyle {\frac {f(x)}{10}}}$. Cost is minimum where ${\displaystyle x=10.523\dots }$ Cost ${\displaystyle =5{\sqrt {x^{2}+900}}+2{\sqrt {2000-80x+x^{2}}}}$ in units of \$100k. For minimum cost ${\displaystyle f'(x)=0.}$ ${\displaystyle 5\cdot {\frac {1}{2}}\cdot {\frac {2x}{\sqrt {x^{2}+900}}}+2\cdot {\frac {1}{2}}\cdot {\frac {-80+2x}{\sqrt {2000-80x+x^{2}}}}=0}$ ${\displaystyle {\frac {5x}{\sqrt {x^{2}+900}}}+{\frac {-80+2x}{\sqrt {2000-80x+x^{2}}}}=0}$ ${\displaystyle 5x{\sqrt {2000-80x+x^{2}}}+(-80+2x){\sqrt {x^{2}+900}}=0}$

${\displaystyle x=10.52322823517\dots }$

#### Cardboard box

 Figure 1(e): Sheet of cardboard to be cut and folded to make box of maximum possible volume. Cut on purple lines, fold on red lines. Design of box includes top. A piece of cardboard of length ${\displaystyle 4\ ft}$ and width ${\displaystyle 3\ ft}$ will be used to make a box with a top. Some waste will be cut out of the piece of cardboard and the remaining cardboard will be folded to make a box so that the volume of the box is maximum. What is the height of the box?
 Figure 1(f): Curves associated with design of cardboard box. ${\displaystyle {\frac {dV}{dh}}=0}$ and ${\displaystyle V}$ is maximum when ${\displaystyle h={\frac {7-{\sqrt {13}}}{6}}}$ ${\displaystyle 2h+l=3}$ ${\displaystyle 2w+2h=4;\ w+h=2}$ ${\displaystyle V=lwh=(3-2h)(2-h)h=2h^{3}-7h^{2}+6h}$ For maximum volume ${\displaystyle {\frac {dV}{dh}}=6h^{2}-14h+6=0.}$ ${\displaystyle 3h^{2}-7h+3=0}$ ${\displaystyle h={\frac {7-{\sqrt {13}}}{6}}=6.788\dots }$ inches.

#### Solving ellipse at origin

Figure 1: Graph of ellipse showing semi-chord through center.
When length of ${\displaystyle t}$ is maximum, length of major axis ${\displaystyle =2t.}$
When length of ${\displaystyle t}$ is minimum, length of minor axis ${\displaystyle =2t.}$

An ellipse with center at origin has equation: ${\displaystyle Ax^{2}+Bxy+Cy^{2}+F=0\ \dots \ (1)}$

Given values ${\displaystyle A,B,C,F}$ calculate:

• length of major axis
• length of minor axis.

In Figure 1 ${\displaystyle t}$ is any line from origin to ellipse and ${\displaystyle \theta }$ is angle between ${\displaystyle X}$ axis and ${\displaystyle t.}$

Aim of this section is to calculate ${\displaystyle \theta }$ so that length of ${\displaystyle t}$ is maximum, in which case length of major axis = ${\displaystyle 2t.}$

 Let ${\displaystyle c=\cos(\theta )}$ and ${\displaystyle s=\sin(\theta ).}$ Then ${\displaystyle x=t\cos(\theta )=tc,}$ and ${\displaystyle y=t\sin(\theta )=ts.}$ Substitute these values in ${\displaystyle (1):}$ ${\displaystyle Attcc+Bttcs+Cttss+F=0\ \dots \ (2)}$ Calculate ${\displaystyle t'={\frac {dt}{d\theta }}}$ ${\displaystyle A(tt(-2cs)+cc2tt')+B(tt(cc-ss)+cs2tt')+C(tt(2sc)+ss2tt')=0}$ ${\displaystyle Att(-2cs)+Acc2tt'+Btt(cc-ss)+Bcs2tt'+Ctt(2sc)+Css2tt'=0}$ ${\displaystyle -2Attcs+Acc2tt'+Bttcc-Bttss+Bcs2tt'+2Cttsc+2Csstt'=0}$ ${\displaystyle +Acc2tt'+2Bcstt'+2Csstt'-2Attcs+Bttcc-Bttss+2Cttsc=0}$ ${\displaystyle +t'(Acc2t+2Bcst+2Csst)=+2Attcs-Bttcc+Bttss-2Cttsc}$ ${\displaystyle t'={\frac {+2Attcs-Bttcc+Bttss-2Cttsc}{(Acc2t+2Bcst+2Csst)}}}$ For maximum or minimum ${\displaystyle t:}$ ${\displaystyle 2Attcs-Bttcc+Bttss-2Cttsc=0}$ ${\displaystyle 2Acs-Bcc+Bss-2Csc=0}$ ${\displaystyle 2Acs-2Csc=Bcc-Bss}$ Square both sides, substitute ${\displaystyle 1-ss}$ for ${\displaystyle cc}$ and result is: ${\displaystyle aS^{2}+bS+c=0\ \dots \ (3)}$ where: ${\displaystyle S=\sin ^{2}(\theta )}$ ${\displaystyle a=(+4AA-8AC+4BB+4CC)}$ ${\displaystyle b=-a}$ ${\displaystyle c=BB}$
##### An example

Let equation of ellipse be: ${\displaystyle 55x^{2}-24xy+48y^{2}-2496=0}$

# python code
>>> A,B,C = 55,-24,48
>>> a = (+ 4*A*A - 8*A*C + 4*B*B + 4*C*C);a
2500
>>> b = -a;b
-2500
>>> c = B*B;c
576
>>>
>>> a,b,c = [v/4 for v in (a,b,c)] ; a,b,c
(625.0, -625.0, 144.0)
>>> S = .36
>>> a*S*S + b*S + c
0.0
>>> S = .64
>>> a*S*S + b*S + c
0.0
>>>


The solutions of quadratic equation ${\displaystyle (3)}$ are ${\displaystyle .36}$ or ${\displaystyle .64}$.

Therefore ${\displaystyle \sin(\theta )=\pm 0.6}$ or ${\displaystyle \sin(\theta )=\pm 0.8}$.

From ${\displaystyle (2)}$ above: ${\displaystyle t={\sqrt {\frac {-F}{Acc+Bcs+Css}}}}$

 # python code A,B,C,F = 55,-24,48, -2496 t1 = (0.6, 0.8) dict1 = dict() for v1 in (t1, t1[::-1]) : c1,s1 = v1 for c in (c1,-c1) : for s in (s1,-s1) : t = (-F/( A*c*c + B*c*s + C*s*s ))**.5 if t in dict1 : dict1[t] += ((c,s),) else : dict1[t] = ((c,s),) L1 = [ (v, dict1[v]) for v in sorted([ v for v in dict1 ]) ] for v in L1 : print (v) 
 (6.244997998398398, ((0.8, -0.6), (-0.8, 0.6))) (6.34287855135306, ((0.6, -0.8), (-0.6, 0.8))) (7.806247497997998, ((0.8, 0.6), (-0.8, -0.6))) (7.999999999999999, ((0.6, 0.8), (-0.6, -0.8)))

Minimum value of ${\displaystyle t=6.244997998398398.}$ Length of minor axis ${\displaystyle =2*6.244997998398398}$

Maximum value of ${\displaystyle t=7.999999999999999.}$ Length of major axis ${\displaystyle =8*2}$

##### Gallery
 When line ${\displaystyle t}$ has direction cosines ${\displaystyle [0.8,-0.6],}$${\displaystyle \tan(\theta )={\frac {-3}{4}}}$ and length of ${\displaystyle t}$ is minimum. When line ${\displaystyle t}$ has direction cosines ${\displaystyle [0.6,0.8],}$${\displaystyle \tan(\theta )={\frac {4}{3}}}$ and length of ${\displaystyle t}$ is maximum.

### Rates of Change

#### The car jack

 Figure 2: Photo of car jack illustrating horizontal ${\displaystyle (BC)}$ and vertical ${\displaystyle (CA)}$ rates of change. In triangle ${\displaystyle ABC}$ to the right: length ${\displaystyle AB=10}$ inches, length ${\displaystyle BC=x}$ inches and is horizontal, length ${\displaystyle CA=y}$ inches and is vertical, ${\displaystyle \angle ABC=\theta .}$ Point ${\displaystyle B}$ is moving towards point ${\displaystyle C}$ at the rate of ${\displaystyle 5}$ inches${\displaystyle /}$minute.
##### Vertical motion
 Figure 3: Curves and values associated with car jack. When ${\displaystyle x=1,\ {\frac {dy}{dx}}=0.1\dots }$ When ${\displaystyle \theta =45^{\circ },\ {\frac {dy}{dx}}=1}$ When ${\displaystyle x=9,\ {\frac {dy}{dx}}=2.06\dots }$ At what rate is point ${\displaystyle A}$ moving upwards: (a) when ${\displaystyle x=9}$? (b) when ${\displaystyle x=1}$? (c) when ${\displaystyle \theta =45^{\circ }}$? We have to calculate ${\displaystyle {\frac {dy}{dt}}}$ when ${\displaystyle {\frac {dx}{dt}}}$ is given. ${\displaystyle {\frac {dy}{dt}}={\frac {dy}{dx}}\cdot {\frac {dx}{dt}}}$ ${\displaystyle x^{2}+y^{2}=10^{2}}$ (equation of circle) ${\displaystyle y={\sqrt {100-x^{2}}}}$ ${\displaystyle y^{2}=100-x^{2}}$ ${\displaystyle 2y\cdot {\frac {dy}{dx}}=-2x}$ ${\displaystyle {\frac {dy}{dx}}={\frac {-2x}{2y}}={\frac {-x}{\sqrt {100-x^{2}}}}}$ For convenience we'll use the negative value of the square root and say that ${\displaystyle {\frac {dy}{dx}}={\frac {x}{\sqrt {100-x^{2}}}}.}$ Relative to line ${\displaystyle BC:}$ When ${\displaystyle x=9,\ {\frac {dy}{dx}}=2.06,\ {\frac {dy}{dt}}=2.06\cdot 5=10.3}$ inches${\displaystyle /}$minute. When ${\displaystyle x=1,\ {\frac {dy}{dx}}=0.1,\ {\frac {dy}{dt}}=0.1\cdot 5=0.5}$ inches${\displaystyle /}$minute. When ${\displaystyle \theta =45^{\circ },x=10\cdot \cos 45^{\circ }=7.071}$ and ${\displaystyle {\frac {dy}{dt}}=1\cdot 5=5}$ inches${\displaystyle /}$minute. This example highlights the mechanical advantage of this simple but effective tool. When the top of the jack is low, it moves quickly. As the jack takes more and more weight, the top of the jack moves more slowly.
##### Change of area
 Figure 4: Graph of ${\displaystyle a}$ and ${\displaystyle {\frac {da}{dx}}}$. Area of ${\displaystyle \Delta ABC}$ is maximum when ${\displaystyle b=h={\sqrt {50}}=10\cos(45^{\circ })}$ At what rate is the area of ${\displaystyle \Delta ABC}$ changing when (i) ${\displaystyle x=9}$? (ii) ${\displaystyle x=1}$? (iii) ${\displaystyle \theta =45^{\circ }}$? ${\displaystyle {\frac {da}{dt}}={\frac {da}{dx}}\cdot {\frac {dx}{dt}}}$ where ${\displaystyle a}$ is area of ${\displaystyle \Delta ABC}$ and ${\displaystyle {\frac {dx}{dt}}=5}$ inches ${\displaystyle /}$ minute. ${\displaystyle a={\frac {b\cdot h}{2}}={\frac {x\cdot y}{2}}={\frac {x{\sqrt {100-x^{2}}}}{2}}}$ Calculate ${\displaystyle {\frac {da}{dx}}:}$ ${\displaystyle 2a=x{\sqrt {100-x^{2}}}}$ ${\displaystyle 4a^{2}=x^{2}(100-x^{2})=100x^{2}-x^{4}}$ ${\displaystyle 8a\cdot {\frac {da}{dx}}=200x-4x^{3}}$ ${\displaystyle {\frac {da}{dx}}={\frac {200x-4x^{3}}{8a}}={\frac {50x-x^{3}}{2a}}={\frac {50x-x^{3}}{x{\sqrt {100-x^{2}}}}}}$ ${\displaystyle ={\frac {50-x^{2}}{\sqrt {100-x^{2}}}}}$ When ${\displaystyle x=9,\ {\frac {da}{dx}}=7.11\dots }$ and area of ${\displaystyle \Delta ABC}$ is increasing at rate of ${\displaystyle (5\cdot 7.11\dots )}$ square inches/minute. When ${\displaystyle x=1,\ {\frac {da}{dx}}=-4.92\dots }$ and area of ${\displaystyle \Delta ABC}$ is decreasing at rate of ${\displaystyle (5\cdot 4.92\dots )}$ square inches/minute. When ${\displaystyle \theta =45^{\circ },\ h=b=x=y=10\cos(45^{\circ })=10\cdot {\frac {\sqrt {2}}{2}}=5{\sqrt {2}},\ }$ ${\displaystyle {\frac {da}{dx}}=0,\ a}$ is a maximum of ${\displaystyle 25}$ square inches and ${\displaystyle {\frac {da}{dt}}=0.}$

#### On the clock

Figure 5: Image of analog clock showing minute and hour hands at ${\displaystyle 3}$ o'clock.

An old fashion analog clock with American style face (12 hours) keeps accurate time. The length of the minute hand is ${\displaystyle 4}$ inches and the length of the hour hand is ${\displaystyle 3}$ inches.

At what rate is the tip of the minute hand approaching the tip of the hour hand at 3 o'clock?

Let ${\displaystyle a}$ be distance between the two tips.

The task is to calculate ${\displaystyle {\frac {da}{dt}}.}$

${\displaystyle {\frac {da}{dt}}={\frac {da}{d\theta }}\cdot {\frac {d\theta }{dt}}}$ where ${\displaystyle \theta }$ is angle subtended by side ${\displaystyle a}$ at center of clock.

 Calculating ${\displaystyle {\frac {d\theta }{dt}}:}$ Angular velocity of minute hand ${\displaystyle ={\frac {2\pi }{1}}}$ radians/hour. Angular velocity of hour hand ${\displaystyle ={\frac {2\pi }{12}}={\frac {\pi }{6}}}$ radians/hour. ${\displaystyle {\frac {d\theta }{dt}}=}$ angular velocity of minute hand relative to hour hand ${\displaystyle =2\pi -{\frac {\pi }{6}}={\frac {11\pi }{6}}}$ radians/hour.
 Calculating ${\displaystyle {\frac {da}{d\theta }}:}$ ${\displaystyle a^{2}=3^{2}+4^{2}-2\cdot 3\cdot 4\cdot \cos \theta =25-24\cos \theta .}$ ${\displaystyle 2a\cdot {\frac {da}{d\theta }}=24\sin \theta .}$ ${\displaystyle {\frac {da}{d\theta }}={\frac {24\sin \theta }{2a}}={\frac {24\sin 90^{\circ }}{2\cdot 5}}={\frac {24}{10}}=2.4.}$

${\displaystyle {\frac {da}{dt}}=2.4\cdot {\frac {11\pi }{6}}=4.4\pi }$ inches/hour.

 Figure 6: Multi-lane highway oriented East-West. ${\displaystyle AB=c=200}$ feet. ${\displaystyle BC=a=50}$ feet. ${\displaystyle AC=b}$. ${\displaystyle {\frac {dc}{dt}}=60}$ mph. A multi-lane highway is oriented East-West. A vehicle is moving in the inside lane from West to East. A law-enforcement officer with a radar gun is in position 50 feet South of the center of the inside lane. When the vehicle is 200 feet from the radar gun, it shows the vehicle's speed to be 60 mph. What is the actual speed of the vehicle? Let length ${\displaystyle AC=b.}$ ${\displaystyle {\frac {db}{dt}}={\frac {db}{dc}}\cdot {\frac {dc}{dt}}}$ where ${\displaystyle {\frac {dc}{dt}}=60}$ mph. The derivative ${\displaystyle {\frac {db}{dc}}:}$ {\displaystyle {\begin{aligned}\ \ \ \ &b^{2}=c^{2}-a^{2};\ b={\sqrt {c^{2}-a^{2}}}\\&2b\cdot {\frac {db}{dc}}=2c\\&{\frac {db}{dc}}={\frac {2c}{2b}}={\frac {c}{\sqrt {c^{2}-a^{2}}}}\end{aligned}}} ${\displaystyle {\frac {db}{dt}}={\frac {200}{\sqrt {200^{2}-50^{2}}}}\cdot 60=61.967\dots }$ mph.

#### On the Water

A ship is at sea ${\displaystyle 15}$ nautical miles East and ${\displaystyle 8}$ nautical miles South of a lighthouse, and the ship is steaming South-West at ${\displaystyle 10}$ nautical miles/hour or ${\displaystyle 10}$ knots.

At what rate is ship approaching lighthouse?

${\displaystyle {\frac {da}{dt}}=10}$ knots.

${\displaystyle {\frac {dc}{dt}}={\frac {dc}{da}}\cdot {\frac {da}{dt}}}$ knots.

 Figure 1: Diagram indicating position, course and speed of ship relative to lighthouse. ${\displaystyle \angle BCA=\angle \theta .}$ Calculating ${\displaystyle {\frac {dc}{da}}:}$ ${\displaystyle c^{2}=a^{2}+b^{2}-2ab\cos \theta }$ ${\displaystyle 2c\cdot {\frac {dc}{da}}=2a-2b\cos \theta }$ ${\displaystyle {\frac {dc}{da}}={\frac {a-b\cos \theta }{c}}=-0.291161615782696}$ The ${\displaystyle -}$ sign indicates that, when ${\displaystyle a}$ is increasing, ${\displaystyle c}$ is decreasing.

${\displaystyle {\frac {dc}{dt}}={\frac {dc}{da}}\cdot 10}$ ${\displaystyle =2.91161615782696}$ knots towards the lighthouse.

#### Reciprocating engine

 Figure 1: Diagram illustrating mathematical relationship between piston, connecting rod and crankshaft in reciprocating engine. The diagram illustrates the piston, connecting rod and crankshaft of an internal combustion reciprocating engine. The connecting rod ${\displaystyle a}$ is connected to piston on ${\displaystyle y}$ axis, and to crankshaft at end of ${\displaystyle c}$ on ${\displaystyle x}$ axis. This section analyzes the motion of the piston as the crankshaft rotates through angle ${\displaystyle x}$ and the piston moves up and down on the ${\displaystyle y}$ axis.
##### Position of piston
Figure 2: Diagram showing position of piston as a function of rotation of crankshaft in reciprocating engine.
Piston moves up and down between ${\displaystyle 8}$ and ${\displaystyle 18}$ inches.
${\displaystyle 18\geq y\geq 8}$

${\displaystyle a^{2}=y^{2}+c^{2}-2yc\cos(x)}$

${\displaystyle y^{2}-2c\cos(x)y+c^{2}-a^{2}=0}$

${\displaystyle y^{2}-2(5)\cos(x)y+(5)^{2}-(13)^{2}=0}$

${\displaystyle y^{2}-10\cos(x)y-144=0}$

${\displaystyle y={\frac {10\cos(x)+{\sqrt {(10\cos(x))^{2}-4(-144)}}}{2}}}$

${\displaystyle y={\frac {10\cos(x)+{\sqrt {100(\cos(x))^{2}+576}}}{2}}}$

${\displaystyle y=5\cos(x)+{\sqrt {25(\cos(x))^{2}+144}}}$

 Code supplied to grapher (without white space) is: (5)(cos(x)) + ( ((25)((cos(x))^2) + 144 )^(0.5) )  When expressed in this way, it's easy to convert the code to python code: (5)*(cos(x)) + ( ((25)*((cos(x))**2) + 144 )**(0.5) ) 

Positions of interest:

 Graph and diagram of piston at top dead center. Graph and diagram of piston at bottom dead center. Graph and diagram of piston half-way between TDC and BDC. Graph and diagram of crank half-way between TDC and BDC. Graph and diagram of connecting rod tangential to crank.

##### Velocity of piston
 Figure 3: Diagram showing velocity of piston as a function of position of piston in reciprocating engine. Strictly speaking, velocity ${\displaystyle ={\frac {dy}{dt}}={\frac {dy}{dx}}\cdot {\frac {dx}{dt}}.}$ At constant RPM, ${\displaystyle {\frac {dx}{dt}}}$ is constant. Therefore ${\displaystyle {\frac {dy}{dx}}}$ is used to illustrate velocity. Calculation of ${\displaystyle {\frac {dy}{dx}}}$ by implicit differentiation. ${\displaystyle y^{2}-10\cos(x)y-144=0}$ ${\displaystyle 2y\cdot y'-10(\cos(x)y'+y(-\sin(x)))=0}$ ${\displaystyle 2y\cdot y'-10\cos(x)y'+10\sin(x)y=0}$ ${\displaystyle y\cdot y'-5\cos(x)y'=-5\sin(x)y}$ ${\displaystyle y'(y-5\cos(x))=-5\sin(x)y}$ ${\displaystyle y'={\frac {5\sin(x)y}{5\cos(x)-y}}}$
##### Acceleration of piston
Figure 4a: Diagram showing acceleration of piston in reciprocating engine.
Negative acceleration has a greater absolute value than the positive, but it does not last as long.

Acceleration introduces the second derivative. While velocity was the first derivative of position with respect to time, acceleration is the first derivative of velocity or the second derivative of position.

From velocity above ${\displaystyle yy'-5\cos(x)y'+5\sin(x)y=0}$

By implicit differentation:

${\displaystyle yy''+y'y'-5(\cos(x)y''+y'(-\sin(x)))+5(\sin(x)y'+y\cos(x))=0}$

${\displaystyle yy''+y'y'-5\cos(x)y''+5y'\sin(x)+5\sin(x)y'+5y\cos(x)=0}$

${\displaystyle yy''-5\cos(x)y''=-(y'y'+5y'\sin(x)+5\sin(x)y'+5y\cos(x))}$

${\displaystyle y''(y-5\cos(x))=-(y'y'+10\sin(x)y'+5y\cos(x))}$

${\displaystyle y''={\frac {y'y'+10\sin(x)y'+5y\cos(x)}{5\cos(x)-y}}}$

Substitute for ${\displaystyle y}$ and ${\displaystyle y'}$ as defined above, and you see the code input to grapher at top of diagram to right.

 Figure 4b: Diagram showing "irregularities" in the curve of velocity while velocity is increasing. ${\displaystyle y}$ axis compressed to illustrate shape of curves. "Kinks" in the curve: It is not obvious by looking at the curve of velocity that there are slight irregularities in the curve when velocity is increasing. However, the irregularities are obvious in the curve of acceleration. During one revolution of the crankshaft there is less time allocated for negative acceleration than for positive acceleration. Therefore, the maximum absolute value of negative acceleration is greater than the maximum value of positive acceleration.

##### Minimum and maximum velocity
 Figure 5: Diagram showing positions of maximum velocity of piston in reciprocating engine. In the first quadrant, from ${\displaystyle x=0^{\circ }}$ to ${\displaystyle x=90^{\circ },}$ the piston moves through ${\displaystyle 6}$ inches. In the second quadrant, from ${\displaystyle x=90^{\circ }}$ to ${\displaystyle x=180^{\circ },}$ the piston moves through ${\displaystyle 4}$ inches. Therefore, in the first quadrant, acceleration must be greater than in the second quadrant. Velocity is rate of change of position. See also Figure 3 above. Minimum velocity: Velocity is zero when slope of curve of position is zero. This occurs at top dead center and at bottom dead center, ie, when ${\displaystyle x=0}$ and ${\displaystyle x=\pi .}$ Maximum velocity: Intuition suggests that the position of maximum velocity might be the point at which the connecting rod is tangent to the circle of the crankshaft. In other words: ${\displaystyle x=\arctan({\frac {13}{5}})=68.96\dots ^{\circ }}$ or, that the position of maximum velocity might be the point at which the piston is half-way between top dead center and bottom dead center. In other words: ${\displaystyle x=\arccos({\frac {2.5}{13}})=78.9\dots ^{\circ }}$ However, velocity is maximum when acceleration is ${\displaystyle 0,}$ which occurs when ${\displaystyle x=\pm 71.26\dots ^{\circ }.}$ Suppose that the engine is rotating at ${\displaystyle 100}$ radians/second or approx. ${\displaystyle 955}$ RPM. ${\displaystyle v_{max}=y'{\frac {inches}{radian}}\cdot 100{\frac {radians}{second}}}$ abs${\displaystyle (v_{max})=5.36(100)}$ inches/second or approx. ${\displaystyle 30.5}$ mph.
##### Minimum and maximum acceleration
 Figure 6: Diagram showing positions of minimum and maximum acceleration of piston in reciprocating engine. Acceleration is rate of change of velocity. See also Figures 4a and 4b above. Minimum acceleration: Acceleration is zero when slope of curve of velocity is zero. This occurs at maximum velocity or when ${\displaystyle \angle x}$ is approx. ${\displaystyle \pm 71.3^{\circ }.}$ Maximum acceleration: Acceleration is maximum when slope of curve of velocity is maximum. Maximum negative acceleration occurs when slope of curve of velocity is maximum negative. This happens at top dead center when ${\displaystyle \angle x=0.}$ Maximum positive acceleration occurs when slope of curve of velocity is maximum positive. This happens before and after bottom dead center when ${\displaystyle \angle x}$ is approx. ${\displaystyle \pm 127^{\circ }.}$ Let the engine continue to rotate at ${\displaystyle 100}$ radians/second. ${\displaystyle acc_{max}=y''{\frac {inches}{radian^{2}}}\cdot 100{\frac {radians}{second}}\cdot 100{\frac {radians}{second}}}$ abs${\displaystyle (acc_{max})=6.92*100*100}$ inches/second${\displaystyle ^{2}}$ or approx. ${\displaystyle 180}$ times the acceleration due to terrestrial gravity. This maximum value of acceleration is maximum negative when ${\displaystyle \angle x=0.}$ According to Newtonian physics ${\displaystyle f=ma}$, force = mass*acceleration, and ${\displaystyle w=fs}$, work = force*distance. In this engine energy expended in just accelerating piston to maximum velocity is proportional to rpm${\displaystyle ^{2}}$. Perhaps this helps to explain why a big marine diesel engine rotating at low RPM can achieve efficiency of ${\displaystyle 55\%.}$

### Simple laws of motion

 Let a body move in accordance with the following function of ${\displaystyle t,\ f(t)}$ where ${\displaystyle t}$ means time: ${\displaystyle p_{t}=f(t)=at^{2}+bt+c}$ where ${\displaystyle p_{t}}$ is position at time ${\displaystyle t.}$ ${\displaystyle p_{t}}$ has the dimension of length. Therefore, each component of ${\displaystyle f(t)}$ must have the dimension of length. For ${\displaystyle bt}$ to have the dimension of length, ${\displaystyle b}$ must have the dimensions of ${\displaystyle {\frac {length}{time}}}$ or velocity. For ${\displaystyle at^{2}}$ to have the dimension of length, ${\displaystyle a}$ must have the dimensions of ${\displaystyle {\frac {length}{time^{2}}}}$ or acceleration. If ${\displaystyle t==0,\ p_{0}=c}$ and ${\displaystyle p_{t}=f(t)=at^{2}+bt+p_{0}.}$ The derivatives enable us to assign specific values to ${\displaystyle a,\ b.}$ ${\displaystyle {\frac {d(p_{t})}{dt}}=f'(t)=v_{t}=2at+b}$ where ${\displaystyle v_{t}}$ is velocity at time ${\displaystyle t.}$ If ${\displaystyle t==0,\ v_{0}=b}$ and ${\displaystyle p_{t}=f(t)=at^{2}+v_{0}t+p_{0}.}$ ${\displaystyle {\frac {d(v_{t})}{dt}}=f''(t)=2a,}$ a constant equal to the acceleration to which the body is subjected. For convenience let us say that ${\displaystyle p_{t}={\frac {1}{2}}at^{2}+v_{0}t+p_{0}}$ where ${\displaystyle a}$ is the (constant) acceleration to which the body is subjected. Then ${\displaystyle v_{t}={\frac {1}{2}}\cdot 2at+v_{0}=at+v_{0}}$ and ${\displaystyle {\frac {d(v_{t})}{dt}}=a.}$