---
title: Undetermined coefficients
heading: Guessing the forced response
eyebrow: A8 · Lesson 26 · Undetermined coefficients
xp: 40
---

::: hook
Drive a circuit with a step and its output settles to a constant. Drive it with a sine and the output is a sine of the same frequency. Drive it with a decaying exponential and you get the same exponential back, scaled. The forced response looks like the input, so you can guess its shape and solve only for the size. That guess-and-check method is called **undetermined coefficients**, and when the input happens to match one of the circuit's own natural responses, the guess needs a twist.
:::

::: play
- The equation is $\ddot y + 3\dot y + 2y = e^{-ct}$. Its forced response is $Ae^{-ct}$, and the curve shows the size $A$ against the input's decay rate $c$.
- Move $c$ toward 1 or 2. Why does $A$ blow up there?
- Those are the circuit's own natural rates: the roots of $r^2 + 3r + 2 = 0$ are $-1$ and $-2$.
:::
:::

```sim plot
view: graph
x: c = 0..4
y: A = -10..10
slider: c0 = 0..4 step 0.05 = 0.5
plot: 1/(c^2 - 3*c + 2) | label: A(c) | samples: 2000
marker: x = c0 | label: input rate
readout: A at this rate = 1/(c0^2 - 3*c0 + 2) | digits: 4
```

::: predict
## For $\ddot y + 3\dot y + 2y = 4$, a constant input, what is the forced response?

- [x] $y = 2$
- [ ] $y = 4$
- [ ] $y = 4t$
- [ ] $y = 4e^{-t}$

::: reveal
$y = 2$. Guess a constant $y = A$: its derivatives are zero, so $2A = 4$ and $A = 2$. That's the final value of the step response, the DC gain ($1/q$) times the input.
:::
:::

::: nameit
## The structure

For $\ddot y + p\dot y + qy = g(t)$ (constant $p$, $q$), every solution is

$$y = y_h + y_p$$

where $y_h = c_1y_1 + c_2y_2$ is the general solution with $g = 0$ (the natural response, from the roots) and $y_p$ is any one particular solution (the forced response). Find $y_p$ first, then fit $c_1$ and $c_2$ to the starting values using the **whole** $y$.

## The guesses

| Input $g(t)$ | Guess for $y_p$ |
|---|---|
| constant $K$ | $A$ |
| polynomial of degree $n$ | general polynomial of degree $n$ |
| $e^{at}$ | $Ae^{at}$ |
| $\cos\omega t$ or $\sin\omega t$ | $A\cos\omega t + B\sin\omega t$ |
| $e^{at}\cos\omega t$ | $e^{at}(A\cos\omega t + B\sin\omega t)$ |

Substitute, match coefficients, solve for $A$, $B$, ....

For $g = e^{at}$ the guess gives $A(a^2 + pa + q) = 1$: the characteristic polynomial evaluated at the input's rate. In C9 and A10 that becomes the **transfer function**, $\frac{1}{s^2 + ps + q}$ at $s = a$.

## The modification rule

If the guess already solves the homogeneous equation (the input's rate is a root), substitution gives $0 = 1$. Multiply the guess by $t$ (by $t^2$ if the root is double). For $g = e^{rt}$ with $r$ a simple root, $y_p = \frac{t\,e^{rt}}{2r + p}$. The growing factor $t$ is resonance: input and system share a rate.
:::

::: example
## Solve $\ddot y + 3\dot y + 2y = 4$ with $y(0) = 0$, $\dot y(0) = 0$.

::: solution
1. **Particular and homogeneous parts.**
   $$\begin{aligned} y_p &= 2 \\ y_h &= c_1e^{-t} + c_2e^{-2t} \end{aligned}$$
2. **Fit the start.** With $y = 2 + c_1e^{-t} + c_2e^{-2t}$, the conditions $y(0) = 0$ and $\dot y(0) = 0$ give
   $$\begin{aligned} 2 + c_1 + c_2 &= 0 \\ -c_1 - 2c_2 &= 0 \end{aligned}$$
   so $c_1 = -4$ and $c_2 = 2$.

**Answer:** $y = 2 - 4e^{-t} + 2e^{-2t}$.
:::
:::

::: example
## Find a particular solution of $\ddot y + 3\dot y + 2y = e^{-t}$.

::: solution
1. **Choose the guess.** $-1$ is a root, so $Ae^{-t}$ fails; try $y_p = Ate^{-t}$.
2. **Differentiate.**
   $$\begin{aligned} \dot y_p &= A(1 - t)e^{-t} \\ \ddot y_p &= A(t - 2)e^{-t} \end{aligned}$$
3. **Substitute.** The equation gives
   $$\begin{aligned} &A\left[(t - 2) + 3(1 - t) + 2t\right]e^{-t} \\ &= Ae^{-t} \end{aligned}$$
   so $A = 1$ and $y_p = te^{-t}$.
4. **Check with the formula.** The formula $\frac{1}{2r + p} = \frac{1}{-2 + 3}$ agrees.

**Answer:** $y_p = te^{-t}$.
:::
:::

::: example
## Find a particular solution of $\ddot y + 2\dot y + 5y = 10t$.

::: solution
1. **Guess.** The input is a polynomial of degree 1, so guess $y_p = at + b$. Then $\dot y_p = a$ and $\ddot y_p = 0$.
2. **Substitute.**
   $$2a + 5(at + b) = 10t$$
3. **Match coefficients.** Matching the $t$ terms and then the constants,
   $$\begin{aligned} 5a &= 10 \\ 2a + 5b &= 0 \end{aligned}$$
   so $a = 2$ and $b = -0.8$.
4. **Read it.** The output tracks the ramp with a fixed lag.

**Answer:** $y_p = 2t - 0.8$, which tracks the ramp with a fixed lag.
:::
:::

::: check
given: K = 6 | 10; q = 2 | 5
answer: K/q
tolerance: 0.5%

## What is the forced response of $\ddot y + 3\dot y + \given{q}y = \given{K}$?

::: right
Right. A constant $A$ needs $qA = K$: $A$ = {answer}.
:::

::: misses
- [K] The constant must satisfy $qA = K$.
- [K/3] The $\dot y$ term vanishes for a constant; only $q$ matters.
- [any] Not yet. Guess a constant and substitute.
:::
:::

::: check
given: p = 3 | 5; q = 2 | 6; c = 0.5 | 4
answer: 1/(c^2 - p*c + q)
tolerance: 0.5%

## What is $A$ in the forced response $Ae^{-\given{c}t}$ of $\ddot y + \given{p}\dot y + \given{q}y = e^{-\given{c}t}$?

::: right
Right. Substituting gives $A(c^2 - pc + q) = 1$: {answer}.
:::

::: misses
- [1/(c^2 + p*c + q)] The rate is $-c$, so the middle term is $p(-c)$.
- [1/q] That's for a constant input.
- [any] Not yet. Evaluate $r^2 + pr + q$ at $r = -c$.
:::
:::

::: check
given: p = 2 | 4; q = 9 | 25; w = 1 | 2
answer: 1/sqrt((q - w^2)^2 + (p*w)^2)
tolerance: 0.1%

## What is the amplitude of the forced response of $\ddot y + \given{p}\dot y + \given{q}y = \cos(\given{w}t)$?

::: right
Right. Matching the $\cos$ and $\sin$ terms gives amplitude $\frac{1}{\sqrt{(q - \omega^2)^2 + (p\omega)^2}}$ = {answer}.
:::

::: misses
- [1/(q - w^2)] Include the damping term $p\omega$, which shifts the phase.
- [1/q] That's the DC gain; at $\omega$ the inertia term $-\omega^2$ matters.
- [any] Not yet. Guess $A\cos\omega t + B\sin\omega t$, or use a phasor.
:::
:::

::: check
given: p = 3 | 5; q = 2 | 4
answer: -p/q^2
tolerance: 0.5%

## The forced response of $\ddot y + \given{p}\dot y + \given{q}y = t$ is $at + b$. What is $b$?

::: right
Right. $p \cdot a + q(at + b) = t$ gives $a = \frac{1}{q}$ and $pa + qb = 0$, so $b = -\frac{p}{q^2}$ = {answer}.
:::

::: misses
- [p/q^2] Check the sign: $qb = -pa$.
- [1/q] That's $a$, the slope.
- [any] Not yet. Substitute $y = at + b$ and match terms.
:::
:::

::: check
given: a = 1 | 2; b = 3 | 5; let pp = a + b; let qq = a*b
answer: 1/(b - a)
tolerance: 0.5%

## $\ddot y + \given{pp}\dot y + \given{qq}y = e^{-\given{a}t}$ has characteristic roots $-\given{a}$ and $-\given{b}$. The input matches a root, so $y_p = Ate^{-\given{a}t}$. What is $A$?

::: right
Right. $A = \frac{1}{2r + p} = \frac{1}{-2a + a + b} = \frac{1}{b - a}$ = {answer}.
:::

::: misses
- [1/(a - b)] Check the sign: $2r + p$ with $r = -a$, $p = a + b$.
- [any] Not yet. Substitute $Ate^{rt}$, or use $\frac{1}{2r + p}$.
:::
:::

::: check
given: K = 2 | 8; t = 0.5 | 2
answer: K/2*(1 - 2*exp(-t) + exp(-2*t))
tolerance: 0.5%

## Solve $\ddot y + 3\dot y + 2y = \given{K}$ with $y(0) = \dot y(0) = 0$. What is $y(\given{t})$?

::: right
Right. $\frac{K}{2}(1 - 2e^{-t} + e^{-2t})$ = {answer}.
:::

::: misses
- [K/2] That's the final value; at $t$ = {t} the transient remains.
- [K/2*(1 - exp(-t))] Fit both natural modes to both starting values.
- [any] Not yet. $y = \frac{K}{2} + c_1e^{-t} + c_2e^{-2t}$, then fit.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 5 | 10; c = 4 | 6

## Find $y_p = pt + q$ for $\ddot y + \given{a}\dot y + \given{b}y = \given{c}t$.

::: part
answer: c/b
tolerance: 0.5%

### What is $p$?

::: misses
- [any] Match the $t$ terms: $bp = c$.
:::
:::

::: part
answer: -a*c/b^2
tolerance: 0.5%

### What is $q$?

::: misses
- [a*c/b^2] Check the sign: $ap + bq = 0$.
- [any] Match the constants: $ap + bq = 0$.
:::
:::
:::

::: check
kind: derivation
vars: w = 0.5..3, A = 1..5

## Find the particular solution of $\ddot y + 4y = A\cos wt$ by guessing $y_p = K\cos wt$ (with $w \ne 2$).

::: step
answer: 4 - w^2

### Substituting gives $K(4 - w^2)\cos wt = A\cos wt$. What multiplies $K$?
:::

::: step
answer: A/(4 - w^2)

### What is $K$?
:::

::: right
Right. $K = \frac{A}{4 - w^2}$, which grows without bound as $w$ approaches 2.
:::
:::

::: explain
## Why does the guess $Ae^{-t}$ fail for $\ddot y + 3\dot y + 2y = e^{-t}$, and what does the fix mean physically?

::: model
$e^{-t}$ is one of the system's natural responses, since $-1$ is a root of $r^2 + 3r + 2$. Substituting $Ae^{-t}$ gives zero on the left whatever $A$ is, so it can never equal the input. Multiplying by $t$ fixes the algebra. Physically, the input is pushing the system at exactly a rate it would follow on its own, so the response keeps building on itself: it grows like $te^{-t}$ instead of simply following the input. That's resonance, the same thing that happens when a sine drives an undamped oscillator at its natural frequency.
:::
:::

::: practice

::: check
given: q = 4 | 8; K = 12 | 20
answer: K/q
tolerance: 0.5%

## What does the step response of $\ddot y + 2\dot y + \given{q}y = \given{K}$ settle to?

::: misses
- [K] Divide by $q$.
- [any] The forced response, $K/q$.
:::
:::

::: check
given: c = 0.5 | 1.5 | 2.5 | 3 | 4 | 5
answer: 1/(c^2 - 3*c + 2)
tolerance: 0.5%

## What is $A$ for the forced response $Ae^{-\given{c}t}$ of $\ddot y + 3\dot y + 2y = e^{-\given{c}t}$?

::: misses
- [any] $\frac{1}{c^2 - 3c + 2}$.
:::
:::

::: check
given: q = 4 | 16; w = 1 | 3
answer: 1/abs(q - w^2)
tolerance: 0.5%

## For the undamped $\ddot y + \given{q}y = \cos(\given{w}t)$, what is the forced amplitude?

::: misses
- [1/q] At $\omega$ the $-\omega^2$ term counts.
- [any] $\frac{1}{|q - \omega^2|}$.
:::
:::
:::
