← Back to Home

Hearing Perturbation Theory

In numerical linear algebra, we create ways for a computer to solve a linear system of equations Ax=bA\vec{x} = \vec{b}. In doing so, we analyze how efficiently and accurately we can find the solution x\vec{x}.

Perturbation theory concerns how much error we incur in the solution x\vec{x} when we perturb (spoil) the data AA and b\vec{b}. A classic statement tells us that the amount of error depends on the condition number of the matrix AA.

I will define and prove the statement, and help you understand it by "hearing" it.

1. Problem statement

Let's consider the equation,

Axtrue=b,A\vec{x}_{true} = \vec{b},

where ARn×nA \in \mathbb{R}^{n \times n} is nonsingular and b0\vec{b} \neq \vec{0} (otherwise, we get the trivial case xtrue=0\vec{x}_{true} = \vec{0}). Note that xtrue\vec{x}_{true} denotes the true solution. It's what we hope to get.

Suppose, instead, we solve the perturbed system,

(A+δ ⁣A)x=b+δb.(A + \delta\!A)\vec{x} = \vec{b} + \vec{\delta b}.

We seek to find a bound on the error xxtrue\vec{x} - \vec{x}_{true}. We expect the error to be small when δ ⁣A\delta\!A and δb\vec{\delta b} are small changes.

Given an induced matrix norm ||\cdot||, we can define the condition number of AA:

κ(A):=AA1.\kappa(A) := ||A|| \cdot ||A^{-1}||.

Note that we always have κ(A)1\kappa(A) \geq 1. You can check why, along with the definition and properties of an induced matrix norm, in Notes.

We will show that, under a mild assumption κ(A)δ ⁣AA<1\displaystyle\kappa(A) \cdot \frac{||\delta\!A||}{||A||} < 1,

xxtruextrueκ(A)1κ(A)δ ⁣AA(δ ⁣AA+δbb).\boxed{\displaystyle\frac{||\vec{x} - \vec{x}_{true}||}{||\vec{x}_{true}||} \leq \frac{\kappa(A)}{1 - \kappa(A)\frac{||\delta\!A||}{||A||}} \,\cdot \left(\frac{||\delta\!A||}{||A||} + \frac{||\vec{\delta b}||}{||\vec{b}||}\right)}.

The RHS is a product of terms, so we can conclude two things. (1) If κ(A)\kappa(A) is a small number, then small relative errors in AA and b\vec{b} will result in a small relative error in the solution xtrue\vec{x}_{true}. (2) If κ(A)\kappa(A) is a large number, however, we may get a large relative error in xtrue\vec{x}_{true} even when the relative errors in AA and b\vec{b} are small.

We see that the condition number influences how much change occurs in the output when we change the input of a system. As a result, we say that the matrix AA is well-conditioned if κ(A)\kappa(A) is small, and ill-conditioned if κ(A)\kappa(A) is large.

2. Mathematical proof

a. Step 1

For any matrix XRn×nX \in \mathbb{R}^{n \times n} with X<1||X|| < 1, the following statements hold:

(i) IXI - X is nonsingular, and its inverse is given by

(IX)1=i=0Xi=I+X+X2+.\displaystyle(I - X)^{-1} = \sum_{i\,=\,0}^{\infty}\,X^{i} = I + X + X^{2} + \cdots.

(ii) (IX)111X\displaystyle||(I - X)^{-1}|| \leq \frac{1}{1 - ||X||}.

To prove (i), we check that (IX)(IX)1=I(I - X)(I - X)^{-1} = I and (IX)1(IX)=I(I - X)^{-1}(I - X) = I. We just need to check one of them because, in finite dimensions, injectivity and surjectivity occur together.

We see that,

(IX)(IX)1=(IX)(I+X+X2+)=(I+X+X2+)(X+X2+X3+)=I.\begin{aligned} (I - X)(I - X)^{-1} &= (I - X)(I + X + X^{2} + \cdots) \\ &= (I + X + X^{2} + \cdots) - (X + X^{2} + X^{3} + \cdots) \\ &= I. \end{aligned}

Note, to be rigorous, we would first show that the infinite series i=0Xi\sum_{i\,=\,0}^{\infty}\,X^{i} converges. The sequence of finite sums, {i=0kXi}k=0\left\{\sum_{i\,=\,0}^{k}\,X^{i}\right\}_{k\,=\,0}^{\infty}, is a Cauchy sequence in the norm ||\cdot||. Since Rn×n\mathbb{R}^{n \times n} is a Banach space, i.e. complete, the sequence converges.

Let's prove (ii). By triangle inequality and the properties of an induced matrix norm,

(IX)1=I+X+X2+I+X+X2+I+X+X2+.\begin{aligned} ||(I - X)^{-1}|| &= ||I + X + X^{2} + \cdots|| \\ &\leq ||I|| + ||X|| + ||X^{2}|| + \cdots \\ &\leq ||I|| + ||X|| + ||X||^{2} + \cdots. \end{aligned}

Next, we use the infinite geometric sum formula: For any real number r(1,1)r \in (-1,\,1),

i=0ri=11r.\displaystyle\sum_{i\,=\,0}^{\infty}\,r^{i} = \frac{1}{1 - r}.

Since X[0,1)||X|| \in [0,\,1), we conclude that,

(IX)111X.\displaystyle||(I - X)^{-1}|| \leq \frac{1}{1 - ||X||}.

b. Step 2

Recall that AA is nonsingular. Assume further that,

κ(A)δ ⁣AA<1.\displaystyle\kappa(A) \cdot \frac{||\delta\!A||}{||A||} < 1.

Then, A+δ ⁣AA + \delta\!A is also nonsingular.

Since AA is nonsingular, we can write A+δ ⁣AA + \delta\!A as a product of two terms:

A+δ ⁣A=A(I+A1δ ⁣A).A + \delta\!A = A(I + A^{-1}\delta\!A).

Hence, A+δ ⁣AA + \delta\!A is nonsingular, if and only if, I+A1δ ⁣AI + A^{-1}\delta\!A is nonsingular. Let's show that the latter is true by applying (i) from Step 1.

We find that,

A1δ ⁣AA1δ ⁣A=κ(A)δ ⁣AA<1.\displaystyle\begin{aligned} ||A^{-1}\delta\!A|| &\leq ||A^{-1}|| \cdot ||\delta\!A|| \\ &= \kappa(A)\frac{||\delta\!A||}{||A||} \\ &< 1. \end{aligned}

Hence, I+A1δ ⁣AI + A^{-1}\delta\!A is nonsingular.

Before we move on, let's read the statement in Step 2 again. It tells us that, if a matrix is nonsingular, then there are infinitely many matrices nearby that are nonsingular, too. (And infinitely many around them, and so on.) This supports the fact that there are far more nonsingular matrices than singular ones. Isn't that a marvel?

c. Step 3

Show that,

xxtruextrue(A+δ ⁣A)1(δ ⁣A+δbxtrue).\displaystyle \frac{||\vec{x} - \vec{x}_{true}||}{||\vec{x}_{true}||} \leq ||(A + \delta\!A)^{-1}|| \,\cdot \left(||\delta\!A|| + \frac{||\vec{\delta b}||}{||\vec{x}_{true}||}\right).

We're almost there! Recall the original problems:

Axtrue=b(A+δ ⁣A)x=b+δb.\begin{array}{rcl} A\vec{x}_{true} & = & \vec{b} \\ (A + \delta\!A)\vec{x} & = & \vec{b} + \vec{\delta b}. \end{array}

Subtract the two equations to get,

(A+δ ⁣A)xAxtrue=δb(A+δ ⁣A)(xxtrue)=δbδ ⁣Axtruexxtrue=(A+δ ⁣A)1(bδ ⁣Axtrue).\begin{array}{ll} & (A + \delta\!A)\vec{x} - A\vec{x}_{true} = \vec{\delta b} \\ \Rightarrow & (A + \delta\!A)(\vec{x} - \vec{x}_{true}) = \vec{\delta b} - \delta\!A\vec{x}_{true} \\ \Rightarrow & \vec{x} - \vec{x}_{true} = (A + \delta\!A)^{-1}(\vec{b} - \delta\!A\vec{x}_{true}). \end{array}

Take the vector norm to both sides:

xxtrue=(A+δ ⁣A)1(bδ ⁣Axtrue)(A+δ ⁣A)1bδ ⁣Axtrue(A+δ ⁣A)1(b+δ ⁣Axtrue).\begin{aligned} ||\vec{x} - \vec{x}_{true}|| &= ||(A + \delta\!A)^{-1}(\vec{b} - \delta\!A\vec{x}_{true})|| \\ &\leq ||(A + \delta\!A)^{-1}|| \cdot ||\vec{b} - \delta\!A\vec{x}_{true}|| \\ & \leq ||(A + \delta\!A)^{-1}|| \cdot \Bigl(||\vec{b}|| + ||\delta\!A|| \cdot ||\vec{x}_{true}||\Bigr). \end{aligned}

Finally, we divide both sides by xtrue(0)||\vec{x}_{true}||\,(\neq 0).

d. Step 4

Finally, prove that,

xxtruextrueκ(A)1κ(A)δ ⁣AA(δ ⁣AA+δbb).\displaystyle\frac{||\vec{x} - \vec{x}_{true}||}{||\vec{x}_{true}||} \leq \frac{\kappa(A)}{1 - \kappa(A)\frac{||\delta\!A||}{||A||}} \,\cdot \left(\frac{||\delta\!A||}{||A||} + \frac{||\vec{\delta b}||}{||\vec{b}||}\right).

Let's find an upper bound for (A+δ ⁣A)1||(A + \delta\!A)^{-1}|| in Step 3. We use (ii) from Step 1:

(A+δ ⁣A)1(I+A1δ ⁣A)1A1A11A1δ ⁣AA11κ(A)δ ⁣AA.\begin{aligned} ||(A + \delta\!A)^{-1}|| &\leq ||(I + A^{-1}\delta\!A)^{-1}|| \cdot ||A^{-1}|| \\ &\leq \frac{||A^{-1}||}{1 - ||A^{-1}\delta\!A||} \\ &\leq \frac{||A^{-1}||}{1 - \kappa(A)\frac{||\delta\!A||}{||A||}}. \end{aligned}

Hence,

xxtruextrueAA11κ(A)δ ⁣AA(δ ⁣AA+δbAxtrue)κ(A)1κ(A)δ ⁣AA(δ ⁣AA+δbb).\begin{aligned} \frac{||\vec{x} - \vec{x}_{true}||}{||\vec{x}_{true}||} &\leq \frac{||A|| \cdot ||A^{-1}||}{1 - \kappa(A)\frac{||\delta\!A||}{||A||}} \,\cdot \left(\frac{||\delta\!A||}{||A||} + \frac{||\vec{\delta b}||}{||A|| \cdot ||\vec{x}_{true}||}\right) \\ &\leq \frac{\kappa(A)}{1 - \kappa(A)\frac{||\delta\!A||}{||A||}} \,\cdot \left(\frac{||\delta\!A||}{||A||} + \frac{||\vec{\delta b}||}{||\vec{b}||}\right). \end{aligned}

3. Application

We can represent an audio as a vector xtrueRn\vec{x}_{true} \in \mathbb{R}^{n} of frequencies. The provided audio file, williams.wav, lends to n=189930n = 189930. At a sampling rate of 44100 Hz, the audio is 4.3068 seconds long.

For computational efficiency, we will write xtrue\vec{x}_{true} as a matrix XtrueR10×18993X_{true} \in \mathbb{R}^{10 \times 18993}, by storing the first 10 entries of xtrue\vec{x}_{true} as the first column of XtrueX_{true}, the next 10 entries as the second, and so on.

Next, we apply a nonsingular matrix AR10×10A \in \mathbb{R}^{10 \times 10} to XtrueX_{true} to get the encrypted audio BR10×18993B \in \mathbb{R}^{10 \times 18993}. We can always vectorize BB into bR189930\vec{b} \in \mathbb{R}^{189930} by reversing the storage process described above.

From now on, we assume that we only have AA and BB. We seek to decrypt the audio, i.e. solve the equation AXtrue=BAX_{true} = B, when there are perturbations in the matrix AA and/or in the input BB:

(A+δ ⁣A)X=(B+δ ⁣B).(A + \delta\!A)X = (B + \delta\!B).

a. Generating matrices

To generate a well-conditioned AA, we find the QR factorization of a random 10×1010 \times 10 matrix and set A=QA = Q. We know that the 2-norm of an orthogonal matrix is always 1. Hence,

κ2(Q)=Q2QT2=1.\kappa_{2}(Q) = ||Q||_{2} \cdot ||Q^{T}||_{2} = 1.

For an ill-conditioned AA, we use the Hilbert matrix HH:

H=[11219110121311011119110117118110111118119].H = \left[\begin{array}{ccccc} 1 & \frac{1}{2} & \cdots & \frac{1}{9} & \frac{1}{10} \\ \frac{1}{2} & \frac{1}{3} & \cdots & \frac{1}{10} & \frac{1}{11} \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ \frac{1}{9} & \frac{1}{10} & \cdots & \frac{1}{17} & \frac{1}{18} \\ \frac{1}{10} & \frac{1}{11} & \cdots & \frac{1}{18} & \frac{1}{19} \end{array}\right].

Then, κ2(H)1.6025×1013\kappa_{2}(H) \approx 1.6025 \times 10^{13}. Note that both QQ and HH are nonsingular.

b. Generating perturbations

The entries of perturbations δ ⁣A\delta\!A and δ ⁣B\delta\!B are randomly generated from a scaled normal distribution. For convenience, we will assume that A+δ ⁣AA + \delta\!A is (most likely) nonsingular because δ ⁣A\delta\!A is randomly chosen.

We are more interested in ensuring that the values of δ ⁣A2||\delta\!A||_{2} and δb2||\vec{\delta b}||_{2} stay about the same each time we run the program.

c. Simulations

We can run perturbation_theory.m under 6 different cases:

PerturbAonlyPerturbBonlyPerturbAandBWellconditionedA(1,1)(1,2)(1,3)IllconditionedA(2,1)(2,2)(2,3)\begin{array}{c|c|c|c} & Perturb A only & Perturb B only & Perturb A and B \\ \hline Well-conditioned A & (1,\,1) & (1,\,2) & (1,\,3) \\ \hline Ill-conditioned A & (2,\,1) & (2,\,2) & (2,\,3) \end{array}

The table lists the input parameters for each case.

First, let's consider what happens when AA is well-conditioned.

These plots show that the obtained solution x\vec{x} matches the true solution xtrue\vec{x}_{true} well. The fidelity of the obtained audios remains largely pristine. We do hear some added noise. In the 100 ms sample, the relative error stays around 2% (median) when we perturb only the matrix AA. When we perturb the encrypted audio BB, the relative error jumps to about 10%.

Download and listen to the obtained audios:

Next, let's consider what happens when AA is ill-conditioned.

This time, the obtained solution hardly matches the true solution. You can hear much more noise in the obtained audios, and listening to them becomes almost unbearable. The relative error is orders of magnitude larger. It's interesting how perturbing BB only results in a completely garbled audio, but perturbing AA in addition reconstructs some of the original audio. Two wrongs do make a right, it seems.

Download and listen to the obtained audios:

We can also check that our matrices satisfy the statement that we painstakingly proved. I will leave writing the extra code to you.

Notes

Given a vector norm ||\cdot|| for the vector space Rn\mathbb{R}^{n}, we can always create a matrix norm ||\cdot|| for the vector space Rn×n\mathbb{R}^{n \times n}. As a result, we call this an "induced" matrix norm. For simplicity, I use the double bar notation for both types of norms. It is clear from context whether we are looking at the vector norm or the induced matrix norm.

The induced matrix norm of ARn×nA \in \mathbb{R}^{n \times n} is defined as,

A:=maxx0Axx=maxx=1Ax.\displaystyle||A|| := \max\limits_{\vec{x}\,\neq\,\vec{0}}\,\frac{||A\vec{x}||}{||\vec{x}||} = \max\limits_{||\vec{x}||\,=\,1}\,||A\vec{x}||.

Hence, the induced matrix norm measures how far out we can map a vector relative to its original size. We can also generalize the definition to rectangular matrices.

Because of its definition, the induced matrix norm satisfies these useful properties:

(i) For any ARn×nA \in \mathbb{R}^{n \times n} and xRn\vec{x} \in \mathbb{R}^{n},

AxAx.||A\vec{x}|| \leq ||A|| \cdot ||\vec{x}||.

(ii) For any A,BRn×nA,\,B \in \mathbb{R}^{n \times n},

ABAB.||AB|| \leq ||A|| \cdot ||B||.

In particular, property (ii) implies that the condition number of a nonsingular matrix is always at least 1.

AA1=IAA1=1AA11.AA^{-1} = I \,\,\Rightarrow\,\, ||AA^{-1}|| = 1 \,\,\Rightarrow\,\, ||A|| \cdot ||A^{-1}|| \geq 1.

You can find the code and audio files in their entirety here: Download from GitHub