IB Numerical Analysis

Polynomial interpolation open_in_new

Denote $\mathcal{P}_n$ as the set of all real polynomials of degree at most $n$.

Polynomial interpolation problem

Given a continuous function $f: [a,b]\to \R$ and distinct nodes $x_0, x_1, \ldots, x_n \in [a,b]$, find a polynomial $p\in \mathcal{P}_n$ such that $p(x_i) = f(x_i)$ for $i=0,1,\ldots,n$.

Theorem (interpolation theorem) open_in_new

The solution to a polynomial interpolation problem exists and is unique.

Proof

Definition (nodal polynomial) open_in_new

For a polynomial interpolation problem, the nodal polynomial is defined as $$ \begin{align*} ω(x) = \prod_{i=0}^{n} (x-x_i) \in \mathcal{P}_{n+1}. \end{align*} $$

  • The roots of $ω$ is precisely $x_0, \ldots, x_n$.

  • $ω'(x_i) = \prod_{j\neq i} (x_i-x_j)$.

Lagrange interpolating polynomial open_in_new

For a polynomial interpolation problem, define the Lagrange fundamental polynomials, for $i=0,1,\ldots,n$, $$ \begin{align*} l_i(x) = \prod_{j\neq i} \frac{x-x_j}{x_i-x_j} = \frac{ω(x)}{ω'(x_i)\,(x-x_i)}\in \mathcal{P}_n \end{align*} $$ which satisfies $l_i(x_j) = δ_{ij}$.

Then a solution to the problem is $$ \begin{align*} p(x) = \sum_{i=0}^{n} f(x_i)\,l_i(x) = \sum_{i=0}^{n} \frac{f(x_i)}{ω'(x_i)} \frac{ω(x)}{x-x_i}. \end{align*} $$

However this is very unstable in numerical evaluation.

Newton interpolating polynomial open_in_new

Definition (divided difference) open_in_new

In a polynomial interpolation problem, the divided difference of $f$ of order $k$ is the leading coefficient of the polynomial $p_k\in \mathcal{P}_k$ that interpolates $f$ on $x_0, \ldots, x_k$.

  • $f[x_0] = f(x_0)$.

  • By the Lagrange form, $$ \begin{align*} f[x_0, \ldots, x_n] = \sum_{i=0}^{n} \frac{f(x_i)}{ω'(x_i)}. \end{align*} $$

Theorem (Newton interpolating polynomial) open_in_new

For a polynomial interpolation problem, the interpolating polynomial is given by $$ \begin{align*} p_n(x) = \sum_{k=0}^{n} f[x_0, \ldots, x_k] \prod_{i=0}^{k-1} (x-x_i) \end{align*} $$ where $f[x_0, \ldots, x_k]$ is the divided difference.

Proof

Theorem (recurrence relation of divided difference) open_in_new

The divided differences satisfy the recurrence relation $$ \begin{align*} f[x_0, x_1, \ldots, x_{k-1}, x_k] = \frac{f[x_1, \ldots, x_{k-1}, x_k] - f[x_0, x_1, \ldots, x_{k-1}]}{x_k - x_0}. \end{align*} $$

Proof

Example (Newton interpolating polynomial)

Error bounds for polynomial interpolation open_in_new

Theorem (polynomial interpolation error) open_in_new

Suppose $f\in C^{n+1}[a,b]$ in a polynomial interpolation problem.

The interpolating polynomial $p\in \mathcal{P}_n$ has interpolation error $$ \begin{align*} f(x) - p(x) = f[x_0, \ldots, x_n, x]\, ω(x) = \frac{1}{(n+1)!} \, ω(x) \,f^{(n+1)}(ξ) \end{align*} $$ for some $ξ\in [a,b]$.

Proof

  • This gives a bound of the maximal error $$ \begin{align*} \|f-p\|_{\infty} \leq \frac{1}{(n+1)!} \|ω\|_\infty \|f^{(n+1)}\|_\infty \end{align*} $$ where $\|g\|_\infty = \max_{x\in [a,b]} |g(x)|$ is the $L^\infty$ norm. We want to use nodes $x_0, \ldots, x_n$ so that $\|ω\|_\infty$ is minimised.

Definition (Chebyshev polynomial) open_in_new

The Chebyshev polynomial $T_n$ on $[-1,1]$ is defined as $$ \begin{align*} T_n(x) = \cos(n\cos\inv x), \qquad x\in [-1,1]. \end{align*} $$

  • Trigonometric identity implies the recurrence relation $$ \begin{align*} T_0 ={}& 1, \\ T_1 ={}& x, \\ T_{n+1}(x) ={}& 2x\, T_n(x) - T_{n-1}(x) \end{align*} $$ so $T_n$ are indeed polynomials.

  • The highest degree term in $T_n$ is $2^{n-1} x^n$.

Theorem (Chebyshev polynomial has minimum L-inf norm) open_in_new

Among all monic polynomials $\mathcal{P}_n$, the Chebyshev polynomial $γT_{n}$ has the smallest $L^\infty$ norm $$ \begin{align*} \inf_{a_i} \max_{x\in [-1,1]} |x^n + a_{n-1} x^{n+1} + \ldots + a_0| = \|γT_n\| = γ \end{align*} $$ where $γ = 1/2^{n-1}$.

Proof

Corollary (optimality of Chebyshev nodes) open_in_new

Among all choices of interpolating nodes $Δ = (x_i)_{i=0}^n$, the Chebyshev nodes $Δ^\ast = (x_i^\ast)_{i=0}^n$ where $$ \begin{align*} x_i^\ast = \cos \biggl(\frac{2i+1}{2n+2}π\biggr) \end{align*} $$ give the best estimate for interpolation error, i.e. $$ \begin{align*} \inf_{Δ} \|ω_Δ\|_\infty = \|ω_{Δ^\ast}\|_\infty = \frac{1}{2^n} \end{align*} $$ and so $$ \begin{align*} \|f-p_{Δ^\ast}\|_\infty \leq \frac{1}{2^n} \frac{1}{(n+1)!} \|f^{n+1}\|_\infty. \end{align*} $$

Proof

Orthogonal polynomials open_in_new

Definition (weighted inner product) open_in_new

In the vector space $V$ of continuous functions $f: [a,b]\to \C$, we can equip $V$ with an inner product $$ \begin{align*} \langle f,g\rangle_w = \int_{a}^{b} f(x)\overline{g(x)} w(x) \d x \end{align*} $$ where $w: (a,b)\to \R_{>0}$, the weight function, is such that $\int_{a}^{b} w(x) \d x$ exists.

We can also define the norm $$ \begin{align*} \|f\|_w = \sqrt{\langle f,f\rangle_w}. \end{align*} $$

Definition (orthogonal polynomial) open_in_new

Given a weighted inner product, a polynomial $Q_n \in \mathcal{P}_n$ is said to be the $n$-th orthogonal polynomial if $$ \begin{align*} \langle Q_n, p\rangle = 0 \qquad \text{for all }p\in \mathcal{P}_{n-1}. \end{align*} $$

Lemma (unique monic orthogonal polynomial) open_in_new

Given a weighted inner product, for each $n\geq 0$, there exists a unique monic orthogonal polynomial $Q_n\in \mathcal{P}_n$.

Furthermore, any $p\in \mathcal{P}_n$ can be written uniquely as the linear combination $$ \begin{align*} p = \sum_{k=0}^{n} \frac{\langle p, Q_k\rangle}{\|Q_k\|^2}Q_k. \end{align*} $$

Proof

Theorem (recurrence relation of monic orthogonal polynomial) open_in_new

Given a weighted inner product, the monic orthogonal polynomials satisfy $$ \begin{align*} Q_{-1}(x) ={}& 0, \\ Q_0(x) ={}& 1, \\ Q_{n+1}(x) ={}& (x-a_n) \, Q_n(x) - b_n \,Q_{n-1}(x) \end{align*} $$ where $$ \begin{align*} a_n = \frac{\langle xQ_n,Q_n\rangle}{\langle Q_n, Q_n\rangle}, \qquad b_n = \frac{\langle Q_n, Q_n\rangle}{\langle Q_{n-1}, Q_{n-1}\rangle} > 0. \end{align*} $$

Proof

Lemma (roots of orthogonal polynomials) open_in_new

Given a weighted inner product, an $n$-th orthogonal polynomial has $n$ distinct simple roots in $(a,b)$.

Proof

Least square polynomial fitting open_in_new
Least square polynomial fitting problem

Given $f\in C[a,b]$ and a weight function $w(x)\geq 0$, find the (weighted) least square approximant $$ \begin{align*} p^\ast = \arg \min_{p\in \mathcal{P}_n} \|f-p\|_{w} \end{align*} $$ where $$ \begin{align*} \|f-p\|_w = \left(\int_{a}^{b} |f-g|^2 w \d x\right)^{1/2}. \end{align*} $$

Theorem (least square approximant) open_in_new

For a least square polynomial fitting problem, let $(Q_k)_{k=0}^n$ be the orthogonal polynomials.

Then the least square approximant is given by $$ \begin{align*} p^\ast = \sum_{k=0}^{n} \frac{\langle f,Q_k\rangle}{\|Q_k\|^2} Q_k \in \mathcal{P}_n \end{align*} $$ with error $$ \begin{align*} \|f-p^\ast\|^2 = \|f\|^2 - \|p^\ast\|^2 = \|f\|^2 - \sum_{k=0}^{n} \frac{\langle f,Q_k\rangle^2}{\|Q_k\|^2}. \end{align*} $$

Proof

Theorem (Parseval's identity for orthogonal polynomials) open_in_new

Given a weighted inner product with $[a,b]$ finite, let $(Q_k)_{k=0}^n$ be the orthogonal polynomials.

Then for any $f\in C[a,b]$, $$ \begin{align*} \sum_{k=0}^{\infty} \frac{\langle f,Q_k\rangle^2}{\|Q_k\|^2} = \|f\|^2. \end{align*} $$

Proof

  • To find a polynomial $p$ such that $\|f-p\|\leq ε$, compute the partial sums $\sum_{k=0}^{N} \frac{\langle f,Q_k\rangle^2}{\|Q_k\|^2}$ until it is at least $\|f\|^2 - ε^2$.

Approximation of linear functionals open_in_new
Approximation of linear functionals

Given a linear functional $λ: C^{n+1}[a,b] \to \R$, find an approximation of the form $$ \begin{align*} λ(f) = \sum_{i=0}^{N} a_i f(x_i). \end{align*} $$ $a_i$ are called weights, $x_i$ are called nodes, and this expression is called a quadrature formula.

Definition (exact formula) open_in_new

Consider a linear functional $λ: C^{n+1}[a,b]\to\R$ and an approximation $λ(f) \approx \sum_{i=0}^{N} a_if(x_i)$.

We say the formula is exact on $\mathcal{P}_n$ if equality holds when $f\in \mathcal{P}_n$.

If $N<n$, we say it is of high accuracy.

Lemma (exact on Pn iff interpolating formula) open_in_new

Consider a linear functional $λ: C^{n+1}[a,b]\to\R$ and an approximation $λ(f) \approx \sum_{i=0}^{N} a_if(x_i)$.

If $N=n$, the formula is exact on $\mathcal{P}_n$ iff it is the interpolating formula $$ \begin{align*} a_i = λ(l_i) \end{align*} $$ where $l_0, \ldots, l_n$ are the fundamental Lagrange polynomials.

Proof

Numerical integration open_in_new
Numerical integration

Given a weight function $w(x)\geq 0$, seek an approximation $$ \begin{align*} I(f) := \int_{a}^{b} f(x) \,w(x) \d x \approx \sum_{i=0}^n a_i f(x_i), \qquad f\in C[a,b]. \end{align*} $$

Lemma (no quadrature rule exact on P_{2n+2} for numerical integration) open_in_new

No quadrature rule with $(n+1)$ nodes is exact on $\mathcal{P}_{2n+2}$ for numerical integration.

Proof

Theorem (Gaussian quadrature) open_in_new

Let a quadrature $\int_{a}^{b} f(x)ω(x) \d x \approx \sum_{i=0}^{n} a_i f(x_i)$ for numerical integration be exact on $\mathcal{P}_{n}$ (i.e. the interpolating formula).

Then it is exact on $\mathcal{P}_{2n+1}$ iff $x_0, \ldots, x_n$ are the $(n+1)$ distinct roots of an $n$-th orthogonal polynomial with respect to the inner product $\langle f,g\rangle = \int_{a}^{b} a(x)b(x)ω(x) \d x$.

Such a quadrature is called a Gaussian quadrature.

Proof

Composite quadrature formula open_in_new

Suppose we want to estimate $\int_{a}^{b} f(x)ω(x) \d x \approx \sum_{i=0}^{n} a_i f(x_i)$ with accuracy $ε\ll 1$.

We could choose a Gaussian quadrature of high order, but computing roots of orthogonal polynomials is difficult.

Instead, split into many sub-intervals, and apply a simple quadrature on each sub-interval.

One can show that if a quadrature exact on $\mathcal{P}_n$ is applied with step size $h$, the total error is $O(h^{n+1})$ for $f\in C^{n+1}[a,b]$.

Numerical differentiation open_in_new
Numerical differentiation

Seek an approximation $$ \begin{align*} I(f) := f^{(k)}(x) \approx \sum_{i=0}^{n} a_i f(x_i). \end{align*} $$

The interpolating formula is $$ \begin{align*} f^{(k)} \approx k! \,f[x_0, \ldots, x_k] \end{align*} $$ using the divided difference of a polynomial.

Theorem (Peano kernel theorem) open_in_new

Consider a linear functional $λ: C^{(n+1)}[a,b]\to \R$.

If $λ$ vanishes on $\mathcal{P}_n$ and we can exchange $λ$ and $\int_{a}^{b}$, then $$ \begin{align*} λ(f) = \frac{1}{n!} \int_{a}^{b} K_{λ}(t) f^{(n+1)}(t) \d t \end{align*} $$ where $K_λ$ is the Peano kernel $$ \begin{align*} K_λ(t) = λ(x\mapsto (x-t)_+^{n}), \qquad (x-t)_+ = \max\set{x-t, 0}. \end{align*} $$

Proof

  • If an approximation formula $λ(f) \approx \sum_{i=0}^{N} a_i f(x_i)$ is exact on $\mathcal{P}_n$, then the error $e_λ := λ(f) - \sum_{i=0}^{N} a_i f(x_i)$ vanishes on $\mathcal{P}_n$, so the theorem applies.

  • We have an estimate $$ \begin{align*} |λ(f)| \leq \frac{1}{n!} \|K_{λ}\|_1 \cdot \|f^{(n+1)}\|_{\infty} \equiv \frac{1}{n!} \int_{a}^{b} |K_λ(t)| \d t \cdot \max_{t\in [a,b]}|f^{(n+1)}|. \end{align*} $$ which is sharp, i.e. for all $ε>0$, there exists $f$ such that $\mathrm{RHS} - \mathrm{LHS} < ε$. (Derivation)

Numerical methods for ODEs open_in_new
Initial value problem

Given $f: \R\times \R^d \to \R^d$ and $\v y_0\in \R^d$, consider an initial value problem $$ \begin{align*} \v y' ={}& \v f(t, \v y), \quad 0\leq t\leq T, \\ \v y(0) ={}& \v y_0. \end{align*} $$

For a certain step size $h>0$, seek an approximation $\v y_{n} \approx \v y(t_n)$ where $t_n = nh$.

Definition (convergent method) open_in_new

Suppose given a step size $h>0$, a numerical method generates $(\v y_n^{(h)})_{n=0}^N$ where $N = \lfloor T/h\rfloor$.

We say the method is convergent if $$ \begin{align*} \max_{n} \|\v y_n^{(h)} - \v y(t_n)\| \to 0 \qquad \text{as }h\to 0. \end{align*} $$

Definition (local truncation error, order of method) open_in_new

The local truncation error of a numerical method is the error of the method assuming we have obtained the true solution previously: for a method $\v y_{n+1} = \v ϕ(t_n, \v y_0, \ldots, \v y_n)$, the local truncation error is $$ \begin{align*} \v η_{n+1} = \v y(t_{n+1}) - \v ϕ(t_n, \v y(t_{0}), \ldots, \v y(t_n)). \end{align*} $$

We say the method has order $p$ if $\v η_{n+1} = O(h^{p+1})$ where $h$ is the step size.

One-step methods open_in_new

Euler's method open_in_new
Euler method

For an initial value problem, $$ \begin{align*} \v y_{n+1} = \v y_n + h \v f(t_n, \v y_n). \end{align*} $$

Theorem (convergence of the Euler method) open_in_new

For an initial value problem, suppose

  • $\v y''$ is bounded on $[0,T]$; and

  • $\v f$ is Lipschitz in $\v y$, i.e. $\|\v f(t,\v x) - \v f(t, \v y)\| \leq λ\|\v x - \v y\|$ for all $0\leq t\leq T$ and $\v x,\v y\in \R^d$.

Then the Euler method has order 1 and is convergent, with global error $\v e_n := \v y(t_n) - \v y_n = O(h)$.

Proof

Theta methods open_in_new
Theta methods

For an initial value problem and some $θ\in [0,1]$, $$ \begin{align*} \v y_{n+1} = \v y_n + h\bigl(θ\,\v f(t_n, \v y_n) + (1-θ)\, \v f(t_{n+1}, \v y_{n+1})\bigr). \end{align*} $$

$θ$

Name

Scheme

$1$

Euler method

$\v y_{n+1} = \v y_n + h\, \v f(t_n ,\v y_n)$

explicit

$1/2$

Trapezoidal rule

$\v y_{n+1} = \v y_n + \frac{1}{2}h\bigl(\v f(t_n ,\v y_n) + \v f(t_{n+1}, \v y_{n+1})\bigr)$

implicit

$0$

Backward Euler

$\v y_{n+1} = \v y_n + h\, \v f(t_{n+1}, \v y_{n+1})$

implicit

For $θ\in [0,1)$, the method is implicit: we need to solve an equation for $\v y_{n+1}$ (by e.g. fixed point iteration, Newton-Raphson, modified Newton-Raphson etc).

Proposition (order of theta methods) open_in_new

A theta method has order

  • 2 if $θ=1/2$ (the trapezoidal rule); or

  • 1 otherwise.

Proof

Multistep methods open_in_new
Multistep method

For an initial value problem, an $s$-step method use $\v y_n, \v y_{n+1}, \ldots, \v y_{n+s-1}$ to find $\v y_{n+s}$ by $$ \begin{align*} \sum_{m=0}^{s} a_m \v y_{n+m} = h\sum_{m=0}^{s} b_m \v f_{n+m} \end{align*} $$ where $\v f_{n+m} = \v f(t_{n+m}, \v y_{n+m})$.

  • We say it is homogeneous if it satisfies the normalisation condition $a_s = 1$.

  • It is explicit if $b_s = 0$, and implicit otherwise.

Define the polynomials $$ \begin{align*} ρ(w) = \sum_{m=0}^{s} a_m w^m, \qquad σ(w) = \sum_{m=0}^{s} b_m w^m. \end{align*} $$

Theorem (order of multistep method) open_in_new

The following are equivalent conditions for a multistep method to have order $p\geq 1$:

  1. its coefficients satisfy $$ \begin{align*} \sum_{m=0}^{s} a_m ={}& 0, \\ \sum_{m=0}^{s} m^k a_m ={}& k \sum_{m=0}^{s} m^{k-1} b_m, \qquad \forall k=1,2,\ldots,p; \end{align*} $$

  2. it is exact on $\mathcal{P}_p$: $$ \begin{align*} \sum_{m=0}^{s} a_m Q(t_{n+m}) = h\sum_{m=0}^{s} b_m Q'(t_{n+m}) \qquad \forall Q\in \mathcal{P}_p; \end{align*} $$

  3. the associated polynomials satisfy $$ \begin{align*} ρ(e^{z}) - zσ(e^{z}) = O(z^{p+1}), \qquad \text{as } z\to 0 \end{align*} $$ or equivalently (with the substitution $w=e^z$ and noting $\log w = O(|w-1|)$) $$ \begin{align*} \frac{ρ(w)}{\log w} = σ(w) + O(|w-1|^{p}), \qquad \text{as }w\to 1. \end{align*} $$

Proof

Theorem (Dahlquist equivalence theorem) open_in_new

A multistep method is convergent iff

  • it is of order $p\geq 1$; and

  • the polynomial $ρ$ satisfies the root condition, i.e. all complex roots of $ρ$ lie in $|z|\leq 1$ and all roots with modulus 1 are simple.

Constructing multistep methods with maximum order open_in_new

To construct an $s$-step method, we can take some $ρ\in \mathcal{P}_s$ such that $ρ(1) = 0$ and $ρ$ satisfies the root condition. Then we can determine $σ$ by expanding $$ \begin{align*} \frac{ρ(w)}{\log w} = σ(w) + O(|w-1|^p). \end{align*} $$

  • For an implicit method, we allow $σ\in \mathcal{P}_s$, so we obtain an order of $p=s+1$.

  • For an explicit method, we allow $σ\in \mathcal{P}_{s-1}$, so we obtain an order of $p=s$.

Adams methods open_in_new

The choice $ρ(w)$ $= w^s - w^{s-1} = w^{s-1}(w-1)$ corresponds to Adams methods.

  • Adams-Bashforth methods are explicit, and has order $p=s$.

  • Adams-Moulton methods are implicit, and has order $p=s+1$.

Proposition (coefficients of Adams methods as integrals of polynomials) open_in_new

The coefficients $b_m$ in an $s$-step Adams method are given by $$ \begin{align*} b_m = \int_{s-1}^{s} l_m(t) \d t \end{align*} $$ where $l_m(t) = ω(t)/(t-m)ω'(m)$ are the Lagrange fundamental polynomials:

  • for an Adams-Bashforth (explicit) method, the nodes are $0,1,\ldots,s$, i.e. $ω(t) = \prod_{m=0}^{s} (t-m)$;

  • for an Adams-Moulton (implicit) method, the nodes are $0,1,\ldots,s-1$, i.e. $ω(t) = \prod_{m=0}^{s-1} (t-m)$.

Proof

Example (2-step Adams methods)

Backward differentiation formula open_in_new

We can construct an implicit $s$-step, $s$-order method by taking $σ(w)$ $= b_s w^s$ and normalising $b_s = 1$.

Proposition (coefficients of the backward differentiation formula) open_in_new

In the $s$-step backward differentiation formula, the coefficients are given by $$ \begin{align*} ρ(w) ={}& \sum_{k=1}^{s} \frac{1}{k}w^{s-k} (w-1)^k \in \mathcal{P}_s, \\ \end{align*} $$ or equivalently $$ \begin{align*} a_s ={}& \sum_{k=1}^{s} \frac{1}{k}, \\ a_m ={}& \frac{(-1)^{s-m}}{s-m}\pmat{s \\ m}. \end{align*} $$

Derivation

Higher order multistep methods open_in_new

(Non-examinable)

There are no $s$-step method of order $2s+1$ (derivation), but there exists unique implicit method of order $2s$ and explicit method of order $2s-1$.

However:

Theorem (first Dahlquist barrier) open_in_new

If an $s$-step method is convergent (i.e. the root condition is satisfied), then

  • $p\leq s$ for an explicit method (achieved by Adams-Bashforth);

  • $p\leq s+1$ for an implicit method when $s$ is odd (achieved by Adams-Moulton);

  • $p\leq s+2$ for an implicit method when $s$ is even (achieved by $ρ(w) = w^s - 1$).

Runge-Kutta methods open_in_new
Runge-Kutta methods

For an initial value problem, an $s$-stage explicit Runge-Kutta method has the form $$ \begin{align*} \v k_1 ={}& \v f(t_n, \v y_n), && c_1 = 0\\ \v k_2 ={}& \v f(t_n + c_2 h, \v y_n + h(a_{21} \v k_1)), &&c_2 = a_{21} \\ \v k_3 ={}& \v f(t_n + c_3 h, \v y_n + h(a_{31} \v k_1 + a_{32} \v k_2)), &&c_3 = a_{31} + a_{32} \\ \vdots \\ \v k_s ={}& \v f\Bigl(t_n + c_s h, \v y_n + h \sum_{j=1}^{s-1} a_{sj} \v k_j\Bigr), && c_s = \sum_{j=1}^{s-1} a_{sj} \\ \v y_{n+1} ={}& \v y_n + h \sum_{i=1}^{s} b_i \v k_i, && 1 = \sum_{i=1}^{s} b_i. \end{align*} $$

A general Runge-Kutta method is $$ \begin{align*} \v k_i ={}& \v f(t_n + c_ih, \v y_n + h\sum_{j=1}^{s} a_{ij} \v k_j), &&c_i = \sum_{j=1}^{s} a_{ij}, &&i=1,2,\ldots,s, \\ \v y_{n+1} ={}& \v y_n + h \sum_{i=1}^{s} b_i \v k_i, &&1 = \sum_{i=1}^{s} b_i. \end{align*} $$ which is explicit if $a_{ij} \leq 0$ for all $i\leq j$ and implicit otherwise.

Motivation of Runge-Kutta methods

Example (order of explicit two-stage Runge-Kutta)

Example (order of implicit two-stage Runge-Kutta)

Theorem (collocation at zeros of orthogonal polynomial) open_in_new

Suppose $\prod_{i=1}^{s} (t-c_i)$ is orthogonal on the interval $[0,1]$ to all polynomials of degree $r-1\leq s-1$. Let $l_i$ be the fundamental Lagrange polynomials of degree $s-1$ for the knots $c_i$, and $$ \begin{align*} a_{ij} = \int_{0}^{c_i} l_j(t) \d t, \qquad b_i = \int_{0}^{1} l_i(t) \d t. \end{align*} $$ Then the (highly implicit) $s$-stage Runge-Kutta method with these parameters is of order $s+r$.

  • The highest order of an $s$-stage implicit Runge-Kutta method (known as the Guass-Legendre Runge-Kutta method) is $2s$, corresponding to the collocation at zeros of the Legendre polynomial.

Stiff ODEs open_in_new

An ODE is said to be stiff if we have to depress the step size $h$ for stability well beyond the need of accuracy.

Example (stiff ODE)

Definition (linear stability domain, A-stable) open_in_new

Suppose a numerical method applied to $y' = λy, y(0)=1$ produces $(y_n^{(h)})_n$. The linear stability domain is $$ \begin{align*} \mathcal{D} = \sb{λh \in \C}{y_n^{(h)}\to 0 \text{ as }n\to \infty}. \end{align*} $$

We say the method is $A$-stable if the left-half plane $\C^- = \sb{z\in \C}{\Re z < 0} \subseteq D$.

Example (linear stability domain of theta methods)

Stability of multistep methods open_in_new

The linear stability domain of a multistep method $\sum_{m=0}^{s} a_m \v y_{n+m} = h \sum_{m=0}^{s} b_m \v f_{n+m}$ contains $z = λh$ iff the solution to the recurrence equation $$ \begin{align*} \sum_{m=0}^{s} a_m y_{n+m} = z \sum_{m=0}^{s} b_m y_{n+m} \end{align*} $$ tends to 0 as $n\to \infty$. This is equivalent to the polynomial $$ \begin{align*} p_z(x) := ρ(x) - z\,σ(x) = \sum_{m=0}^{s} a_m x^m - z \sum_{m=0}^{s} b_mx^m \end{align*} $$ having the moduli of all roots $<1$.

Tricks to finding the linear stability domain:

  • $z\in \partial D$ iff $p_z(x) = 0$ for some $|x|=1$. So if we write $x=e^{it}$ ($t\in \R$), then $$ \begin{align*} z(t) = \frac{ρ(e^{it})}{σ(e^{it})}, \end{align*} $$ defines the curve $\partial D$.

  • If we're looking for the real stability interval $I = \mathcal{D}\cap \R$, the boundary is given by $p_{z_1}(1) = 0 \iff z_1 = ρ(1)/σ(1)$ and $p_{z_2}(-1) = 0 \iff z_2 = ρ(-1)/σ(-1)$. Moreover if the method has order $\geq 1$, then $ρ(1) = 0$, so it is highly likely that $$ \begin{align*} I = \Bigl(\frac{ρ(-1)}{σ(-1)}, 0\Bigr). \end{align*} $$

Example (finding real stability interval)

Theorem (second Dahlquist barrier) open_in_new

No multistep method of order $p\geq 3$ can be $A$-stable.

Still, some high-order multistep methods are of good use, e.g. BDF methods of order $\leq 6$ have a wedge about $(-\infty, 0)$. We say these are $A_0$-stable.

Stability of Runge-Kutta methods open_in_new

Lemma (no explicit Runge-Kutta method can be A-stable) open_in_new

However, implicit Runge-Kutta methods may be $A$-stable. (Example)

Numerical implementation of methods for ODEs open_in_new

Milne device open_in_new

For multistep methods, we use a pair of methods of the same order $p$:

  • the predictor: explicit, lower computational cost; and

  • the corrector: implicit, higher accuracy.

The predictor provides a good initial guess in the solution of the implicit corrector equations, and allows for error estimation:

If the local truncation errors are $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^{\text{P}} ={}& c_{\text{P}} h^{p+1} \v y^{(p+1)}(t_n) + O(h^{p+2}), \\ \v y(t_{n+1}) - \v y_{n+1}^{\text{C}} ={}& c_{\text{C}} h^{p+1} \v y^{(p+1)}(t_n) + O(h^{p+2}), \end{align*} $$ then we estimate the error as $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^\text{C} \approx -\frac{c_{\text{C}}}{c_\text{P} - c_\text{C}}(\v y_{n+1}^\text{P} - \v y_{n+1}^{\text{C}}). \end{align*} $$

Embedded Runge-Kutta method open_in_new

Runge-Kutta methods do not have a single error constant.

Instead we use two (typically explicit) Runge-Kutta methods:

  1. one of $s$ stages and order $p$; and

  2. one of $s+l$ stages and order $p+1$,

with the first $s$ stages identical to reduce computational cost. Then we have an estimate of the lower order method $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1}^{[1]}\approx \v y_{n+1}^{[2]} - \v y_{n+1}^{[1]}. \end{align*} $$

For example $$ \begin{align*} k_1 ={}& f(t_n, y_n), \\ k_2 ={}& f(t_n + \frac{1}{2}h, y_n + \frac{1}{2}hk_1), \\ k_3 ={}& f(t_n + h, y_n - hk_1 + 2hk_2), \\ y_{n+1}^{[1]} ={}& y_n + hk_2, \\ y_{n+1}^{[2]} ={}& y_n + \frac{1}{6}h(k_1 + 4k_2 + k_3). \end{align*} $$ $y_{n+1}^{[1]}$ has order $2$ accuracy, and $y_{n+1}^{[2]}$ has order $3$ accuracy.

Zadunaisky device open_in_new

Suppose the ODE $\v y'(t) = \v f(t, \v y)$ is solved by an arbitrary numerical method of order $p$, and we have stored some past values $\v y_n, \v y_{n-1}, \ldots, \v y_{n-p}$.

Let $\v q\in \mathcal{P}_p$ be a polynomial that interpolates $\v q(t_i) = \v y_i$ for $i=n,\ldots,n-p$. Then $\v q(t) - \v y(t) = O(h^{p+1})$. Note $\v q$ solves a new ODE $$ \begin{align*} \v z' = \v f(t,\v z) + \underbrace{\v q' - \v f(t, \v q)}_{\text{small}}, \tag{*} \end{align*} $$ which slightly differs from our original ODE by a term $\v q' - \v y'$ which we expect to be small.

Now apply the same method to produce $\v z_{n+1}$. The Zadunaisky device estimates the local truncation error of $\v y_{n+1}$ as $$ \begin{align*} \v y(t_{n+1}) - \v y_{n+1} \approx \v q(t_{n+1}) - \v z_{n+1}. \end{align*} $$

Numerical linear algebra open_in_new

LU factorisation open_in_new
LU factorisation

For a square matrix $A\in \R^{n\times n}$ non-singular, find $L$ and $U$ so that $$ \begin{align*} A = LU \end{align*} $$ where

  • $L\in \R^{n\times n}$ is lower unitriangular (i.e. $l_{ij} = 0$ for $i<j$ and $l_{ii}=1$ for all $i$); and

  • $U\in \R^{n\times n}$ is upper triangular (i.e. $u_{ij} = 0$ for $i>j$) and non-singular ($u_{ii}\neq 0$ for all $i$).

Direct approach of LU factorisation open_in_new

Let $\v l_k$ be the columns of $L$ and $\v u_k^T$ be the rows of $U$. By matrix multiplication, $$ \begin{align*} A = \sum_{k=1}^{n} \v l_k \v u_k^T. \end{align*} $$

Let $A^{(0)} = A$.

  1. Take $\v u_1^T=$ first row of $A^{(0)}$ and $\v l_1 = \frac{1}{A_{11}^{(0)}}\times$ first column of $A^{(0)}$. Then $$ \begin{align*} A^{(1)} := A^{(0)} - \v l_1 \v u_1^T = \pmat{0 & 0 & \ldots & 0 \\ 0 & * & \ldots & * \\ \vdots & \vdots & \ddots & \vdots \\ 0 & * & \ldots & * }. \end{align*} $$

  2. Take $\v u_2^T=$ second row of $A^{(1)}$ and $\v l_2 = \frac{1}{A_{22}^{(1)}}\times$ second column of $A^{(1)}$. Then $$ \begin{align*} A^{(2)} := A^{(1)} - \v l_2 \v u_2^T = \pmat{0 & 0 & 0 & \ldots & 0 \\ 0 & 0 & 0 & \ldots & 0 \\ 0 & 0 & * & \ldots & * \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & * & \ldots & * }. \end{align*} $$

And so on.

This takes $O(n^3)$ computations. With a better algorithm, we can get $O(n^{\log_2 7}) \approx O(n^{2.8})$.

Example (direct approach of LU factorisation)

Column pivoting in LU factorisation open_in_new

The LU algorithm fails if $A_{kk}^{(k-1)} = 0$. To avoid this and to improve numerical stability, we exchange rows so that the element of largest magnitude in column $k$ is at the pivotal position $(k,k)$. This pre-multiplies a permutation matrix.

We obtain a factorisation $$ \begin{align*} PA = LU \implies A = P^T LU \end{align*} $$ where $P$ is the product of all permutation matrices multiplied.

Example (column pivoting in LU factorisation)

Applications of LU factorisation open_in_new
  1. Solving linear systems: to solve $A\v x = \v b$ where $A$ is non-singular and square, factorise $A=LU$ (in $O(n^3)$ time), solve $L\v y = \v b$ by forward substitution (in $O(n^2)$ time) and solve $U\v x = \v y$ by backward substitution (in $O(n^2)$ time).

    This is better than Gaussian elimination ($O(n^3)$ time) if we need to solve $A\v x=\v b$ for the same $A$ but many different $\v b$.

  2. Finding determinant of $A$: $\det A = \det L \det U = 1\cdot \prod_{i=1}^{n} u_{ii}$.

  3. Inverting $A$: solve $A\v a\inv_k = \v e_k$ for each $k$.

Definition (strictly regular matrix) open_in_new

A square matrix $A\in \R^{n\times n}$ is said to be strictly regular if all its principal minors (top left blocks of $A$, i.e. $A_1 = \pmat{a_{11}}, A_2 = \pmat{a_{11} & a_{12} \\ a_{21} & a_{22}}, \ldots, A_n = A$) are non-singular.

Theorem (existence of LU factorisation) open_in_new

A square matrix $A\in \R^{n\times n}$ admits an LU factorisation iff $A$ is strictly regular.

Proof

  • Every non-singular matrix $A$ admits an LU factorisation with pivoting, i.e. $PA = LU$ for some permutation matrix.

Theorem (uniqueness of LU factorisation) open_in_new

LU factorisation is unique, i.e. if $L_1U_1=L_2U_2$ are two LU factorisations ($L_i$ lower unitriangular, $U_i$ non-singular and upper triangular), then $L_1=L_2$ and $U_1=U_2$.

Proof

Corollary (LDU factorisation) open_in_new

$A\in \R^{n\times n}$ is strictly regular iff it admits a factorisation $A = LDU$, where $L$ is lower unitriangular, $D$ is non-singular and diagonal, and $U$ is upper unitriangular.

Moreover the factorisation is unique.

Proof

Corollary (LDLT factorisation) open_in_new

$A\in \R^{n\times n}$ is strictly regular and symmetric iff it admits a factorisation $A = LDL^T$ where $L$ is lower unitriangular and $D$ is non-singular and diagonal.

Moreover the factorisation is unique.

Proof

Symmetric positive definite matrices in LU factorisation open_in_new

Theorem (LDLT factorisation of SPD matrix) open_in_new

$A\in \R^{n\times n}$ is symmetric positive definite iff it admits a factorisation $A=LDL^T$ where $L$ is lower unitriangular and $D$ is diagonal with positive entries.

Moreover the factorisation is unique.

Proof

Corollary (Cholesky factorisation) open_in_new

$A\in \R^{n\times n}$ is symmetric positive definite iff it admits a factorisation $A = LL^T$ where $L$ is lower triangular with a positive diagonal.

Moreover the factorisation is unique.

Proof

Strictly diagonally dominant matrices in LU factorisation open_in_new

Definition (strictly diagonally dominant) open_in_new

A square matrix $A\in \R^{n\times n}$ is said to be strictly diagonally dominant (by rows) if $$ \begin{align*} |a_{ii}| > \sum_{\substack{j=1 \\j\neq i}}^n |a_{ij}| \qquad \forall \text{row }i=1,\ldots,n. \end{align*} $$

Theorem (SDD is strictly regular) open_in_new

If $A\in \R^{n\times n}$ is strictly diagonally dominant, then $A$ is strictly regular.

Proof

Theorem (Gershgorin circle theorem) open_in_new

For an $n\times n$ matrix $A$, for each row $i$ define $$ R_i = \sum_{j\neq i} |A_{ij}| $$ and define a disk $D_i(A_{ii}, R_i)\subset\C$ to be the circle with centre $A_{ii}$ and radius $R_i$.

Then every eigenvalues lie within a disk $D_i$ for some $i$.

Proof

Sparse matrices and LU factorisation open_in_new

A matrix is said to be sparse if most entries are zero. By contrast, a matrix with most entries non-zero is called dense.

Definition (band matrix) open_in_new

A square matrix $A$ is a band matrix with bandwidth $2r+1$ if $a_{ij} = 0$ for $|i-j|>r$.

Proposition (LU factorisation preserves leading zeros) open_in_new

Let $A=LU$ be the LU factorisation of a sparse matrix $A$. Then

  • all leading zeros in the rows of $A$ to the left of the diagonal are inherited by $L$; and

  • all leading zeros in the columns of $A$ above the diagonal are inherited by $U$.

Proof

  • If $A$ is a band matrix, then $L$ and $U$ are also band matrices with the same bandwidth as $A$.

  • Sometimes if $A$ is sparse, we can try reordering its rows and columns to have more leading zeros, thus reducing the fill-in in $L$ and $U$.

The LU algorithm takes $O(nr^2)$ operations to factorise for a banded $A$ with bandwidth $r$. And to solve a linear system after factorisation, it takes $O(nr)$ operations.

QR factorisation open_in_new
QR factorisation

For any (rectangular) matrix $A \in \R^{m\times n}$, find $Q,R$ such that $$ \begin{align*} A = QR \end{align*} $$ where

  • $Q\in \R^{m\times m}$ is orthogonal (i.e. $Q^TQ = I$); and

  • $R\in \R^{m\times n}$ is upper triangular (i.e. $r_{ij} = 0$ for $i>j$).

If $m>n$, the bottom $m-n$ rows of $R$ are zero, so we can write $Q\in \R^{m\times n}$ and $R^{n\times n}$ instead. This is the reduced QR factorisation.

Theorem (existence and uniqueness of QR factorisation) open_in_new

Any matrix $A$ has a QR factorisation.

If $A$ is square and non-singular, then $A$ admits a unique factorisation $A = QR$ with $R$ having a positive diagonal.

Proof of existence: see Gram-Schmidt, Givens rotations, or Householder reflections.

Proof of uniqueness

QR factorisation using the Gram-Schmidt process open_in_new

Let $\v a_1, \ldots, \v a_n\in \R^m$ be the columns of $A$. By performing the Gram-Schmidt process on $\v a_1, \ldots, \v a_n$, we find an orthonormal set $\v q_1, \ldots, \v q_k \in \R^m$ ($k\leq n$) and coefficients $r_{ij}\in \R$ such that $$ \begin{align*} \v a_i = \sum_{j=1}^{i} r_{ji} \v q_j. \end{align*} $$ Then $$ \begin{align*} A = \underbrace{\pmat{\v q_1 & \ldots & \v q_k}}_{Q} \underbrace{\pmat{r_{11} & r_{12} & \ldots & r_{1k} & \ldots & r_{1n} \\ & r_{22} & \ldots & r_{2k} & \ldots & r_{2n} \\ &&\ddots & \vdots & & \vdots\\ &&&r_{kk} & \ldots & r_{kn}}}_{R}. \end{align*} $$

Example (QR factorisation using the Gram-Schmidt process)

However Gram-Schmidt is very numerically unstable.

Givens rotations open_in_new

For any vector $\v a\in \R^m$, the Givens rotation matrix $Ω^{[p,q]}\in \R^{m\times m}$ is an orthogonal transformation that makes the $q$-th component zero and preserves all components other than the $p$ and $q$-th ones: $$ \begin{align*} \underbrace{\pmat{1\\&\ddots\\&&\frac{a_p}{\sqrt{a_p^2+a_q^2}} && \frac{a_q}{\sqrt{a_p^2+a_q^2}} \\ &&&\ddots \\&&-\frac{a_q}{\sqrt{a_p^2+a_q^2}}&&\frac{a_p}{\sqrt{a_p^2+a_q^2}} \\ &&&&&\ddots \\ &&&&&&1}}_{Ω^{[p,q]}} \underbrace{\pmat{a_{1} \\ \vdots \\ a_p \\ \vdots \\ a_q \\ \vdots \\ a_m}}_{\v a} = \pmat{a_1 \\ \vdots \\ a_p^2 + a_q^2 \\ \vdots \\ 0 \\ \vdots \\a_m} \end{align*} $$

Applying $Ω^{[p,q]}$ to a matrix $A$, all rows other than rows $p$ and $q$ are unchanged, one entry in row $p$ is killed, and the span of rows $p$ and $q$ is preserved.

Thus after at most $mn$ Givens rotations, we can annihilate all subdiagonal elements: $$ \begin{align*} \pmat{*&*&*\\ *&*&* \\ *&*&* \\ *&*&*} &\xrightarrow{Ω^{[1,2]}} \pmat{\bullet &\bullet&\bullet\\ 0 &\bullet&\bullet \\ *&*&* \\ *&*&*} \xrightarrow{Ω^{[1,3]}} \pmat{\bullet &\bullet&\bullet\\ 0 &*&* \\ 0&\bullet&\bullet \\ *&*&*} \xrightarrow{Ω^{[1,4]}} \pmat{\bullet &\bullet&\bullet\\ 0 &*&* \\ 0&*&* \\ 0&\bullet&\bullet} \\ &\xrightarrow{Ω^{[2,3]}} \pmat{*&*&* \\ 0 &\bullet&\bullet \\ 0&0&\bullet \\ 0&*&*} \xrightarrow{Ω^{[2,4]}} \pmat{*&*&* \\ 0 &\bullet&\bullet \\ 0&0&* \\ 0&0&\bullet} \\ &\xrightarrow{Ω^{[3,4]}} \pmat{*&*&* \\ 0 &*&* \\ 0&0&\bullet \\ 0&0&0} \\ \end{align*} $$ (Legend: $*$ remains the same as the previous matrix; $\bullet$ has changed through a rotation.)

Therefore $$ \begin{align*} & R = (Ω^{[m-1,m]})\cdot (Ω^{[m-2,m]} Ω^{[m-2, m-1]}) \cdot \ldots \cdot (Ω^{[1,m]} \ldots Ω^{[1,3]} Ω^{[1,2]}) \cdot A \\ \implies & A = \underbrace{\Bigl[(Ω^{[m-1,m]})\cdot (Ω^{[m-2,m]} Ω^{[m-2, m-1]}) \cdot \ldots \cdot (Ω^{[1,m]} \ldots Ω^{[1,3]} Ω^{[1,2]})\Bigr]^T}_{Q} R. \end{align*} $$

Example (QR factorisation using Givens rotations)

Cost:

  • Computing $R$: $O(mn\cdot n)$.

  • Computing an explicit form of $Q$ (usually not necessary): perform all the Given rotations on $I_m$. This gives an extra cost of $O(mn\cdot m)$.

  • Computing $Q^T \v b$: $O(mn)$.

Householder reflections open_in_new

Definition (Householder reflection) open_in_new

Given a non-zero vector $\v u\in \R^m$, the $m\times m$ matrix $$ \begin{align*} H_\v u = I - \frac{2}{\|\v u\|^2} \v u \v u^T \end{align*} $$ is called a Householder transformation or reflection.

  • $H_\v u$ reflects a vector about the $(m-1)$-dimensional hyperplane normal to $\v u$. (Derivation)

  • $H_{\v u}$ is orthogonal.

  • If $\|\v a\|=\|\v b\|$, then $H_{\v a - \v b}(\v a) = \v b$.

Given any vector $\v a = (a_1, \ldots, a_{k-1}, a_k, a_{k+1}, \ldots, a_m)\in \R^m$, we can get $\v b = (a_1, \ldots, a_{k-1}, γ, 0, \ldots, 0)\in \R^m$ where $γ = \pm\sqrt{a_k^2 + a_{k+1}^2 + \ldots + a_m^2}$ by applying the Householder reflection for $\v u = \v a - \v b = (0,\ldots,0, a_k - γ, a_{k+1}, \ldots, a_m)$. Note that $H_u$ has the block matrix form $$ \begin{align*} H_\v u = \pmat{I_{k-1} & 0 \\ 0 & *} \end{align*} $$ so the first $k-1$ components are preserved under $H_\v u$.

Therefore we can kill off all subdiagonal entires of a matrix this way: $$ \begin{align*} \pmat{*&*&* \\ *&*&* \\ *&*&* \\ *&*&*} \xrightarrow{H_1} \pmat{\bullet&\bullet&\bullet \\ 0&\bullet&\bullet \\ 0&\bullet&\bullet \\ 0&\bullet&\bullet} \xrightarrow{H_2} \pmat{*&*&* \\ 0&\bullet&\bullet \\ 0&0&\bullet \\ 0&0&\bullet} \xrightarrow{H_3} \pmat{*&*&* \\ 0&*&* \\ 0&0&\bullet \\ 0&0&0} \end{align*} $$ (Legend: $*$ remains the same as the previous matrix; $\bullet$ has changed through a rotation.)

Hence $$ \begin{align*} R = H_m\ldots H_2 H_1 A \implies A = \underbrace{(H_m \ldots H_2H_1)^T}_{Q} R. \end{align*} $$

Example (QR factorisation using Householder reflections)

Practicality:

  • Numerically, don't compute the matrix of $H_\v u$! Always perform vector products $\v v - \frac{2}{\|u\|^2}\v u \v u^T \v v$ instead.

  • How to choose the sign of $γ$?

    • For hand computation, choose $\sign γ = \sign a_k$ to make numbers smaller.

    • For numerical computation, choose $\sign γ = -\sign a_k$ to make numbers larger for stability.

Choosing between Givens and Householder transformations:

  • If $A$ is dense, Householder is more convenient.

  • If $A$ is sparse, use Givens to rotate away the non-zero entries.

Linear least squares open_in_new
Least squares problem

Given $A \in \R^{m\times n}$ and $\v y\in \R^m$, find $\v c$ that minimises $\|A\v c - \v y\|^2$.

For $m>n$, usually the system $A\v c = \v y$ is overdetermined and there is no solution. We try to find an approximate one.

Application: least square estimator in IB Statistics.

Theorem (normal equations) open_in_new

$\v c^\ast\in \R^m$ is the solution to the least squares problem iff it solves the normal equations $$ \begin{align*} A^TA\v c^\ast = A^T \v y. \end{align*} $$ $A^TA$ is called the Gram matrix, and $\v c^\ast$ is the normal solution.

Moreover if $A$ has full rank, then $\v c^\ast = (A^T A)\inv A^T \v y$ is unique.

Proof

  • This is not suitable for numerical computation:

    1. $A^TA$ may become numerically singular;

    2. $A^TA$ can be dense even when $A$ is sparse;

    3. computing $A^TA$ may lead to a loss of accuracy.

QR factorisation and least squares open_in_new

To solve a least squares problem, let $A=QR$ be the QR factorisation of $A$, and assume $A$ has full rank $n$.

Since orthogonal transformations are length-preserving, $$ \begin{align*} \|A\v c - \v y\| = \|Q^T(A\v c - \v y)\| = \|R\v c - Q^T \v y\| \end{align*} $$ Let $Q^T \v y = \v z$. The form of $R\v c - Q^T \v y$ looks like $$ \begin{align*} \pmat{* & * & \ldots & * \\ &* & \ldots & * \\ &&\ddots & \vdots \\ &&&* \\ 0 & 0 & \ldots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \ldots & 0} \pmat{c_1 \\ c_2 \\ \vdots \\ c_n} - \pmat{z_1 \\ z_2 \\ \vdots \\ z_{n} \\ z_{n+1} \\ \vdots \\ z_{m}}. \end{align*} $$ We see that the best $\v c$ we can pick is by solving the non-singular linear system corresponding to the first $n$ equations (using back substitution).

Example (least squares using QR factorisation)