07 — Adjoint Methods, Density and Control of the Heat Equation

Mathematical Foundations of Control and Machine Learning — Winter 2026

Central question. How can we compute gradients cheaply when the cost depends on the control through a state equation, and what changes when the state equation is a PDE?

This notebook makes two moves. First, it turns the adjoint into a computational method: one extra solve gives the whole gradient of a cost that depends on the control through a state equation. Second, it takes the duality between controllability and observability to the heat equation, where it survives, but where the step “unique continuation ⇒ observability” breaks down.

Table of Contents

  1. Design through a state equation — the cost sees the control only through the state
  2. The adjoint method — two solves instead of \(N+1\); the state–adjoint–gradient pattern
  3. Density — approximating what cannot be reached exactly
  4. Control of the heat equation — null controllability, and why \(c_{\rm term}=0\)
  5. Control ↔︎ ML
  6. Details — existence for the density functional (optional)
  7. Moments, waves and the geometric control condition (optional)
  8. Exercises
%matplotlib inline
import time
import numpy as np
import torch
import matplotlib.pyplot as plt
import plotting as P           # the course palette, the house style, and the figure helpers

torch.manual_seed(0);
def thomas(lower, diag, upper, rhs):
    """Solve a tridiagonal system in O(N): the three diagonals, then forward/backward sweeps."""
    n = len(diag)
    dd, cc, x = diag.copy(), upper.copy(), rhs.copy()
    for i in range(1, n):
        w = lower[i - 1] / dd[i - 1]
        dd[i] -= w * cc[i - 1]
        x[i] -= w * x[i - 1]
    x[-1] /= dd[-1]
    for i in range(n - 2, -1, -1):
        x[i] = (x[i] - cc[i] * x[i + 1]) / dd[i]
    return x

def bisect(f, lo, hi, iters=200):
    """Root of a monotone increasing scalar function on [lo, hi], by bisection."""
    for _ in range(iters):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if f(mid) < 0 else (lo, mid)
    return (lo + hi) / 2

Where are we?

Recap. To steer \(x'=Ax+Bu\) from \(x^0\) to \(x^1\), minimize the dual functional \(J(\varphi_T)=\tfrac12\int_0^T|B^*\varphi|^2-\langle x^1,\varphi_T\rangle+\langle x^0,\varphi(0)\rangle\) over solutions of the adjoint system \(-\varphi'=A^*\varphi\), \(\varphi(T)=\varphi_T\). Observability, \(\int_0^T|B^*\varphi|^2\,dt\ge c_0|\varphi(0)|^2\), makes \(J\) coercive, and the control is \(u=B^*\hat\varphi\) (notebook 03). In finite dimension, observability is equivalent to unique continuation. Minimizers exist under continuity, convexity and coercivity, gradient descent finds them, and Lagrange multipliers are the seeds of adjoint states.

1. Design through a state equation

In optimal shape design for aeronautics the cost (drag, lift, noise) depends on the shape \(\Omega\) not directly, but through the solution of the air dynamics around the airplane. The same structure appears in every control problem: the control acts on a state, and the cost measures the state.

The mechanism is clearest in the simplest setting. Let \(A\) be an invertible \(N\times N\) matrix, the state \(x\in\mathbb R^N\) solve \[ Ax=b , \] where \(b\in\mathbb R^N\) is the control, and let \(x^*\) be a target. Of course \(b=Ax^*\) would hit the target exactly. The aim is to understand how an optimal control strategy is implemented, so we minimize the compromise \[ J(b)=\tfrac12|x-x^*|^2+\tfrac12|b|^2 ,\qquad x=A^{-1}b . \] By the direct method there is a unique minimizer \(\bar b\): \(J\) is continuous, strictly convex and coercive. It is characterized by the Euler–Lagrange equation \[ J'(\bar b)\cdot c=(\bar x-x^*,\,y)+(\bar b,\,c)=0\qquad\text{for all }c\in\mathbb R^N,\qquad\text{where }Ay=c . \] Here \(y\) is the sensitivity of the state in the direction \(c\).

2. The adjoint method

The cost of the naive approach. The optimality system above consists of \(N\) equations, and writing it requires solving \(Ay=c\) for every \(c\) in a basis of \(\mathbb R^N\): \(N\) solves. The same happens at every step of a gradient-descent iteration, which needs \(\nabla J(b)\). Finite differences, \(\partial_iJ(b)\approx\big(J(b+he_i)-J(b)\big)/h\), also need \(N+1\) solves, and they are only approximate.

The adjoint state. Introduce the solution \(p\) of the adjoint system \[ A^*p=x-x^* . \] The key observation is as simple as it is useful: \[ (x-x^*,\,y)=(A^*p,\,y)=(p,\,Ay)=(p,\,c). \] Therefore \[ \boxed{\;\nabla J(b)=p+b,\qquad Ax=b,\quad A^*p=x-x^* .\;} \] One state solve and one adjoint solve give the whole gradient, whatever \(N\) is — and this reduces dramatically the computational cost. The computation holds at every \(b\), which is what gradient descent needs; at the minimizer, \(\nabla J(\bar b)=0\) gives \(\bar b=-\bar p\): the optimal control is (minus) the adjoint state, the same structure as the HUM control \(u=B^*\hat\varphi\).

Where the adjoint comes from. Treat \(Ax=b\) as a constraint, with a Lagrange multiplier \(p\): \[ \mathscr L(b,x,p)=\tfrac12|x-x^*|^2+\tfrac12|b|^2-(p,\,Ax-b). \] Stationarity in \(x\) gives \(x-x^*-A^*p=0\), the adjoint equation. Stationarity in \(b\) gives \(b+p=0\). The adjoint state is the Lagrange multiplier of the state equation. For an evolution equation \(x'=Ax+Bu\) with a terminal cost, the same computation produces the backward adjoint system \(-\varphi'=A^*\varphi\). The forward solve is then followed by one backward solve.

The state–adjoint–gradient structure. One of the central patterns of the course.

Algebraic model (§§1–2) Evolution model
STATE, forward \(Ax=b\) \(x'=Ax+Bu\), \(x(0)=x^0\), solved forward in time
ADJOINT, backward \(A^*p=x-x^*\) \(-\varphi'=A^*\varphi\), \(\varphi(T)=x(T)-x^1\), solved backward in time
GRADIENT, combination \(\nabla J(b)=p+b\) \(\nabla J(u)(t)=u(t)+B^*\varphi(t)\)

The cost on the right is \(J(u)=\tfrac12|x(T)-x^1|^2+\tfrac12\int_0^T|u|^2\,dt\). The state is computed once forward, the adjoint once backward, its source is the derivative of the cost with respect to the state, and the gradient combines the adjoint with the explicit dependence of the cost on the control. The evolution column follows from the duality identity \(\langle x(T),\varphi(T)\rangle-\langle x(0),\varphi(0)\rangle=\int_0^T\langle u,B^*\varphi\rangle\,dt\), exactly as \((x-x^*,y)=(p,c)\) followed from \(A^*p=x-x^*\) here.

Method Solves of \(A\,\cdot=\cdot\) or \(A^*\cdot=\cdot\) per gradient Exact?
Sensitivities \(Ay=e_i\) \(1+N\) yes
Forward finite differences \(1+N\) no: error \(O(h)\) plus rounding \(O(\varepsilon_{\rm mach}/h)\)
Adjoint \(2\) yes, up to rounding

Laboratory 1: adjoint versus finite differences. We take a steady convection–diffusion operator on \((0,1)\) with \(N\) interior nodes, \(A=-\Delta_h+c\,D_h\), where \(D_h\) is the centred first difference and \(c=20\). It is not symmetric, so the adjoint \(A^*=A^\top\) really differs from \(A\). The target is \(x^*_i=\sin(\pi x_i)\), and we evaluate \(\nabla J\) at \(b=0\). \(A\) is tridiagonal, so one solve costs \(O(N)\) operations (the thomas sweep above), and nothing is reused between solves. The structural result is the solve count; running times depend on implementation and hardware.

Code and plot. Count and time the solves, then run the gradient check: a correct adjoint gradient makes the forward-difference error decrease like \(h\) until rounding takes over.

grid = lambda N: (np.linspace(1, N, N) / (N + 1), 1.0 / (N + 1))

def convection_diffusion(N, c=20.0):
    """The three diagonals of A = -Laplacian_h + c D_h (not symmetric)."""
    h = 1.0 / (N + 1)
    lower = np.full(N - 1, -1 / h ** 2 - c / (2 * h))
    diag = np.full(N, 2 / h ** 2)
    upper = np.full(N - 1, -1 / h ** 2 + c / (2 * h))
    return lower, diag, upper

solve_A = lambda A3, rhs: thomas(*A3, rhs)
solve_AT = lambda A3, rhs: thomas(A3[2], A3[1], A3[0], rhs)        # A^T: swap the off-diagonals

def cost(A3, b, target):
    x = solve_A(A3, b)
    return 0.5 * np.sum((x - target) ** 2) + 0.5 * np.sum(b ** 2)

def gradient_adjoint(A3, b, target):
    x = solve_A(A3, b)                                 # one state solve
    p = solve_AT(A3, x - target)                       # one adjoint solve
    return p + b

def gradient_fd(A3, b, target, h=1e-6):
    J0, g = cost(A3, b, target), np.empty_like(b)
    for i in range(len(b)):                            # N more state solves
        e = np.zeros_like(b); e[i] = h
        g[i] = (cost(A3, b + e, target) - J0) / h
    return g

sizes = [50, 100, 200, 400, 800, 1600]
t_adj, t_fd = [], []
for N in sizes:
    A3, target, b = convection_diffusion(N), np.sin(np.pi * grid(N)[0]), np.zeros(N)
    t0 = time.perf_counter(); g_adj = gradient_adjoint(A3, b, target); t_adj.append(time.perf_counter() - t0)
    t0 = time.perf_counter(); g_fd = gradient_fd(A3, b, target); t_fd.append(time.perf_counter() - t0)
    print(f"N = {N:5d}: solves adjoint 2, finite differences {N + 1:5d};"
          f"  time {t_adj[-1]:.1e} s vs {t_fd[-1]:.1e} s;"
          f"  relative difference {np.linalg.norm(g_fd - g_adj) / np.linalg.norm(g_adj):.1e}")

# Independent check by dense linear algebra (N = 200): grad J = A^{-T}(A^{-1} b - x*) + b
N = 200
A3, target = convection_diffusion(N), np.sin(np.pi * grid(N)[0])
b_test = 0.1 * np.cos(np.arange(N))
Ad = np.diag(A3[1]) + np.diag(A3[0], -1) + np.diag(A3[2], 1)
g_dense = np.linalg.solve(Ad.T, np.linalg.solve(Ad, b_test) - target) + b_test
print("adjoint vs dense formula at a nonzero b:",
      f"{np.linalg.norm(gradient_adjoint(A3, b_test, target) - g_dense) / np.linalg.norm(g_dense):.1e}")

# Directional gradient check at b_test: (J(b + h d) - J(b)) / h  ->  grad J . d  as h -> 0
direction = np.sin(np.arange(float(N))); direction /= np.linalg.norm(direction)
slope = gradient_adjoint(A3, b_test, target) @ direction
J_ref = cost(A3, b_test, target)
steps = np.logspace(-12, -1, 23)
fwd_err = np.array([abs((cost(A3, b_test + h * direction, target) - J_ref) / h - slope)
                    for h in steps]) / abs(slope)
ctr_err = np.array([abs((cost(A3, b_test + h * direction, target)
                         - cost(A3, b_test - h * direction, target)) / (2 * h) - slope)
                    for h in steps]) / abs(slope)
print(f"directional derivative by the adjoint: {slope:.12e}")

fig, (ax1, ax2) = P.panels(2, size=(4.6, 3.4))
ax1.loglog(sizes, t_fd, "o-", color=P.GREY, label="finite differences ($N+1$ solves)")
ax1.loglog(sizes, t_adj, "s-", color=P.MAGENTA, label="adjoint (2 solves)")
P.label(ax1, "number of unknowns $N$", "time for one gradient [s]")
ax2.loglog(steps, fwd_err, "o-", color=P.GREY, label="forward difference")
ax2.loglog(steps, ctr_err, "s-", color=P.BLUE, ms=4, label="centred difference")
ax2.loglog(steps, fwd_err[-1] * steps / steps[-1], ":", color=P.INK, lw=1, label="slope 1")
P.label(ax2, "step $h$", r"relative error vs $\nabla J\cdot d$")
plt.show()
N =    50: solves adjoint 2, finite differences    51;  time 1.3e-04 s vs 4.2e-03 s;  relative difference 2.7e-05
N =   100: solves adjoint 2, finite differences   101;  time 5.2e-04 s vs 1.2e-02 s;  relative difference 2.7e-05
N =   200: solves adjoint 2, finite differences   201;  time 4.1e-04 s vs 4.3e-02 s;  relative difference 2.7e-05
N =   400: solves adjoint 2, finite differences   401;  time 1.1e-03 s vs 2.3e-01 s;  relative difference 2.7e-05
N =   800: solves adjoint 2, finite differences   801;  time 3.4e-03 s vs 8.0e-01 s;  relative difference 2.8e-05
N =  1600: solves adjoint 2, finite differences  1601;  time 6.0e-03 s vs 3.6e+00 s;  relative difference 2.9e-05
adjoint vs dense formula at a nonzero b: 8.4e-16
directional derivative by the adjoint: 4.276492398584e-03

The structural message: one gradient costs \(2\) solves by the adjoint method and \(N+1\) by finite differences. The machine-dependent times only illustrate it. On the right, the forward-difference error decreases like \(h\) (dotted slope-1 line) until about \(h\approx10^{-7}\), where rounding errors of size \(\varepsilon_{\rm mach}/h\) take over. This first-order decrease is the test that the adjoint gradient is correct; a wrong gradient would make the error level off at a fixed value instead. The centred difference is exact for this quadratic cost, so only its rounding error is visible. The adjoint gradient is the exact derivative of the discrete cost, up to rounding, and it agrees with an independent dense computation to about \(10^{-15}\).

Control ↔︎ ML: the adjoint method and reverse-mode differentiation

Training a network means computing the gradient of a loss with respect to many parameters, through a chain of layers. Backpropagation (Werbos, 1974) is the chain rule in reverse accumulation mode, and the correspondence with the box above is precise. The forward pass propagates the state through the layers. The backward pass propagates the adjoint, the sensitivity of the loss, through the transposed layer maps. The gradient with respect to every parameter combines the two, at the cost of about one extra pass, whatever the number of parameters.

For a computation written as a finite sequence of steps, reverse-mode differentiation is the discrete adjoint of that sequence. In continuous-time models one must still choose between differentiating the continuous problem and then discretizing the adjoint, or discretizing first and differentiating the discrete steps. The two adjoints need not coincide. Exercise 6 is a first instance of the discrete adjoint.

3. Density: approximating what cannot be reached exactly

Let \(H\) be a Hilbert space and \(\mathcal L:H\to H\) a bounded linear operator with dense range. Then for every \(f\in H\) and every \(\varepsilon>0\) there is \(u\in H\) with \[ \|\mathcal Lu-f\|_H\le\varepsilon . \tag{D} \] The range is often dense without \(\mathcal L\) being surjective. This happens for time-irreversible evolutions, such as the heat equation, and it is relevant in control: the system can be steered to a dense set of targets, but not to all of them. The classical example is the Gaussian filter \(\mathcal Lu=G*u\), \(G(x)=(4\pi)^{-N/2}e^{-|x|^2/4}\), which is the solution at time \(1\) of the heat equation with initial datum \(u\). Its outputs are extremely smooth, so a discontinuous \(f\) is never exactly \(\mathcal Lu\), yet it can be approximated.

Dense range ⟺ injective adjoint. By the Hahn–Banach theorem, the range of \(\mathcal L\) is dense if and only if \(\mathcal L^*\) is injective: \(\mathcal L^*v=0\) implies \(v=0\). In finite dimension this is the identity \((\operatorname{Range}\mathcal L)^\perp=\ker \mathcal L^*\) (Exercise 3).

A constructive method. In practice we need an algorithm to build \(u\). Consider \[ J_\varepsilon(v)=\tfrac12\|\mathcal L^*v\|_H^2+\varepsilon\|v\|_H-(f,v)_H . \] Both \(f\) and \(\varepsilon\) enter its definition.

Theorem 1 (density by minimization). Assumption: \(\mathcal L^*\) is injective.

Conclusion: \(J_\varepsilon\) has a minimizer \(\tilde v\), and \(u=\mathcal L^*\tilde v\) satisfies \(\|\mathcal Lu-f\|_H\le\varepsilon\).

Interpretation: the approximate control is the image under \(\mathcal L^*\) of the minimizer, exactly as the HUM control was \(B^*\hat\varphi\).

Proof that the minimizer gives (D). For any \(v\) and \(\delta>0\), \(J_\varepsilon(\tilde v\pm\delta v)-J_\varepsilon(\tilde v)\ge0\). The norm term changes by at most \(\varepsilon\delta\|v\|\), by the triangle inequality. Keeping the terms of order \(\delta\) and letting \(\delta\to0\) gives \[ \big|(\mathcal L^*\tilde v,\mathcal L^*v)-(f,v)\big|\le\varepsilon\|v\|,\quad\text{that is,}\quad\big|(\mathcal L\mathcal L^*\tilde v-f,\,v)\big|\le\varepsilon\|v\|\quad\text{for all }v, \] so \(\|\mathcal L\mathcal L^*\tilde v-f\|\le\varepsilon\). \(\square\)

Existence. \(J_\varepsilon\) is continuous and convex, so by the direct method it suffices to prove coercivity. Under injectivity alone, coercivity rests on weak compactness: the proof is in §6.

Why the term \(\varepsilon\|v\|\) is needed. If we had \(\|\mathcal L^*v\|^2\ge\alpha\|v\|^2\), \(J\) would be coercive even for \(\varepsilon=0\), and \(\mathcal L\) would be onto. Injectivity alone does not guarantee that inequality (an injective operator may or may not be bounded below), and when it fails the \(\varepsilon\)-term provides coercivity. Injectivity is qualitative; the inequality is quantitative. This is the distinction between unique continuation and observability, which will decide the fate of the heat equation in §4.

How to compute the minimizer. The norm \(\|v\|\) is differentiable at every \(v\ne0\) but not at \(v=0\). If \(\tilde v\ne0\), the minimizer satisfies \(\mathcal L\mathcal L^*\tilde v+\varepsilon\,\tilde v/\|\tilde v\|=f\). Writing \(\mu=\varepsilon/\|\tilde v\|\), this is \(\tilde v=(\mathcal L\mathcal L^*+\mu I)^{-1}f\), and \(\mu\) is fixed by the condition \(\|\mathcal L\mathcal L^*\tilde v-f\|=\mu\|\tilde v\|=\varepsilon\). The residual is an increasing function of \(\mu\), so one scalar root-finding gives \(\mu\). \(J_\varepsilon\) is strictly convex (\(\mathcal L^*\) is injective), so \(\tilde v\) is unique. If \(\|f\|>\varepsilon\), then \(\tilde v\ne0\) (for \(\tilde v=0\) the inequality above reads \(|(f,v)|\le\varepsilon\|v\|\), i.e. \(\|f\|\le\varepsilon\)), and the residual equals \(\varepsilon\) exactly. If \(\|f\|\le\varepsilon\), then \(J_\varepsilon(v)\ge(\varepsilon-\|f\|)\|v\|\ge0=J_\varepsilon(0)\), so \(u=0\) and the residual is \(\|f\|\le\varepsilon\).

Code and plot. \(\mathcal L\) is the heat semigroup at a small time \(\tau\) on \((0,1)\), in the exact sine basis. Two targets: a “hat” function with three kinks, which is not in the range of \(\mathcal L\), and \(f=\mathcal Lg_0\) for a smooth bump \(g_0\). How does \(\|u_\varepsilon\|\) behave as \(\varepsilon\to0\) in each case?

# L e_j = exp(-(j pi)^2 tau) e_j with e_j(x) = sqrt(2) sin(j pi x). We keep J_modes modes; the
# exact coefficients of the target beyond them are counted in the residual (they cannot be reached).
tau, J_modes = 5e-4, 400
j = np.arange(1, J_modes + 1)
sigma = np.exp(-(j * np.pi) ** 2 * tau)

c_hat, w_hat = 0.45, 0.15                              # hat f = max(0, 1 - |x - c|/w), exact coefficients
a_j = j * np.pi
hat_coeffs = -np.sqrt(2) / (a_j ** 2 * w_hat) * (np.sin(a_j * (c_hat - w_hat))
                                                 - 2 * np.sin(a_j * c_hat) + np.sin(a_j * (c_hat + w_hat)))
hat_norm = np.sqrt(2 * w_hat / 3)
hat_tail = np.sqrt(max(hat_norm ** 2 - np.sum(hat_coeffs ** 2), 0.0))

x_fine = np.linspace(0, 1, 4001)
basis = np.sqrt(2) * np.sin(np.outer(x_fine, j) * np.pi)
g0 = np.exp(-((x_fine - 0.45) / 0.08) ** 2)            # smooth bump; f = L g0 lies in the range
g0_coeffs = np.trapezoid(basis * g0[:, None], x_fine, axis=0)
range_coeffs = sigma * g0_coeffs

def density_control(coeffs, eps, tail=0.0):
    # Minimizer of J_eps: v = (L L* + mu)^{-1} f with ||L L* v - f|| = eps; returns the coeffs of u = L* v.
    if np.sqrt(np.sum(coeffs ** 2) + tail ** 2) <= eps:
        return np.zeros_like(coeffs)
    residual = lambda log_mu: np.sqrt(np.sum((np.exp(log_mu) / (sigma ** 2 + np.exp(log_mu))
                                              * coeffs) ** 2) + tail ** 2) - eps
    mu = np.exp(bisect(residual, -740, 30, iters=300))
    return sigma * coeffs / (sigma ** 2 + mu)

eps_rel = [1e-1, 3e-2, 1e-2, 5e-3, 3e-3]
norms_hat = [np.linalg.norm(density_control(hat_coeffs, e * hat_norm, hat_tail)) for e in eps_rel]
norms_range = [np.linalg.norm(density_control(range_coeffs, e * np.linalg.norm(range_coeffs)))
               for e in eps_rel]
print("unreachable part of the hat beyond", J_modes, "modes, relative:", f"{hat_tail / hat_norm:.1e}")
for e, n1, n2 in zip(eps_rel, norms_hat, norms_range):
    print(f"eps = {e:5.0e} x ||f||:  ||u_eps|| for the hat = {n1:.3e};  for f = L g0: {n2:.4f}"
          f"  (bound 2||g0|| = {2 * np.sqrt(np.sum(g0_coeffs ** 2)):.4f})")

fig, (ax1, ax2) = P.panels(2, size=(4.6, 3.4))
ax1.plot(x_fine, np.maximum(0, 1 - np.abs(x_fine - c_hat) / w_hat), color=P.INK, lw=2,
         label="target $f$ (hat)")
for e, color in zip((1e-1, 1e-2, 3e-3), (P.GREY, P.AQUA, P.ORANGE)):
    u_coeffs = density_control(hat_coeffs, e * hat_norm, hat_tail)
    ax1.plot(x_fine, basis @ (sigma * u_coeffs), color=color,
             label=rf"$\mathcal{{L}}u_\varepsilon$, $\varepsilon={e:g}\,\|f\|$")
P.label(ax1, "$x$")
ax2.loglog(eps_rel, norms_hat, "o-", color=P.ORANGE, label=r"hat: not in the range of $\mathcal{L}$")
ax2.loglog(eps_rel, norms_range, "s-", color=P.BLUE, label=r"$f=\mathcal{L}g_0$: in the range")
ax2.invert_xaxis()
P.label(ax2, r"tolerance $\varepsilon/\|f\|$", r"$\|u_\varepsilon\|$")
plt.show()
unreachable part of the hat beyond 400 modes, relative: 3.8e-04
eps = 1e-01 x ||f||:  ||u_eps|| for the hat = 3.065e-01;  for f = L g0: 0.2843  (bound 2||g0|| = 0.6333)
eps = 3e-02 x ||f||:  ||u_eps|| for the hat = 3.391e-01;  for f = L g0: 0.3069  (bound 2||g0|| = 0.6333)
eps = 1e-02 x ||f||:  ||u_eps|| for the hat = 2.511e+01;  for f = L g0: 0.3134  (bound 2||g0|| = 0.6333)
eps = 5e-03 x ||f||:  ||u_eps|| for the hat = 4.799e+07;  for f = L g0: 0.3150  (bound 2||g0|| = 0.6333)
eps = 3e-03 x ||f||:  ||u_eps|| for the hat = 3.954e+17;  for f = L g0: 0.3157  (bound 2||g0|| = 0.6333)

Every tolerance used is below \(\|f\|\), so the residual is exactly \(\varepsilon\). For \(f=\mathcal Lg_0\) the norm stays below \(2\|g_0\|\) for every \(\varepsilon\): indeed \(J_\varepsilon(\tilde v)\le J_\varepsilon(0)=0\) gives \(\tfrac12\|\mathcal L^*\tilde v\|^2\le(\mathcal Lg_0,\tilde v)=(g_0,\mathcal L^*\tilde v)\le\|g_0\|\,\|\mathcal L^*\tilde v\|\). For the hat, \(\|u_\varepsilon\|\) explodes: it is about \(25\) at \(\varepsilon=10^{-2}\|f\|\) and astronomically large at \(3\cdot10^{-3}\|f\|\). Approximating a target outside the range requires the high modes, which the filter damps like \(e^{-(j\pi)^2\tau}\), and the control must undo that damping. Dense range gives every tolerance, but not at a bounded cost.

4. Control of the heat equation

Let \(\Omega\subset\mathbb R^n\) be a bounded, connected open set with \(C^2\) boundary, \(\omega\subset\Omega\) a nonempty open subset where the control acts, and \(1_\omega\) its characteristic function. The controlled heat equation is \[ \begin{cases} y_t-\Delta y=u\,1_\omega & \text{in }\Omega\times(0,T),\\ y=0 & \text{on }\partial\Omega\times(0,T),\\ y(x,0)=y^0(x) & \text{in }\Omega, \end{cases} \] with \(y^0\in L^2(\Omega)\) and \(u\in L^2(\omega\times(0,T))\). The heat equation is time-irreversible and smoothing, so the set of states reachable at time \(T\) is dense in \(L^2(\Omega)\) (approximate controllability) but is not all of \(L^2(\Omega)\): exact controllability to arbitrary \(L^2\) targets fails. The notion studied here is null controllability: steer the state to \(y(T)=0\).

Theorem 2 (null controllability; Fursikov–Imanuvilov, Lebeau–Robbiano; cited without proof). Assumptions: \(\Omega\) bounded, connected, with \(C^2\) boundary; \(\omega\subset\Omega\) nonempty and open; \(T>0\); data \(y^0\in L^2(\Omega)\), controls in \(L^2(\omega\times(0,T))\).

Conclusion: for every such \(T\), \(\omega\) and \(y^0\) there is a control \(u\in L^2(\omega\times(0,T))\) with \(y(T)=0\).

Interpretation: heat can be steered to rest in arbitrarily short time, from an arbitrarily small region. The proofs rely on Carleman inequalities, which are beyond this course.

HUM for the heat equation. Exactly as in finite dimension, the control of minimal \(L^2\) norm is obtained by minimizing \[ J_0(\varphi_T)=\frac12\int_0^T\!\!\int_\omega\varphi^2\,dx\,dt+\int_\Omega\varphi(x,0)\,y^0(x)\,dx \] over the solutions of the adjoint heat equation, which runs backward in time: \[ -\varphi_t-\Delta\varphi=0\ \text{ in }\Omega\times(0,T),\qquad\varphi=0\ \text{ on }\partial\Omega\times(0,T),\qquad\varphi(x,T)=\varphi_T(x). \] \(J_0\) is continuous and convex. It is coercive because of the observability inequality \[ \|\varphi(\cdot,0)\|_{L^2(\Omega)}^2\le C\int_0^T\!\!\int_\omega\varphi^2\,dx\,dt\qquad\text{for all }\varphi_T, \tag{O} \] which is the initial-form inequality \(\int_0^T|B^*\varphi|^2\,dt\ge c_0|\varphi(0)|^2\) of finite dimension, with \(c_0=1/C\). If \(\bar\varphi\) is the adjoint solution associated with the minimizer, the control is \[ u=\bar\varphi\,1_\omega , \] the observation of the optimal adjoint.

Remark (the right space for the minimization). Inequality (O) bounds \(\varphi(0)\), not \(\varphi_T\), by the observed quantity. It gives coercivity with respect to the norm \(\big(\int_0^T\!\int_\omega\varphi^2\big)^{1/2}\), which is strictly weaker than the \(L^2(\Omega)\)-norm of \(\varphi_T\) (see below). The minimizer therefore exists in the completion of \(L^2(\Omega)\) for that norm, which is the standard framework. The control \(u=\bar\varphi 1_\omega\) is still in \(L^2\).

How the control is distributed in time. Three things must be kept apart. - A classical observation. The control tends to concentrate its action near \(t=T\). This is related to the structure of the optimality system, \[ y_t-\Delta y=\varphi 1_\omega,\quad y(0)=y^0,\quad y(T)=0;\qquad-\varphi_t-\Delta\varphi=0, \] in which the adjoint appears isolated, as the solution of its own backward equation, with no coupling back from the state. - What the backward equation suggests. Run backward from \(t=T\), the adjoint damps its high frequencies, so \(\bar\varphi\) can be large and oscillatory near \(t=T\) and smoother at earlier times. This is a heuristic. It does not by itself imply that \(\|\bar\varphi(t)\|_{L^2(\omega)}\) is monotone in \(t\), nor that the action concentrates at \(t=T\) for every horizon. - What our examples show. In the regularized (\(\varepsilon\)) controls below, the action concentrates near \(t=T\) for \(T=0.5\) and \(T=1\), but not for the short horizon \(T=0.1\), where the control acts during the whole interval and decreases towards the end.

Theorem 2 says nothing about the time profile of the control.

Unique continuation does not imply observability

In finite dimension the observability inequality is equivalent to unique continuation, \(B^*\varphi\equiv0\Rightarrow\varphi_T=0\). The proof uses the compactness of the unit sphere of \(\mathbb R^n\), and the equivalence is not true for infinite-dimensional systems. The heat equation shows both halves of the story. We use the 1-D case \(\Omega=(0,1)\), where the eigenfunctions of \(-\partial_{xx}\) are \(e_j(x)=\sqrt2\sin(j\pi x)\), with eigenvalues \(\lambda_j=(j\pi)^2\).

Unique continuation holds. Write \(\varphi(x,t)=\sum_ja_je^{-\lambda_j(T-t)}e_j(x)\). If \(\varphi=0\) on \(\omega\times(0,T)\), then for each \(x\in\omega\) the Dirichlet series \(s\mapsto\sum_ja_je_j(x)e^{-\lambda_js}\) vanishes for \(s\in(0,T)\). It is analytic in \(s>0\), so it vanishes for all \(s>0\). Multiplying by \(e^{\lambda_1s}\) and letting \(s\to\infty\) gives \(a_1e_1(x)=0\), and inductively \(a_je_j(x)=0\) for all \(j\) and all \(x\in\omega\). Hence \(a_j=0\) and \(\varphi_T=0\). By §3, the control-to-state map has a dense range: the heat equation is approximately controllable.

Observability of the terminal datum fails. Take \(\varphi_T=e_j\). Then \(\varphi=e^{-\lambda_j(T-t)}e_j\), and \[ \int_0^T\!\!\int_\omega\varphi^2\le\int_0^Te^{-2\lambda_j(T-t)}dt\le\frac1{2\lambda_j}\ \longrightarrow\ 0, \qquad\text{while}\qquad\|\varphi_T\|=1 . \] No inequality \(\|\varphi_T\|^2\le C\int\!\int_\omega\varphi^2\) can hold. The terminal observability constant is \(c_{\rm term}=0\). This is why exact controllability to arbitrary targets fails. The inequality (O) that does hold bounds only \(\varphi(0)=e^{-\lambda_jT}e_j\), which is exponentially small for high modes. That (O) holds at all, with a constant uniform over all \(\varphi_T\), is the deep part of Theorem 2. Unique continuation alone does not give it.

Qualitative versus quantitative: a summary. Let \(\mathcal L:L^2(\omega\times(0,T))\to L^2(\Omega)\), \(u\mapsto y(T)\) with \(y^0=0\), be the control-to-final-state map. Its adjoint is \(\mathcal L^*\varphi_T=\varphi\,1_\omega\), by the duality identity of §2. The results of §3 apply verbatim to an operator between two different Hilbert spaces.

Type Property of \(\mathcal L^*\) Consequence for the range of \(\mathcal L\) Controllability Heat equation
qualitative \(\mathcal L^*\varphi_T=0\Rightarrow\varphi_T=0\) (unique continuation) \(\overline{\operatorname{Range}\mathcal L}=L^2(\Omega)\) (dense) approximate holds
quantitative, partial \(\|\varphi(0)\|\le\sqrt C\,\|\mathcal L^*\varphi_T\|\), inequality (O) \(\operatorname{Range}\mathcal L\supseteq\operatorname{Range}e^{T\Delta}\) null holds (Theorem 2)
quantitative, full \(\|\mathcal L^*\varphi_T\|\ge c\,\|\varphi_T\|\) (coercivity) \(\operatorname{Range}\mathcal L=L^2(\Omega)\) (onto) exact fails (\(c_{\rm term}=0\))

Each row implies the one above it. The second row’s equivalence between (O) and the range inclusion is a standard duality lemma, stated here without proof. In finite dimension the three rows coincide. For the heat equation they are three different properties, and the injectivity of the first row does not by itself provide the inequality of the second.

What (O) buys: bounded controls. Combine the density method of §3 with the heat equation. Minimize \[ J_\varepsilon(\varphi_T)=\tfrac12\int_0^T\!\!\int_\omega\varphi^2+\varepsilon\|\varphi_T\|+\int_\Omega\varphi(0)\,y^0 . \] By Theorem 1, applied with \(\mathcal L\) the control-to-state map and \(f=-e^{T\Delta}y^0\), the control \(u_\varepsilon=\varphi_\varepsilon1_\omega\) gives \(\|y(T)\|\le\varepsilon\). And since \(J_\varepsilon(\varphi_\varepsilon)\le J_\varepsilon(0)=0\), (O) gives \[ \tfrac12\|u_\varepsilon\|^2\le-\int_\Omega\varphi_\varepsilon(0)y^0\le\sqrt C\,\|y^0\|\,\|u_\varepsilon\|,\qquad\text{so}\qquad\|u_\varepsilon\|_{L^2(\omega\times(0,T))}\le2\sqrt C\,\|y^0\| , \] uniformly in \(\varepsilon\). A weak limit as \(\varepsilon\to0\) is a null control. Without (O), as for the hat target of §3, the controls exist for each \(\varepsilon\) but their norms may blow up.

Laboratory 2: the discretized heat equation. We discretize \(\Omega=(0,1)\) with \(N_x\) interior nodes and the Dirichlet Laplacian \(\Delta_h\), with control region \(\omega=(0.2,0.5)\), horizon \(T=0.1\) and initial state \(y^0=1_{(0.6,0.9)}\), which lies outside \(\omega\). The semi-discrete system \(y'=\Delta_hy+1_\omega u\) is solved exactly in time, through the eigenpairs of \(\Delta_h\), and its Gramian is computed in closed form in that basis, without quadrature. All norms are discrete \(L^2\) norms, \(\|v\|_h^2=h\sum_iv_i^2\) for the state and \(\int_0^T\|u(t)\|_h^2dt\) for the control.

We first look at the Gramian \(\mathcal G_T\), which would give the exact discrete null control through \(\mathcal G_T\varphi_T=-e^{T\Delta_h}y^0\). Then we compute the \(\varepsilon\)-controls of the functional \(J_\varepsilon\) above, for several tolerances and meshes. As \(N_x\) grows, what happens to \(\lambda_{\min}(\mathcal G_T)\)? Can we trust a direct solve of \(\mathcal G_T\varphi_T=d\) for \(N_x=50\)?

Code and plot. The spectrum of the discrete Gramian, and the norms of the \(\varepsilon\)-controls.

T_heat, omega = 0.1, (0.2, 0.5)
indicator = lambda x, a, b: ((x > a) & (x < b)).astype(float)

def laplacian_eigen(n_x):
    """Eigenpairs of -Delta_h (tridiagonal, Dirichlet): mu ascending, V orthonormal."""
    h = 1.0 / (n_x + 1)
    L = (np.diag(np.full(n_x, 2.0)) - np.diag(np.ones(n_x - 1), 1)
         - np.diag(np.ones(n_x - 1), -1)) / h ** 2
    return np.linalg.eigh(L)

def heat_setup(n_x, T_):
    x, h = np.linspace(1, n_x, n_x) / (n_x + 1), 1.0 / (n_x + 1)
    mu, V = laplacian_eigen(n_x)
    w = indicator(x, *omega)
    W = V.T @ (w[:, None] * V)                         # the control region in eigen-coordinates
    S = mu[:, None] + mu[None, :]
    K = W * (-np.expm1(-S * T_)) / S                   # G_T = V K V^T, exact in time
    d_hat = np.exp(-mu * T_) * (V.T @ indicator(x, 0.6, 0.9))      # e^{T Delta_h} y0, eigen-coords
    return x, h, mu, V, w, K, d_hat

def eps_null_control(K, d_hat, h, eps):
    # Minimize 1/2 phi^T K phi + eps |phi|_h + <d, phi>: phi = -(K + m I)^{-1} d with |y(T)|_h = eps
    lam, W2 = np.linalg.eigh(K)
    dd = W2.T @ d_hat
    residual = lambda log_m: np.sqrt(h) * np.linalg.norm(np.exp(log_m) / (lam + np.exp(log_m)) * dd) - eps
    m_eps = np.exp(bisect(residual, -100, 20, iters=300))
    phi_hat = -W2 @ (dd / (lam + m_eps))
    y_T = d_hat + K @ phi_hat
    return phi_hat, np.sqrt(h * phi_hat @ K @ phi_hat), np.sqrt(h) * np.linalg.norm(y_T)

grams = {}
for n_x in (6, 8, 10, 12, 14, 16, 20, 30, 50):
    eig = np.linalg.eigvalsh(heat_setup(n_x, T_heat)[5])
    grams[n_x] = (eig[0], eig[-1])
print("computed lambda_min, lambda_max of G_T:", {n: (f"{a:.1e}", f"{b:.1e}") for n, (a, b) in grams.items()})

eps_list = [1e-1, 1e-2, 1e-3, 1e-4]
control_norms = {}
for n_x in (20, 40, 80, 160):
    x, h, mu, V, w, K, d_hat = heat_setup(n_x, T_heat)
    free = np.sqrt(h) * np.linalg.norm(d_hat)          # |e^{T Delta_h} y0|: doing nothing
    rows = [eps_null_control(K, d_hat, h, e * free) for e in eps_list]
    control_norms[n_x] = [r[1] for r in rows]
    print(f"N_x = {n_x:3d}: ||u_eps|| = {np.round(control_norms[n_x], 4)};  attained |y(T)| / eps = "
          f"{np.round([r[2] / (e * free) for r, e in zip(rows, eps_list)], 8)}")

fig, (ax1, ax2) = P.panels(2, size=(4.6, 3.4))
ns = np.array(list(grams))
ax1.semilogy(ns, [abs(grams[n][0]) for n in ns], "o-", color=P.ORANGE,
             label=r"$|\lambda_{\min}(\mathcal{G}_T)|$ as computed")
ax1.semilogy(ns, [grams[n][1] for n in ns], "s-", color=P.BLUE, label=r"$\lambda_{\max}(\mathcal{G}_T)$")
ax1.axhline(np.finfo(float).eps * max(g[1] for g in grams.values()), color=P.INK, ls="--", lw=1,
            label=r"$\varepsilon_{\rm mach}\,\lambda_{\max}$")
P.label(ax1, "$N_x$")
for n_x, marker in zip(control_norms, "os^D"):
    ax2.semilogx(eps_list, control_norms[n_x], marker + "-", label=f"$N_x={n_x}$")
ax2.invert_xaxis()
P.label(ax2, r"tolerance $\varepsilon\,/\,|e^{T\Delta_h}y^0|$", r"$\|u_\varepsilon\|_{L^2(\omega\times(0,T))}$")
plt.show()
computed lambda_min, lambda_max of G_T: {6: ('7.4e-07', '2.3e-02'), 8: ('2.0e-08', '2.4e-02'), 10: ('5.3e-10', '2.2e-02'), 12: ('1.5e-11', '2.3e-02'), 14: ('3.9e-13', '2.1e-02'), 16: ('1.1e-14', '2.2e-02'), 20: ('8.4e-18', '2.2e-02'), 30: ('-1.0e-20', '2.2e-02'), 50: ('-1.1e-20', '2.2e-02')}
N_x =  20: ||u_eps|| = [1.2116 1.843  2.1789 2.3884];  attained |y(T)| / eps = [1. 1. 1. 1.]
N_x =  40: ||u_eps|| = [1.2003 1.8125 2.1262 2.3126];  attained |y(T)| / eps = [1. 1. 1. 1.]
N_x =  80: ||u_eps|| = [1.1979 1.8055 2.1142 2.2948];  attained |y(T)| / eps = [1. 1. 1. 1.]
N_x = 160: ||u_eps|| = [1.1975 1.8042 2.112  2.2913];  attained |y(T)| / eps = [1. 1. 1. 1.]

\(\lambda_{\max}\) hardly changes. Over the resolved range \(N_x\le16\) the computed \(\lambda_{\min}(\mathcal G_T)\) deteriorates extremely rapidly; from \(N_x\approx20\) on it reaches \(\varepsilon_{\rm mach}\lambda_{\max}\), can come out negative through rounding (hence the absolute value), and its apparent rate is not numerically trustworthy. A direct solve of \(\mathcal G_T\varphi_T=d\) is numerically unreliable: ill-conditioned in double precision for this discretization and resolution. This is consistent with \(c_{\rm term}=0\), but it is not a proof of the infinite-dimensional statements, proved or cited above. The \(\varepsilon\)-method only inverts \(\mathcal G_T+\mu I\) with \(\mu\) far above rounding level; each \(\varepsilon\) is below \(|e^{T\Delta_h}y^0|\), so the printed ratios \(|y(T)|/\varepsilon\) equal \(1\). On the right, \(\|u_\varepsilon\|\) grows as \(\varepsilon\to0\) but levels off, as the uniform bound \(2\sqrt C\|y^0\|\) predicts for a null-controllable system. In this experiment the values for \(N_x=20,\dots,160\) agree to within a few percent. That is an observation for this example, not a theorem: discrete observability constants bounded uniformly in \(h\) require a proof for each scheme, and we make no such claim.

Code and plot. The \(\varepsilon\)-controls for three horizons: where in time does the control act?

n_x = 80
profiles = {}
for T_ in (0.1, 0.5, 1.0):                             # the same eps-method for three horizons
    x, h, mu, V, w, K, d_hat = heat_setup(n_x, T_)
    free = np.sqrt(h) * np.linalg.norm(d_hat)
    phi_hat, u_norm, yT_norm = eps_null_control(K, d_hat, h, 1e-4 * free)
    t = np.linspace(0, T_, 401)
    U = np.array([w * (V @ (np.exp(-mu * (T_ - s)) * phi_hat)) for s in t])
    profiles[T_] = (t, np.sqrt(h) * np.linalg.norm(U, axis=1))
    print(f"T = {T_}: ||u|| = {u_norm:.4f}, |y(T)| = {yT_norm:.2e} (free evolution {free:.2e});  "
          f"||u(t)|| at t = T/10 and t = 0.9 T: {profiles[T_][1][40]:.3e}, {profiles[T_][1][360]:.3e}")
    if T_ == 0.5:
        U_show, t_show, phi_show = U, t, phi_hat

# controlled state for T = 0.5 by the exact variation-of-constants formula
x, h, mu, V, w, K, d_hat = heat_setup(n_x, 0.5)
M = V.T @ (w[:, None] * V)
S = mu[:, None] + mu[None, :]
y0_hat = V.T @ indicator(x, 0.6, 0.9)
Y = np.array([V @ (np.exp(-mu * s) * y0_hat
                   + (M * (-np.expm1(-S * s)) / S) @ (np.exp(-mu * (0.5 - s)) * phi_show))
              for s in t_show])
print(f"T = 0.5: |y(T)| recomputed from the state formula: {np.sqrt(h) * np.linalg.norm(Y[-1]):.2e}")

fig, axes = P.panels(3, size=(4.2, 3.5))
for T_, color in zip(profiles, (P.GREY, P.ORANGE, P.BLUE)):
    t, un = profiles[T_]
    axes[0].semilogy(t / T_, un / un.max(), color=color, label=f"$T={T_:g}$")
P.label(axes[0], "relative time $t/T$", r"$\|u(t)\|_{L^2(\omega)}$ / its maximum")
im1 = axes[1].pcolormesh(x, t_show, U_show, shading="auto", cmap="RdBu_r",
                         vmin=-np.abs(U_show).max(), vmax=np.abs(U_show).max())
P.label(axes[1], "$x$", "$t$", title=r"control $u(x,t)$ for $T=0.5$")
fig.colorbar(im1, ax=axes[1])
im2 = axes[2].pcolormesh(x, t_show, Y, shading="auto", cmap="viridis")
P.label(axes[2], "$x$", title="controlled state $y(x,t)$ for $T=0.5$")
fig.colorbar(im2, ax=axes[2])
plt.show()
T = 0.1: ||u|| = 2.2948, |y(T)| = 1.08e-05 (free evolution 1.08e-01);  ||u(t)|| at t = T/10 and t = 0.9 T: 9.161e+00, 3.554e+00
T = 0.5: ||u|| = 0.0262, |y(T)| = 2.08e-07 (free evolution 2.08e-03);  ||u(t)|| at t = T/10 and t = 0.9 T: 2.641e-03, 6.331e-02
T = 1.0: ||u|| = 0.0002, |y(T)| = 1.49e-09 (free evolution 1.49e-05);  ||u(t)|| at t = T/10 and t = 0.9 T: 2.239e-07, 5.246e-04
T = 0.5: |y(T)| recomputed from the state formula: 2.08e-07

For the short horizon \(T=0.1\), comparable with the diffusion time \(1/\lambda_1=1/\pi^2\approx0.1\), the control works during the whole interval and its size even decreases towards the end. For \(T=0.5\) and \(T=1\) the control is tiny at first, while the free heat flow does most of the work, and it grows by more than an order of magnitude towards \(t=T\). In all cases the control oscillates in space and time near \(t=T\): it is the backward heat equation seen from the final time, whose high frequencies are visible only there. The drop in the last instants is an effect of the regularization: the \(\varepsilon\)-term removes the highest frequencies of \(\varphi_T\), which the exact null control would contain. The printed terminal norms are \(10^{-4}\) times those of the free evolution.

5. Control ↔︎ ML

  • Adjoint and backpropagation. A direct connection, made precise in §2: forward pass = state, backward pass = adjoint, gradient = their combination. Its discrete-time version is Exercise 6.
  • The \(\varepsilon\)-functional. A mathematical analogy. Approximating a target to tolerance \(\varepsilon\) by elements of a dense but non-closed range, with costs that may explode as \(\varepsilon\to0\), resembles approximation by neural networks of bounded size. The structures are similar; the spaces and the costs differ.
  • Ill-conditioning. The severe ill-conditioning of \(\mathcal G_T\) (Laboratory 2) is a warning for every gradient method: on discretized PDEs, the number of iterations is governed by a condition number that grows with the resolution.

6. Details: existence for the density functional, and a finite-dimensional refinement

Optional.

Existence for \(J_\varepsilon\). \(J_\varepsilon\) is continuous and convex on a Hilbert space, so by the direct method it suffices to prove coercivity. We prove \[ \liminf_{\|v\|\to\infty}\frac{J_\varepsilon(v)}{\|v\|}\ge\varepsilon , \] which gives \(J_\varepsilon(v)\ge\tfrac\varepsilon2\|v\|\) for \(\|v\|\) large, hence coercivity.

Proof, by contradiction and subsequences. Write \(\hat v=v/\|v\|\), so that \[ \frac{J_\varepsilon(v)}{\|v\|}=\tfrac12\|v\|\,\|\mathcal L^*\hat v\|^2+\varepsilon-(f,\hat v). \] Suppose the claim fails. Then there are \(\delta>0\) and a sequence with \(\|v_j\|\to\infty\) and \(J_\varepsilon(v_j)/\|v_j\|\le\varepsilon-\delta\) for all \(j\). 1. Since \((f,\hat v_j)\le\|f\|\), the identity gives \(\tfrac12\|v_j\|\,\|\mathcal L^*\hat v_j\|^2\le\|f\|\), so \(\|\mathcal L^*\hat v_j\|\to0\). 2. The sequence \((\hat v_j)\) is bounded, so a subsequence converges weakly, \(\hat v_{j_k}\rightharpoonup\hat v\). A bounded linear operator maps weakly convergent sequences to weakly convergent ones, so \(\mathcal L^*\hat v_{j_k}\rightharpoonup\mathcal L^*\hat v\). By step 1 the same sequence tends to \(0\) in norm, hence \(\mathcal L^*\hat v=0\), and \(\hat v=0\) by injectivity. 3. Therefore \((f,\hat v_{j_k})\to0\), and the identity gives \(\liminf_kJ_\varepsilon(v_{j_k})/\|v_{j_k}\|\ge\varepsilon\), which contradicts \(J_\varepsilon(v_{j_k})/\|v_{j_k}\|\le\varepsilon-\delta\). \(\square\)

The argument applies to every unbounded sequence; no case distinction on the size of \(\|\mathcal L^*\hat v_j\|\) is needed.

Approximation with exact finite-dimensional projections. If \(E\subset H\) is finite-dimensional with orthogonal projection \(\pi_E\), then for every \(f\) and \(\varepsilon>0\) there is \(u\) with \(\|\mathcal Lu-f\|\le\varepsilon\) and \(\pi_ELu=\pi_Ef\). The proof minimizes \(J(v)=\tfrac12\|\mathcal L^*v\|^2+\varepsilon\|(I-\pi_E)v\|-(f,v)\) (Lions–Zuazua, 1997; stated here without proof). For control, this means reaching a target approximately while matching finitely many of its moments exactly.

The \(\varepsilon\)-algorithm as Tikhonov regularization with a discrepancy rule. The formula \(\tilde v=(\mathcal L\mathcal L^*+\mu I)^{-1}f\) is Tikhonov regularization. The non-squared penalty \(\varepsilon\|v\|\) selects the regularization parameter \(\mu\) automatically, by requiring the residual to be exactly \(\varepsilon\) (when \(\|f\|>\varepsilon\)). With the squared penalty \(\varepsilon\|v\|^2\), \(\mu\) is fixed in advance and the residual is not controlled directly (Exercise 4).

7. Moments, waves and the geometric control condition

Optional.

Moments and heat asymptotics. The asymptotic behaviour of solutions of the heat equation in \(\mathbb R^N\) is determined by the moments of the initial datum and the derivatives of the Gaussian profile. A function with vanishing mass can be written as a divergence, \(f=\operatorname{div}F\), with estimates on \(F\) that are dual to Hardy-type inequalities (Duoandikoetxea–Zuazua, 1992). These decompositions quantify how fast heat forgets its initial datum, the same smoothing that rules out exact controllability to arbitrary \(L^2\) targets, while approximate and null controllability hold.

Waves are different. Controls for the wave equation are oscillatory, whatever the length of the horizon, and they do not concentrate at \(t=T\). Information travels at finite speed along rays, so a control region \(\omega\) works only if every ray of geometric optics enters \(\omega\) within time \(T\): the Geometric Control Condition of Bardos–Lebeau–Rauch. When the GCC fails, only weaker properties hold. Discretization is also delicate: finite-difference schemes create spurious high-frequency waves that travel too slowly, and uniform observability can be lost as the mesh is refined (Zuazua, 2005). The commutation “discretize then control = control then discretize” fails there.

Open directions. Quantitative costs of null control as \(T\to0\) or as \(\omega\) shrinks; numerical schemes whose discrete observability constants are provably uniform in \(h\); control of nonlinear parabolic equations.

Key takeaways

  1. For \(J(b)=\tfrac12|x-x^*|^2+\tfrac12|b|^2\) with \(Ax=b\): \(\nabla J(b)=p+b\) with \(A^*p=x-x^*\). Two solves instead of \(N+1\), and the adjoint is the Lagrange multiplier of the state equation.
  2. The adjoint method is reverse-mode differentiation, the mechanism of backpropagation.
  3. Dense range ⟺ injective adjoint. Minimizing \(\tfrac12\|\mathcal L^*v\|^2+\varepsilon\|v\|-(f,v)\) gives \(u=\mathcal L^*\tilde v\) with \(\|\mathcal Lu-f\|\le\varepsilon\), but \(\|u\|\) may explode as \(\varepsilon\to0\).
  4. On a bounded connected domain with \(C^2\) boundary, the heat equation is null-controllable from any nonempty open \(\omega\) in any time \(T>0\) (cited). The minimal-norm control is \(u=\bar\varphi1_\omega\), from the HUM functional \(J_0\), minimized in the completion for the observation norm. In our longer-horizon examples it concentrates near \(t=T\), not in the shortest one.
  5. For the heat equation, unique continuation holds but \(c_{\rm term}=0\). Only the initial-form inequality (O) holds, and it gives controls bounded uniformly in \(\varepsilon\).
  6. Discrete heat Gramians are numerically singular already at modest resolution. Use regularized (\(\varepsilon\)) formulations, and do not read discrete numbers as infinite-dimensional theorems.

8. Exercises

★ conceptual · ★★ mathematical · ★★★ computational

  1. Deriving an adjoint. ★★ Let \(Ax=b\) as in §1, let \(C\in\mathbb R^{k\times N}\) observe the state, \(z\in\mathbb R^k\) be a desired observation and \(\beta>0\), and set \(J(b)=\tfrac12|Cx-z|^2+\tfrac\beta2|b|^2\). (a) Derive the adjoint equation and show that \(\nabla J(b)=p+\beta b\) with \(A^*p=C^*(Cx-z)\). (b) Recover the same equations from a Lagrangian, as in §2. (c) If \(M\) different costs \(J_1,\dots,J_M\) of the same state are needed, each with its gradient, how many solves do sensitivities, finite differences and the adjoint method need? When would you prefer sensitivities to adjoints?
  2. Checking a gradient. ★★ Implement the gradient of Exercise 1 for the convection–diffusion matrix of Laboratory 1 with \(N=100\), \(C\) the restriction to the nodes in \((0.4,0.6)\), \(z=1\) there, and \(\beta=0.1\). Check it with the directional test of Laboratory 1: plot the relative error of the forward difference quotient against \(h\), and explain the two regimes. Then introduce a deliberate error (for instance, use \(A\) instead of \(A^*\) in the adjoint solve) and describe how the test reveals it.
  3. Dense range in finite dimension. ★★ Let \(\mathcal L\in\mathbb R^{N\times N}\). (a) Prove that \((\operatorname{Range}\mathcal L)^\perp=\ker \mathcal L^\top\). (b) Deduce that \(\mathcal L\) is onto if and only if \(\mathcal L^\top\) is injective, and that in finite dimension “dense range” and “onto” coincide. (c) Show that in finite dimension injectivity of \(\mathcal L^\top\) implies \(\|\mathcal L^\top v\|\ge\alpha\|v\|\) for some \(\alpha>0\), and identify the best \(\alpha\). Which step fails in infinite dimension?
  4. Regularized HUM. ★★ Replace \(\varepsilon\|v\|\) by \(\varepsilon\|v\|^2\): \(\tilde J(v)=\tfrac12\|\mathcal L^*v\|^2+\varepsilon\|v\|^2-(f,v)\). (a) Show that \(\tilde J\) is coercive without any assumption on \(\mathcal L\), and find its minimizer. (b) Show that the residual \(\mathcal Lu-f\) of \(u=\mathcal L^*\tilde v\) equals \(-2\varepsilon\tilde v\). Does \(\|\mathcal Lu-f\|\le\varepsilon\) hold? (c) In the eigenbasis of \(\mathcal L\mathcal L^*\), with eigenvalues \(s_j^2\), compute the residual and show that it tends to \(0\) as \(\varepsilon\to0\) when \(\mathcal L^*\) is injective. Why can no rate be given in general?
  5. The discrete optimality system of heat control. ★★ For the semi-discrete heat equation \(y'=\Delta_hy+1_\omega u\), \(y(0)=y^0\), derive the optimality system of the problem “minimize \(\tfrac12\int_0^T\|u\|_h^2\,dt\) subject to \(y(T)=0\)” with a Lagrangian, as in §2. Show that the control is \(u=1_\omega\varphi\) with \(-\varphi'=\Delta_h\varphi\), and that \(\varphi_T\) solves \(\mathcal G_T\varphi_T=-e^{T\Delta_h}y^0\). Which property of \(\Delta_h\) makes the adjoint equation look like the state equation backward in time?
  6. A discrete adjoint: backpropagation through time. ★★★ Discretize the heat equation with explicit Euler, \(y_{k+1}=(I+\Delta t\,\Delta_h)y_k+\Delta t\,1_\omega u_k\) for \(k=0,\dots,K-1\), with \(N_x=20\), \(T=0.1\) and \(\Delta t\) satisfying the stability condition \(\Delta t\le h^2/2\). Take the cost \(\mathcal J(u_0,\dots,u_{K-1})=\tfrac12\|y_K\|_h^2+\tfrac\beta2\sum_k\Delta t\,\|u_k\|_h^2\) with \(\beta=10^{-3}\) and \(y^0=1_{(0.6,0.9)}\). (a) Derive the backward recursion for adjoint vectors \(p_k\) that gives all partial derivatives \(\partial\mathcal J/\partial u_k\) in one backward sweep. (b) Implement it, and check one directional derivative against a centred finite difference. (c) Run gradient descent and report \(\|y_K\|_h\).
# TODO: student exercise (Exercise 6)
# Write grad_discrete(u) returning (cost, gradient) for the explicit-Euler heat problem,
# using one forward sweep for y_k and one backward sweep for the adjoint vectors p_k.

def grad_discrete(u):
    ...  # your code here
    return None, 0

Where are we going?

In the optimality system of the minimal-norm heat control the adjoint appears isolated: the cost involves the control only, with a terminal constraint. This is related to the tendency of the control to act near \(t=T\), which our examples showed for the longer horizons. Notebook 08 adds a cost on the state itself. The optimality system then couples state and adjoint in both directions, and over long horizons optimal controls and trajectories spend most of the time near the solution of a steady optimal control problem: the turnpike property. The adjoint, the Lagrangian derivation of §2 and the duality between control and observation are its tools.

References

  1. J.-L. Lions, Exact controllability, stabilization and perturbations for distributed systems, SIAM Review 30 (1988), 1–68.
  2. A. V. Fursikov, O. Yu. Imanuvilov, Controllability of Evolution Equations, Lecture Notes Series 34, Seoul National University, 1996.
  3. G. Lebeau, L. Robbiano, Contrôle exact de l’équation de la chaleur, Communications in Partial Differential Equations 20 (1995), 335–356.
  4. C. Bardos, G. Lebeau, J. Rauch, Sharp sufficient conditions for the observation, control, and stabilization of waves from the boundary, SIAM Journal on Control and Optimization 30 (1992), 1024–1065.
  5. E. Zuazua, Propagation, observation, and control of waves approximated by finite difference methods, SIAM Review 47 (2005), 197–243.
  6. A. Griewank, A. Walther, Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation, 2nd ed., SIAM, 2008. (reverse-mode differentiation)