---
title: Linear approximation and differentials
heading: Every smooth curve is a straight line up close
eyebrow: A5 · Lesson 21 · Linear approximation
xp: 40
---

::: hook
A transistor amplifier is wildly nonlinear: its current is an exponential of its input voltage. Yet for small signals it behaves almost perfectly linearly, with a gain you can calculate. The reason is the same one that makes $\sin\theta \approx \theta$ for small angles: zoom in far enough on any smooth curve and it looks like its tangent line. Replacing a function by its tangent line near a working point is the **linear approximation**, and the small-signal models of C5 and C6 are built entirely on it.
:::

::: play
- The curve is $e^x$ and the dashed line its tangent at $a$.
- Move the test point $x$ away from $a$. How fast does the gap between curve and tangent grow?
- Compare the error readout with $\frac{1}{2}e^a(x - a)^2$.
:::
:::

```sim plot
view: graph
x: x = -2..3
y: y = -1..12
slider: a = -1..2 step 0.1 = 0.5
slider: x0 = -2..3 step 0.05 = 1
plot: exp(x) | label: eˣ
plot: exp(a)*(1 + (x - a)) | dashed | color: ch2 | label: tangent at a
point: x0, exp(x0)
readout: error = exp(x0) - exp(a)*(1 + x0 - a) | digits: 4
readout: ½eᵃ(x − a)² = exp(a)*(x0 - a)^2/2 | digits: 4
```

::: predict
## Using the tangent line to $\sqrt{x}$ at $x = 100$, what is the estimate for $\sqrt{101}$?

- [ ] 10.1
- [x] 10.05
- [ ] 10.01
- [ ] 10.5

::: reveal
10.05. The slope of $\sqrt{x}$ is $\frac{1}{2\sqrt{x}} = 0.05$ at 100, so moving 1 to the right adds about 0.05. The true value is 10.0499, so the estimate is off by about one part in 100,000.
:::
:::

::: nameit
## The tangent line as an approximation

Near $x = a$,

$$f(x) \approx L(x) = f(a) + f'(a)(x - a)$$

$L$ is the **linearization** of $f$ at $a$. Its error is roughly $\frac{1}{2}f''(a)(x - a)^2$: it shrinks with the square of the distance, so halving the distance quarters the error. (A6 makes this precise with Taylor series.)

## Approximations worth knowing

For small $x$ (in radians where it matters):

| Function | Linear approximation |
|---|---|
| $(1 + x)^n$ | $1 + nx$ |
| $\sqrt{1 + x}$ | $1 + x/2$ |
| $e^x$ | $1 + x$ |
| $\ln(1 + x)$ | $x$ |
| $\sin x$, $\tan x$ | $x$ |
| $\cos x$ | $1$ (to first order; $1 - x^2/2$ to second) |

## Differentials

Writing $dx$ for a small change in $x$, the matching change in $y = f(x)$ is about

$$dy = f'(x)\,dx$$

This is A1's rule for small relative changes, now derived: for $P = V^2/R$, $dP = \frac{2V}{R}dV$, so $\frac{dP}{P} = 2\frac{dV}{V}$.

## Small-signal models

Around an operating point, a nonlinear part acts like a linear one for small changes. A diode at current $I$ has $\frac{dI}{dV} = \frac{I}{V_T}$, so a small voltage change $v$ gives a small current change

$$i \approx \frac{I}{V_T}\,v$$

The diode acts like a resistor of $V_T/I$ for the signal, while the bias sets the operating point. That's the whole idea behind small-signal analysis of amplifiers.
:::

::: example
## Estimate $1.02^{10}$ without a calculator, and check.

::: solution
1. **Linear estimate.** Use $(1 + x)^n \approx 1 + nx$ with $x = 0.02$ and $n = 10$:
   $$\begin{aligned} 1.02^{10} &\approx 1 + 0.2 \\ &= 1.2 \end{aligned}$$
2. **Check.** The true value is 1.2190, so the error is 0.019.
3. **Second-order term.** The error is close to
   $$\begin{aligned} \frac{n(n-1)}{2}x^2 &= 45 \times 0.0004 \\ &= 0.018 \end{aligned}$$
4. **When it's good enough.** For a quick sense of size the linear estimate is fine; for a 1% answer here you'd need the next term.

**Answer:** about 1.2 by the linear estimate; the true value is 1.2190.
:::
:::

::: example
## A diode is biased at 1 mA ($V_T$ = 25.85 mV). A 1 mV signal is added to its voltage. Estimate the change in current.

::: solution
1. **Linear estimate.**
   $$\begin{aligned} i &\approx \frac{I}{V_T}v \\ &= \frac{1\ \text{mA}}{25.85\ \text{mV}} \times 1\ \text{mV} \\ &= 38.7\ \mu\text{A} \end{aligned}$$
2. **Exact value.**
   $$\begin{aligned} i &= I(e^{v/V_T} - 1) \\ &= 1\ \text{mA} \times (e^{0.0387} - 1) \\ &= 39.4\ \mu\text{A} \end{aligned}$$
3. **Compare.** The linear model is within 2% for a 1 mV signal; at 10 mV it would be off by 20%, which is where "small signal" stops being small.

**Answer:** the current rises by about 38.7 µA (39.4 µA exactly).
:::
:::

::: example
## Estimate $\sin 31°$ from $\sin 30°$ with a linear approximation.

::: solution
1. **Work in radians.** The slope of $\sin x$ is $\cos x$, but only when $x$ is in radians. One degree is
   $$\frac{\pi}{180} = 0.017\,45\ \text{rad}$$
2. **Linear approximation.**
   $$\begin{aligned} \sin 31° &\approx \sin 30° \\ &\quad + \cos 30° \times 0.017\,45 \\ &= 0.5 + 0.866 \times 0.017\,45 \\ &= 0.515\,11 \end{aligned}$$
3. **Check.** The true value is 0.515 04, so the estimate is off by 0.000 07.
4. **Why radians matter.** Forgetting to convert to radians would have added 0.866, a nonsense answer.

**Answer:** $\sin 31° \approx 0.515\,11$, against a true value of 0.515 04.
:::
:::

::: check
given: a = 4 | 9 | 25 | 100; d = 0.2 | 0.5 | 1
answer: sqrt(a) + d/(2*sqrt(a))
tolerance: 0.001%

## Using the linearization of $\sqrt{x}$ at $x$ = {a}, estimate $\sqrt{\given{a} + \given{d}}$.

::: right
Right. $\sqrt{\given{a}} + \frac{\given{d}}{2\sqrt{\given{a}}}$ = {answer}.
:::

::: misses
- [sqrt(a) + d/sqrt(a)] The slope of $\sqrt x$ is $\frac{1}{2\sqrt x}$.
- [sqrt(a) + d] Multiply the change by the slope, not 1.
- [any] Not yet. $L(x) = f(a) + f'(a)(x - a)$ with $f' = \frac{1}{2\sqrt{x}}$.
:::
:::

::: check
given: x = 0.01 | 0.02 | 0.05; n = 3 | 5 | 10
answer: 1 + n*x
tolerance: 0.01%

## Using $(1 + x)^n \approx 1 + nx$, estimate $(1 + \given{x})^{\given{n}}$.

::: right
Right. $1 + \given{n} \times \given{x}$ = {answer}.
:::

::: misses
- [(1 + x)^n] That's the exact value. Use the linear approximation.
- [1 + x] Multiply the small change by the power, {n}.
- [any] Not yet. $1 + nx$.
:::
:::

::: check
given: I = 0.5 | 2 | 5; v = 0.5 | 1 | 2
answer: I*v/25.85*1000
unit: µA

## A diode biased at {I} mA ($V_T$ = 25.85 mV) gets a small signal of {v} mV. Using the small-signal model, how many microamps does its current change by?

::: right
Right. $\frac{I}{V_T}v$ = {answer} µA.
:::

::: misses
- [I*v/25.85] Check the units: mA × mV / mV is mA. Convert to µA.
- [v/25.85*1000] Multiply by the bias current: the conductance is $I/V_T$.
- [any] Not yet. $i \approx (I/V_T)\,v$.
:::
:::

::: check
given: V = 5 | 12; R = 10 | 100; dV = 0.05 | 0.1
answer: 2*V*dV/R
unit: W

## Using differentials, estimate how much the power in a {R} Ω resistor changes when its voltage goes from {V} V up by {dV} V.

::: right
Right. $dP = \frac{2V}{R}dV$ = {answer}.
:::

::: misses
- [V*dV/R] $\frac{d}{dV}V^2 = 2V$.
- [any] Not yet. $dP = P'(V)\,dV$ with $P = V^2/R$.
:::
:::

::: check
given: t = 0.05 | 0.1 | 0.2 | 0.3
answer: 100*(t - sin(t))/sin(t)
tolerance: 1%

## The approximation $\sin\theta \approx \theta$ is used at $\theta$ = {t} rad. By what percent does it overestimate?

::: right
Right. $(\theta - \sin\theta)/\sin\theta$ = {answer}%: roughly $\theta^2/6$, tiny at small angles.
:::

::: misses
- [100*(t - sin(t))] Divide by $\sin\theta$ for a relative error.
- [any] Not yet. Compare $\theta$ with $\sin\theta$ and express the difference as a percentage.
:::
:::

::: check
kind: expression
given: a = 2 | 3 | -1
answer: exp(a)*(1 + x - a)
vars: x = -1..3

## Write the linearization of $e^x$ at $x$ = {a}.

::: right
Right. $e^{\given{a}} + e^{\given{a}}(x - \given{a})$.
:::

::: misses
- [1 + x] That's the linearization at 0. Use the value and slope at {a}.
- [exp(a)*x] The line must pass through $(\given{a}, e^{\given{a}})$: use $x - \given{a}$.
- [any] Not yet. $f(a) + f'(a)(x - a)$ with $f = f' = e^x$.
:::
:::

::: check
kind: parts
given: a = 2 | 4 | 10; d = 0.1 | -0.2 | 0.3

## Approximate $f(x) = 1/x$ near $x$ = {a}.

::: part
answer: 1/a - d/a^2
tolerance: 0.1%

### What does the linear approximation give for $f(\given{a} + \given{d})$?

::: misses
- [1/a + d/a^2] The slope of $1/x$ is $-1/x^2$: negative.
- [any] $f(a) + f'(a)\,d$.
:::
:::

::: part
answer: 1/(a + d)
tolerance: 0.01%

### What is the exact value?

::: misses
- [any] Just compute it.
:::
:::

::: part
answer: d^2/(a^2*(a + d))
tolerance: 1%

### What is the exact value minus the approximation?

::: misses
- [-d^2/(a^2*(a + d))] Check the order: exact minus approximate. $1/x$ curves upward, so the line runs below it.
- [any] Subtract your two answers; it should be $d^2/(a^2(a + d))$.
:::
:::
:::

::: check
kind: derivation
vars: n = -3..3, x = -0.2..0.2

## Derive the approximation $(1 + x)^n \approx 1 + nx$ from the tangent line at $x = 0$.

::: step
answer: n

### What is the slope of $(1 + x)^n$ at $x = 0$?
:::

::: step
answer: 1 + n*x

### Write the tangent line at 0.
:::

::: step
answer: n*(n - 1)/2

### The next term is $cx^2$ with $c = f''(0)/2$. What is $c$?
:::

::: right
Right. $(1 + x)^n \approx 1 + nx + \frac{n(n - 1)}{2}x^2$; the linear part is good when $|nx|$ is small.
:::
:::

::: explain
## Why does a linear approximation get so much better as you move closer to the point, and what does that mean for "small-signal" analysis?

::: model
The gap between a smooth curve and its tangent grows like the square of the distance from the point of tangency. Halving the distance cuts the error to a quarter, and a tenth of the distance cuts it a hundredfold. In small-signal analysis, the signal is a small swing around a bias point, so the nonlinear part behaves almost exactly like its tangent line: a linear element whose gain is the slope at the bias point. The approximation holds as long as the swing stays small enough that the squared term is negligible.
:::
:::

::: practice

::: check
given: x = 0.01 | 0.03; n = 2 | 4
answer: 1 + x/2
tolerance: 0.001%

## Estimate $\sqrt{1 + \given{x}}$ with the linear approximation.

::: misses
- [1 + x] The power is 1/2: $1 + x/2$.
- [sqrt(1 + x)] That's exact; use the approximation.
- [any] $(1 + x)^{1/2} \approx 1 + x/2$.
:::
:::

::: check
given: I = 0.2 | 2 | 4
answer: 25.85/I
unit: Ω

## What small-signal resistance does a diode biased at {I} mA present ($V_T$ = 25.85 mV)?

::: misses
- [25.85*I] It's $V_T/I$.
- [any] $r_d = V_T/I$.
:::
:::

::: check
given: a = 1 | 2 | 4; d = 0.1 | 0.05
answer: a^3 + 3*a^2*d
tolerance: 0.001%

## Using the linearization of $x^3$ at {a}, estimate $(\given{a} + \given{d})^3$.

::: misses
- [(a + d)^3] That's exact.
- [any] $a^3 + 3a^2\,d$.
:::
:::
:::
