# Derivative Rules via Dual Numbers

## July 23, 2022 | 1 minute, 41 seconds

This post is a tidbit that I wrote on a whim.

Let $$\varepsilon_1$$ be an indeterminate such that $$\varepsilon_1^2=0$$.

Then for an analytic function $$f$$, $$f(a+b\varepsilon_1)=f(a)+f'(a)b\varepsilon_1$$ for some $$a,b\in\mathbb{R}$$, using the Taylor series of $$f$$ centred at $$a$$.

## Equivalence of dual numbers

Two dual numbers $$u=a+b\varepsilon_1$$ and $$v=c+d\varepsilon_1$$ are equal iff $$a=c$$ and $$b=d$$ for $$a,b,c,d\in\mathbb{R}$$.

Proof: $$a+b\varepsilon_1=c+\varepsilon_1\implies (a-c)=(d-b)\varepsilon_1$$. Multiplying both sides by $$\varepsilon_1$$ gives $$(a-c)\varepsilon_1=(d-b)\varepsilon_1^2=0$$. Since $$\varepsilon_1$$ is non-zero by definition, we have that $$a-c=0\implies a=c$$. It follows, therefore, that $$b=d$$ by the same reasoning.

(Note that the reverse is fairly trivial; if $$u=a+b\varepsilon_1$$ and $$a=c$$ and $$b=d$$, then $$u=c+d\varepsilon_1=v$$.)

## Chain Rule

Let $$F(x)=f(g(x))$$; then $$F(a+b\varepsilon_1)=F(a)+F'(a)b\varepsilon_1$$.

On the other hand, $$f(g(a+b\varepsilon_1))=f(g(a)+g'(a)b\varepsilon_1)=f(g(a))+f'(g(a))g'(a)b\varepsilon_1$$.

Equating the above equations, we have that:

$F(a)+F'(a)b\varepsilon_1 = f(g(a))+f'(g(a))g'(a)b\varepsilon_1$

By Equivalence of Dual Numbers, we have that:

$F(a) = f(g(a))$

$F'(a)b=f'(g(a))g'(a)b\implies F'(a)=f'(g(a))g'(a)$

Therefore:

$\frac{\text{d}}{\text{d}x}f(g(x))=f'(g(x))g'(x)$

## Product Rule

Let $$F(x)=f(x)g(x)$$; then $$F(a+b\varepsilon_1)=F(a)+F'(a)b\varepsilon_1$$.

On the other hand, $$f(a+b\varepsilon_1)g(a+b\varepsilon_1)=(f(a)+f'(a)b\varepsilon_1)(g(a)+g'(a)b\varepsilon_1)$$. Expanding and factoring into real and non-real parts, we get $$f(a+b\varepsilon_1)g(a+b\varepsilon_1)=f(a)g(a)+(f(a)g'(a)+f'(a)g(a))\varepsilon_1$$.

Equating the above equations once again, we get:

$F(a)+F'(a)b\varepsilon_1 = f(a)g(a)+(f(a)g'(a)+f'(a)g(a))\varepsilon_1$

By Equivalence of Dual Numbers, we have that:

$F(a) = f(a)g(a)$

$F'(a)b = f(a)g'(a)+f'(a)g(a)b\implies F'(a) = f(a)g'(a) = f(a)g'(a)+f'(a)g(a)$

Therefore:

$\frac{\text{d}}{\text{d}x}f(x)g(x)=f(x)g'(x)+f'(x)g(x)$

## Quotient Rule

Let $$F(x)=\frac{f(x)}{g(x)}$$; then $$F(a+b\varepsilon_1)=F(a)+F'(a)b\varepsilon_1$$.

On the other hand, $$\frac{f(a+b\varepsilon_1)}{g(a+\varepsilon_1)}=\frac{f(a)+f'(a)b\varepsilon_1}{g(a)+g'(a)b\varepsilon_1}$$. For non-zero $$g(a)$$, we multiply numerator and denominator, and expand, by $$g(a)-g'(a)b\varepsilon_1$$, giving us:

$\frac{f(a)}{g(a)}+\frac{-f(a)g'(a)+f'(a)g(a)}{g(a)^2}\varepsilon_1$

Equating the above equations, we have that:

$F(a)+F'(a)b\varepsilon_1=\frac{f(a)}{g(a)}+\frac{-f(a)g'(a)+f'(a)g(a)}{g(a)^2}b\varepsilon_1$

By Equivalence of Dual Numbers, we have that:

$F(a) = \frac{f(a)}{g(a)}$

$F'(a)b=\frac{-f(a)g'(a)+f'(a)g(a)}{g(a)^2}b\implies F'(a)=\frac{-f(a)g'(a)+f'(a)g(a)}{g(a)^2}$

Therefore:

$\frac{\text{d}}{\text{d}x}\frac{f(x)}{g(x)}=\frac{f'(x)g(x)-f(x)g'(x)}{g(x)^2}$