Skip to main content

Section 30 Using the Singular Value Decomposition

Subsection Application: Global Positioning System

You are probably familiar with the Global Positioning System (GPS). The system allows anyone with the appropriate software to accurately determine their location at any time. The applications are almost endless, including getting real-time driving directions while in your car, guiding missiles, and providing distances on golf courses.

The GPS is a worldwide radio-navigation system owned by the US government and operated by the US Air Force. GPS is one of four global navigation satellite systems. At least twenty four GPS satellites orbit the Earth at an altitude of approximately 11,000 nautical miles. The satellites are placed so that at any time at least four of them can be accessed by a GPS receiver. Each satellite carries an atomic clock to relay a time stamp along with its position in space. There are five ground stations to coordinate and ensure that the system is working properly.

The system works by triangulation, but there is also error involved in the measurements that go into determining position. Later in this section we will see how the method of least squares can be used to determine the receiver's position.

Subsection Introduction

A singular value decomposition has many applications, and in this section we discuss how a singular value decomposition can be used in image compression, to determine how sensitive a matrix can be to rounding errors in the process of row reduction, and to solve least squares problems.

Subsection Image Compression

The digital age has brought many new opportunities for the collection, analysis, and dissemination of information. Along with these opportunities come new difficulties as well. All of this digital information must be stored in some way and be retrievable in an efficient manner. A singular value decomposition of digitally stored information can be used to compress the information or clean up corrupted information. In this section we will see how a singular value decomposition can be used in image compression. While a singular value decomposition is normally used with very large matrices, we will restrict ourselves to small examples so that we can more clearly see how a singular value decomposition is applied.

Preview Activity 30.1.

Let \(A = \frac{1}{4}\left[ \begin{array}{ccrr} 67\amp 29\amp -31\amp -73 \\ 29\amp 67\amp -73\amp -31 \\ 31\amp 73\amp -67\amp -29 \\ 73\amp 31\amp -29\amp -67 \end{array} \right]\text{.}\) A singular value decomposition for \(A\) is \(U \Sigma V^{\tr}\text{,}\) where

\begin{align*} U \amp = [\vu_1 \ \vu_2 \ \vu_3 \ \vu_4] = \frac{1}{2} \left[ \begin{array}{crrr} 1\amp -1\amp 1\amp -1\\ 1\amp 1\amp 1\amp 1\\ 1\amp 1\amp -1\amp -1\\ 1\amp -1\amp -1\amp 1 \end{array} \right],\\ \Sigma \amp = \left[ \begin{array}{cccc} 50\amp 0\amp 0\amp 0\\ 0\amp 20\amp 0\amp 0\\ 0\amp 0\amp 2\amp 0\\ 0\amp 0\amp 0\amp 1 \end{array} \right],\\ V \amp = [\vv_1 \ \vv_2 \ \vv_3 \ \vv_4] = \frac{1}{2} \left[ \begin{array}{rrrr} 1\amp 1\amp -1\amp 1\\ 1\amp -1\amp -1\amp -1\\ -1\amp 1\amp -1\amp -1\\ -1\amp -1\amp -1\amp 1 \end{array} \right]\text{.} \end{align*}
(a)

Write the summands in the corresponding outer product decomposition of \(A\text{.}\)

(b)

The outer product decomposition of \(A\) writes \(A\) as a sum of rank 1 matrices (the summands \(\sigma_i \vu_i \vv_i^{\tr})\text{.}\) Each summand contains some information about the matrix \(A\text{.}\) Since \(\sigma_1\) is the largest of the singular values, it is reasonable to expect that the summand \(A_1 = \sigma_1 \vu_1 \vv_1^{\tr}\) contains the most information about \(A\) among all of the summands. To get a measure of how much information \(A_1\) contains of \(A\text{,}\) we can think of \(A\) as simply a long vector in \(\R^{mn}\) where we have folded the data into a rectangular array (we will see later why taking the norm as the norm of the vector in \(\R^{nm}\) makes sense, but for now, just use this definition). If we are interested in determining the error in approximating an image by a compressed image, it makes sense to use the standard norm in \(\R^{mn}\) to determine length and distance, which is really just the Frobenius norm that comes from the Frobenius inner product defined by

\begin{equation} \langle U,V \rangle = \sum u_{ij}v_{ij}\text{,}\tag{30.1} \end{equation}

where \(U = [u_{ij}]\) and \(V = [v_{ij}]\) are \(m \times n\) matrices. (That (30.1) defines an inner product on the set of all \(n \times n\) matrices is left to discuss in a later section.) So in this section all the norms for matrices will refer to the Frobenius norm. Rather than computing the distance between \(A_1\) and \(A\) to measure the error, we are more interested in the relative error

\begin{equation*} \frac{||A-A_1||}{||A||}\text{.} \end{equation*}
(i)

Calculate the relative error in approximating \(A\) by \(A_1\text{.}\) What does this tell us about how much information \(A_1\) contains about \(A\text{?}\)

(ii)

Let \(A_2 = \sum_{k=1}^2 \sigma_k \vu_k \vv_k^{\tr}\text{.}\) Calculate the relative error in approximating \(A\) by \(A_2\text{.}\) What does this tell us about how much information \(A_2\) contains about \(A\text{?}\)

(iii)

Let \(A_3 = \sum_{k=1}^3 \sigma_k \vu_k \vv_k^{\tr}\text{.}\) Calculate the relative error in approximating \(A\) by \(A_3\text{.}\) What does this tell us about how much information \(A_3\) contains about \(A\text{?}\)

(iv)

Let \(A_4 = \sum_{k=1}^4 \sigma_k \vu_k \vv_k^{\tr}\text{.}\) Calculate the relative error in approximating \(A\) by \(A_4\text{.}\) What does this tell us about how much information \(A_4\) contains about \(A\text{?}\) Why?

The first step in compressing an image is to digitize the image. There are many ways to do this and we will consider one of the simplest ways and only work with gray-scale images, with the scale from 0 (black) to 255 (white). A digital image can be created by taking a small grid of squares (called pixels) and coloring each pixel with some shade of gray. The resolution of this grid is a measure of how many pixels are used per square inch. As an example, consider the 16 by 16 pixel picture of a flower shown in Figure 30.1.

Figure 30.1. A 16 by 16 pixel image

To store this image pixel by pixel would require \(16 \times 16 = 256\) units of storage space (1 for each pixel). If we let \(M\) be the matrix whose \(i,j\)th entry is the scale of the \(i,j\)th pixel, then \(M\) is the matrix

\begin{equation*} \tiny{ \left[ \begin{array}{cccccccccccccccc} 240\amp 240\amp 240\amp 240\amp 130\amp 130\amp 240\amp 130\amp 130\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\\ 240\amp 240\amp 240\amp 130\amp 175\amp 175\amp 130\amp 175\amp 175\amp 130\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240 \\ 240\amp 240\amp 130\amp 130\amp 175\amp 175\amp 130\amp 175\amp 175\amp 130\amp 130\amp 240\amp 240\amp 240\amp 240\amp 240\\ 240\amp 130\amp 175\amp 175\amp 130\amp 175\amp 175\amp 175\amp 130\amp 175\amp 175\amp 130\amp 240\amp 240\amp 240\amp 240\\ 240\amp 240\amp 130\amp 175\amp 175\amp 130\amp 175\amp 130\amp 175\amp 175\amp 130\amp 240\amp 240\amp 240\amp 240\amp 240\\ 255\amp 240\amp 240\amp 130\amp 130\amp 175\amp 175\amp 175\amp 130\amp 130\amp 240\amp 240\amp 225\amp 240\amp 240\amp 240 \\ 240\amp 240\amp 130\amp 175\amp 175\amp 130\amp 130\amp 130\amp 175\amp 175\amp 130\amp 240\amp 225\amp 255\amp 240\amp 240\\ 240\amp 240\amp 130\amp 175\amp 130\amp 240\amp 130\amp 240\amp 130\amp 175\amp 130\amp 240\amp 255\amp 255\amp 255\amp 240\\ 240\amp 240\amp 240\amp 130\amp 240\amp 240\amp 75\amp 240\amp 240\amp 130\amp 240\amp 255\amp 255\amp 255\amp 255\amp 255\\ 240 \amp 240\amp 240\amp 240\amp 240\amp 240\amp 75\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240 \\ 240\amp 240\amp 240\amp 75\amp 75\amp 240\amp 75\amp 240\amp 75\amp 75\amp 240\amp 240\amp 240\amp 240\amp 240\amp 240\\ 50\amp 240\amp 240\amp 240\amp 75\amp 240\amp 75\amp 240\amp 75\amp 240\amp 240\amp 240\amp 240\amp 50\amp 240\amp 240\\ 240\amp 75\amp 240\amp 240\amp 240\amp 75\amp 75\amp 75 \amp 240\amp 240\amp 50\amp 240\amp 50\amp 240\amp 240\amp 50\\ 240\amp 240\amp 75\amp 240\amp 240\amp 240\amp 75\amp 240\amp 240\amp 50\amp 240\amp 50\amp 240\amp 240\amp 50\amp 240\\ 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\\ 75\amp 75\amp 75\amp 75 \amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75\amp 75 \end{array} \right]}\text{.} \end{equation*}

Recall that if \(U \Sigma V^{\tr}\) is a singular value decomposition for \(M\text{,}\) then we can also write \(M\) in the form

\begin{equation*} M=\sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{16} \vu_{16}\vv_{16}^{\tr}\text{.} \end{equation*}

given in (29.2). For this \(M\text{,}\) the singular values are approximately

\begin{equation} \left[ \begin{array}{c} 3006.770088367795 \\ 439.13109000200205 \\ 382.1756550649652 \\ 312.1181752764884 \\ 254.45105800344953 \\ 203.36470770057494 \\ 152.8696215072527 \\ 101.29084240890717 \\ 63.80803769229468 \\ 39.6189181773536 \\ 17.091891798245463 \\ 12.304589419140656 \\ 4.729898943556077 \\ 2.828719409809012 \\ 6.94442317024232 \times 10^{-15} \\2.19689952047833 \times 10^{-15} \end{array} \right]\text{.}\tag{30.2} \end{equation}

Notice that some of these singular values are very small compared to others. As in Preview Activity 30.1, the terms with the largest singular values contain most of the information about the matrix. Thus, we shouldn't lose much information if we eliminate the small singular values. In this particular example, the last 4 singular values are significantly smaller than the rest. If we let

\begin{equation*} M_{12} = \sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{12} \vu_{12}\vv_{12}^{\tr}\text{,} \end{equation*}

then we should expect the image determined by \(M_{12}\) to be close to the image made by \(M\text{.}\) The two images are presented side by side in Figure 30.2.

Figure 30.2. A 16 by 16 pixel image and a compressed image using a singular value decomposition.

This small example illustrates the general idea. Suppose we had a satellite image that was \(1000 \times 1000\) pixels and we let \(M\) represent this image. If we have a singular value decomposition of this image \(M\text{,}\) say

\begin{equation*} M = \sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{r} \vu_{r}\vv_{r}^{\tr}\text{,} \end{equation*}

if the rank of \(M\) is large, it is likely that many of the singular values will be very small. If we only keep \(s\) of the singular values, we can approximate \(M\) by

\begin{equation*} M_s = \sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{s} \vu_{s}\vv_{s}^{\tr} \end{equation*}

and store the image with only the vectors \(\sigma_1 \vu_1\text{,}\) \(\sigma_2 \vu_2\text{,}\) \(\ldots\text{,}\) \(\sigma_{s}\vu_s\text{,}\) \(\vv_1\text{,}\) \(\vv_1\text{,}\) \(\ldots\text{,}\) \(\vv_s\text{.}\) For example, if we only need 10 of the singular values of a satellite image (\(s = 10\)), then we can store the satellite image with only 20 vectors in \(\R^{1000}\) or with \(20 \times 1000 = 20,000\) numbers instead of \(1000 \times 1000 = 1,000,000\) numbers.

A similar process can be used to denoise data. 52 

Subsection Calculating the Error in Approximating an Image

In the context where a matrix represents an image, the operator aspect of the matrix is irrelevant — we are only interested in the matrix as a holder of information. In this situation, we think of an \(m \times n\) matrix as simply a long vector in \(\R^{mn}\) where we have folded the data into a rectangular array. If we are interested in determining the error in approximating an image by a compressed image, it makes sense to use the standard norm in \(\R^{mn}\) to determine length and distance. This leads to what is called the Frobenius norm of a matrix. The Frobenius norm \(||M||_F\) of an \(m \times n\) matrix \(M = [m_{ij}]\) is

\begin{equation*} ||M||_F = \sqrt{ \sum m_{ij}^2 }\text{.} \end{equation*}

There is a natural corresponding inner product on the set of \(m \times n\) matrices (called the Frobenius product) defined by

\begin{equation*} \langle A,B \rangle = \sum a_{ij}b_{ij}\text{,} \end{equation*}

where \(A = [a_{ij}]\) and \(B = [b_{ij}]\) are \(m \times n\) matrices. Note that

\begin{equation*} ||A||_F = \sqrt{\langle A, A\rangle}\text{.} \end{equation*}

If an \(m \times n\) matrix \(M\) of rank \(r\) has a singular value decomposition \(M = U \Sigma V^{\tr}\text{,}\) we have seen that we can write \(M\) as an outer product

\begin{equation} M = \sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{r} \vu_{r}\vv_{r}^{\tr}\text{,}\tag{30.3} \end{equation}

where the \(\vu_i\) are the columns of \(U\) and the \(\vv_j\) the columns of \(V\text{.}\) Each of the products \(\vu_i \vv_i^{\tr}\) is an \(m \times n\) matrix. Since the columns of \(\vu_i \vv_i^{\tr}\) are all scalar multiples of \(\vu_i\text{,}\) the matrix \(\vu_i \vv_i^{\tr}\) is a rank 1 matrix. So (30.3) expresses \(M\) as a sum of rank 1 matrices. Moreover, if we let \(\vx\) and \(\vw\) be \(m \times 1\) vectors and let \(\vy\) and \(\vz\) be \(n \times 1\) vectors with \(\vy = [y_1 \ y_2 \ \ldots \ y_n]^{\tr}\) and \(\vz = [z_1 \ z_2 \ \ldots \ z_n]^{\tr}\text{,}\) then

\begin{align*} \langle \vx\vy^{\tr}, \vw\vz^{\tr} \rangle \amp = \langle [y_1\vx \ y_2\vx \ \cdots \ y_n\vx], [z_1\vw \ z_2\vw \ \cdots \ z_n\vw] \rangle\\ \amp = \sum (y_i\vx) \cdot (z_i\vw)\\ \amp = \sum (y_iz_i)(\vx \cdot \vw)\\ \amp = (\vx \cdot \vw) \sum (y_iz_i)\\ \amp = (\vx \cdot \vw) (\vy \cdot \vz)\text{.} \end{align*}

Using the vectors from the singular value decomposition of \(M\) as in (30.3) we see that

\begin{equation*} \langle \vu_i\vv_i^{\tr}, \vu_j\vv_j^{\tr} \rangle = (\vu_i \cdot \vu_j)(\vv_i \cdot \vv_j) = \begin{cases}0, \amp \text{ if } i\neq j, \\ 1, \amp \text{ if } i = j. \end{cases} \end{equation*}

It follows that

\begin{equation} ||M||_F^2 = \sum \sigma_i^2 (\vu_i \cdot \vu_i)(\vv_i \cdot \vv_i) = \sum \sigma_i^2\text{.}\tag{30.4} \end{equation}

Activity 30.2.

Verify (30.4) that \(||M||_F^2 = \sum \sigma_i^2\text{.}\)

When we used the singular value decomposition to approximate the image defined by \(M\text{,}\) we replaced \(M\) with a matrix of the form

\begin{equation} M_k = \sigma_1 \vu_1\vv_1^{\tr} + \sigma_2 \vu_2\vv_2^{\tr} + \sigma_3 \vu_3\vv_3^{\tr} + \cdots + \sigma_{k} \vu_{k}\vv_{k}^{\tr}\text{.}\tag{30.5} \end{equation}

We call \(M_k\) the rank \(k\) approximation to \(M\text{.}\) Notice that the outer product expansion in (30.5) is in fact a singular value decomposition for \(M_k\text{.}\) The error \(E_k\) in approximating \(M\) with \(M_k\) is

\begin{equation} E_k = M - M_k = \sigma_{k+1} \vu_{k+1}\vv_{k+1}^{\tr} + \sigma_{k+2} \vu_{k+2}\vv_{k+2}^{\tr} + \cdots + \sigma_{r} \vu_{r}\vv_{r}^{\tr}\text{.}\tag{30.6} \end{equation}

Once again, notice that (30.6) is a singular value decomposition for \(E_k\text{.}\) We define the relative error in approximating \(M\) with \(M_k\) as

\begin{equation*} \ds \frac{||E_k||}{||M||}\text{.} \end{equation*}

Now (30.4) shows that

\begin{equation*} \ds \frac{||E_k||}{||M||} = \sqrt{ \frac{\sum_{i=k+1}^r \sigma_i^2}{\sum_{i=1}^r \sigma_i^2} }\text{.} \end{equation*}

In applications, we often want to retain a certain degree of accuracy in our approximations and this error term can help us accomplish that.

In our flower example, the singular values of \(M\) are given in (30.2). The relative error in approximating \(M\) with \(M_{12}\) is

\begin{equation*} \sqrt{ \frac{\sum_{i=13}^{16} \sigma_i^2}{\sum_{i=1}^{16} \sigma_i^2} } \approx 0.0018\text{.} \end{equation*}

Errors (rounded to 4 decimal places) for approximating \(M\) with some of the \(M_k\) are shown in Table 30.3

Table 30.3. Errors in approximating \(M\) by \(M_k\)
\(k\) 10 9 8 7 6
\(\frac{||E_k||}{||M||}\) 0.0070 0.0146 0.0252 0.0413 0.06426
\(k\) 5 4 3 2 1
\(\frac{||E_k||}{||M||}\) 0.0918 0.1231 0.1590 0.201 0.2460

Activity 30.3.

Let \(M\) represent the flower image.

(a)

Find the relative errors in approximating \(M\) by \(M_{13}\) and \(M_{14}\text{.}\) You may use the fact that \(\sqrt{\sum_{i=1}^{16} \sigma_i^2} \approx 3102.0679\text{.}\)

(b)

About how much of the information in the image is contained in the rank 1 approximation? Explain.

Subsection The Condition Number of a Matrix

A singular value decomposition for a matrix \(A\) can tell us a lot about how difficult it is to accurately solve a system \(A \vx = \vb\text{.}\) Solutions to systems of linear equations can be very sensitive to rounding as the next exercise demonstrates.

Activity 30.4.

Find the solution to each of the systems.

(a)

\(\left[ \begin{array}{cc} 1.0000\amp 1.0000 \\ 1.0000\amp 1.0005 \end{array} \right] \left[ \begin{array}{c} x \\ y \end{array} \right] = \left[ \begin{array}{c} 2.0000 \\ 2.0050 \end{array} \right]\)

(b)

\(\left[ \begin{array}{cc} 1.000\amp 1.000 \\ 1.000\amp 1.001 \end{array} \right] \left[ \begin{array}{c} x \\ y \end{array} \right] = \left[ \begin{array}{c} 2.000 \\ 2.005 \end{array} \right]\)

Notice that a simple rounding in the \((2,2)\) entry of the coefficient matrix led to a significantly different solution. If there are rounding errors at any stage of the Gaussian elimination process, they can be compounded by further row operations. This is an important problem since computers can only approximate irrational numbers with rational numbers and so rounding can be critical. Finding ways of dealing with these kinds of errors is an area of on-going research in numerical linear algebra. This problem is given a name.

Definition 30.4.

A matrix \(A\) is ill-conditioned if relatively small changes in any entries of \(A\) can produce significant changes in solutions to the system \(A\vx = \vb\text{.}\)

A matrix that is not ill-conditioned is said to be well-conditioned. Since small changes in entries of ill-conditioned matrices can lead to large errors in computations, it is an important problem in linear algebra to have a way to measure how ill-conditioned a matrix is. This idea will ultimately lead us to the condition number of a matrix.

Suppose we want to solve the system \(A \vx = \vb\text{,}\) where \(A\) is an invertible matrix. Activity 30.4 illustrates that if \(A\) is really close to being singular, then small changes in the entries of \(A\) can have significant effects on the solution to the system. So the system can be very hard to solve accurately if \(A\) is close to singular. It is important to have a sense of how “good” we can expect any calculated solution to be. Suppose we think we solve the system \(A \vx = \vb\) but, through rounding error in our calculation of \(A\text{,}\) get a solution \(\vx'\) so that \(A \vx' = \vb'\text{,}\) where \(\vb'\) is not exactly \(\vb\text{.}\) Let \(\Delta \vx\) be the error in our calculated solution and \(\Delta \vb\) the difference between \(\vb'\) and \(\vb\text{.}\) We would like to know how large the error \(||\Delta \vx||\) can be. But this isn't exactly the right question. We could scale everything to make \(||\Delta \vx||\) as large as we want. What we really need is a measure of the relative error \(\frac{||\Delta \vx||}{||\vx||}\text{,}\) or how big the error is compared to \(||\vx||\) itself. More specifically, we want to know how large the relative error in \(\Delta \vx\) is compared to the relative error in \(\Delta \vb\text{.}\) In other words, we want to know how good the relative error in \(\Delta \vb\) is as a predictor of the relative error in \(\Delta \vx\) (we may have some control over the relative error in \(\Delta \vb\text{,}\) perhaps by keeping more significant digits). So we want know if there is a best constant \(C\) such that

\begin{equation*} \frac{||\Delta \vx||}{||\vx||} \leq C \frac{||\Delta \vb||}{||\vb||}\text{.} \end{equation*}

This best constant \(C\) is the condition number — a measure of how well the relative error in \(\Delta \vb\) predicts the relative error in \(\Delta \vx\text{.}\) How can we find \(C\text{?}\)

Since \(A \vx' = \vb'\) we have

\begin{equation*} A(\vx + \Delta \vx) = \vb + \Delta \vb\text{.} \end{equation*}

Distributing on the left and using the fact that \(A\vx = \vb\) gives us

\begin{equation} A\Delta \vx = \Delta \vb\text{.}\tag{30.7} \end{equation}

We return for a moment to the operator norm of a matrix. This is an appropriate norm to use here since we are considering \(A\) to be a transformation. Recall that if \(A\) is an \(m \times n\) matrix, we defined the operator norm of \(A\) to be

\begin{equation*} ||A|| = \max_{||\vx|| \neq \vzero} \left\{\frac{||A\vx||}{||\vx||} \right\} = \max_{||\vx||=1} \{||A\vx||\}\text{.} \end{equation*}

One important property that the norm has is that if the product \(AB\) is defined, then

\begin{equation*} ||AB|| \leq ||A|| \ ||B||\text{.} \end{equation*}

To see why, notice that

\begin{equation*} \frac{||AB\vx||}{||\vx||} = \frac{||A(B\vx)||}{||B\vx||} \ \frac{||B\vx||}{||\vx||}\text{.} \end{equation*}

Now \(\frac{||A(B\vx)||}{||B\vx||} \leq ||A||\) and \(\frac{||B\vx||}{||\vx||} \leq ||B||\) by the definition of the norm, so we conclude that

\begin{equation*} \frac{||AB\vx||}{||\vx||} \leq ||A|| \ ||B|| \end{equation*}

for every \(\vx\text{.}\) Thus,

\begin{equation*} ||AB|| \leq ||A|| \ ||B||\text{.} \end{equation*}

Now we can find the condition number. From \(A \Delta \vx = \Delta \vb\) we have

\begin{equation*} \Delta \vx = A^{-1} \Delta \vb\text{,} \end{equation*}

so

\begin{equation} ||\Delta \vx|| \leq ||A^{-1}|| \ ||\Delta \vb||\text{.}\tag{30.8} \end{equation}

Similarly, \(\vb = A\vx\) implies that \(||\vb|| \leq ||A|| \ ||\vx||\) or

\begin{equation} \frac{1}{||\vx||} \leq \frac{||A||}{||\vb||}\text{.}\tag{30.9} \end{equation}

Combining (30.8) and (30.9) gives

\begin{align*} \frac{||\Delta \vx||}{||\vx||} \amp \leq \frac{||A^{-1}|| \ ||\Delta \vb||}{||\vx||}\\ \amp = ||A^{-1}|| \ ||\Delta \vb|| \left(\frac{1}{||\vx||}\right)\\ \amp \leq ||A^{-1}|| \ ||\Delta \vb|| \frac{||A||}{||\vb||}\\ \amp = ||A^{-1}|| \ ||A|| \ \frac{||\Delta \vb||}{||\vb||}\text{.} \end{align*}

This constant \(||A^{-1}|| \ ||A||\) is the best bound and so is called the condition number of \(A\text{.}\)

Definition 30.5.

The condition number of an invertible matrix \(A\) is the number \(||A^{-1}|| \ ||A||\text{.}\)

How does a singular value decomposition tell us about the condition number of a matrix? Recall that the maximum value of \(||A\vx||\) for \(\vx\) on the unit \(n\)-sphere is \(\sigma_1\text{.}\) So \(||A|| = \sigma_1\text{.}\) If \(A\) is an invertible matrix and \(A = U \Sigma V^{\tr}\) is a singular value decomposition for \(A\text{,}\) then

\begin{equation*} A^{-1} = (U \Sigma V^{\tr})^{-1} = (V^{\tr})^{-1} \Sigma^{-1} U^{-1} = V \Sigma^{-1} U^{\tr}\text{,} \end{equation*}

where

\begin{equation*} \Sigma^{-1} = \left[ \begin{array}{ccccc} \frac{1}{\sigma_1}\amp \amp \amp \amp 0 \\ \amp \frac{1}{\sigma_2}\amp \amp \amp \\ \amp \amp \frac{1}{\sigma_3}\amp \amp \\ \amp \amp \amp \ddots \amp \\ 0\amp \amp \amp \amp \frac{1}{\sigma_n} \end{array} \right]\text{.} \end{equation*}

Now \(V \Sigma^{-1} U^{\tr}\) is a singular value decomposition for \(A^{-1}\) with the diagonal entries in reverse order, so

\begin{equation*} ||A^{-1}|| = \frac{1}{\sigma_n}\text{.} \end{equation*}

Therefore, the condition number of \(A\) is

\begin{equation*} ||A^{-1}|| \ ||A|| = \frac{\sigma_1}{\sigma_n}\text{.} \end{equation*}

Activity 30.5.

Let \(A = \left[ \begin{array}{cc} 1.0000\amp 1.0000 \\ 1.0000\amp 1.0005 \end{array} \right]\text{.}\) A computer algebra system gives the singular values of \(A\) as 2.00025003124999934 and 0.000249968750000509660. What is the condition number of \(A\text{.}\) What does that tell us about \(A\text{?}\) Does this seem reasonable given the result of Activity 30.4?

Activity 30.6.

(a)

What is the smallest the condition number of a matrix can be? Find an entire class of matrices with this smallest condition number.

(b)

What is the condition number of an orthogonal matrix? Why does this make sense?

Hint.

If \(P\) is an orthogonal matrix, what is \(||P \vx||\) for any vector \(\vx\text{?}\) What does this make \(||P||\text{?}\)

(c)

What is the condition number of an invertible symmetric matrix in terms of its eigenvalues?

(d)

Why do we not define the condition number of a non-invertible matrix? If we did, what would the condition number have to be? Why?

Subsection Pseudoinverses

Not every matrix is invertible, so we cannot always solve a matrix equation \(A \vx = \vb\text{.}\) However, every matrix has a pseudoinverse \(A^+\) that acts something like an inverse. Even when we can't solve a matrix equation \(A \vx = \vb\) because \(\vb\) isn't in \(\Col A\text{,}\) we can use the pseudoinverse of \(A\) to “solve” the equation \(A \vx = \vb\) with the “solution” \(A^+ \vb\text{.}\) While not an exact solution, \(A^+ \vb\) turns out to be the best approximation to a solution in the least squares sense. We will use the singular value decomposition to find the pseudoinverse of a matrix.

Preview Activity 30.7.

Let \(A = \left[\begin{array}{ccc} 1\amp 1\amp 0\\ 0\amp 1\amp 1 \end{array} \right]\text{.}\) The singular value decomposition of \(A\) is \(U \Sigma V^{\tr}\) where

\begin{align*} U \amp = \frac{\sqrt{2}}{2} \left[ \begin{array}{cr} 1\amp -1\\ 1\amp 1 \end{array} \right],\\ \Sigma \amp = \left[ \begin{array}{ccc} \sqrt{3}\amp 0\amp 0\\ 0\amp 1\amp 0 \end{array} \right],\\ V \amp = \frac{1}{6} \left[ \begin{array}{rrr} \sqrt{6}\amp -3\sqrt{2}\amp 2\sqrt{3}\\ 2\sqrt{6}\amp 0\amp -2\sqrt{3}\\ \sqrt{6}\amp 3\sqrt{2}\amp 2\sqrt{3} \end{array} \right]\text{.} \end{align*}
(a)

Explain why \(A\) is not an invertible matrix.

(b)

Explain why the matrices \(U\) and \(V\) are invertible. How are \(U^{-1}\) and \(V^{-1}\) related to \(U^{\tr}\) and \(V^{\tr}\text{?}\)

(c)

Recall that one property of invertible matrices is that the inverse of a product of invertible matrices is the product of the inverses in the reverse order. If \(A\) were invertible, then \(A^{-1}\) would be \(\left(U \Sigma V^{\tr}\right)^{-1} = V \Sigma^{-1} U^{\tr}\text{.}\) Even though \(U\) and \(V\) are invertible, the matrix \(\Sigma\) is not. But \(\Sigma\) does contain non-zero eigenvalues that have reciprocals, so consider the matrix \(\Sigma^+ = \left[ \begin{array}{cc} \frac{1}{\sqrt{3}}\amp 0 \\ 0\amp 1 \\ 0\amp 0 \end{array} \right]\text{.}\) Calculate the products \(\Sigma \Sigma^+\) and \(\Sigma^+ \Sigma\text{.}\) How are the results similar to that obtained with a matrix inverse?

(d)

The only matrix in the singular value decomposition of \(A\) that is not invertible is \(\Sigma\text{.}\) But the matrix \(\Sigma^{+}\) acts somewhat like an inverse of \(\Sigma\text{,}\) so let us define \(A^+\) as \(V \Sigma^+ U^{\tr}\text{.}\) Now we explore a few properties of the matrix \(A^{+}\text{.}\)

(i)

Calculate \(AA^+\) and \(A^+A\) for \(A = \left[\begin{array}{ccc} 1\amp 1\amp 0\\ 0\amp 1\amp 1 \end{array} \right]\text{.}\) What do you notice?

(ii)

Calculate \(A^+AA^+\) and \(AA^+A\) for \(A = \left[\begin{array}{ccc} 1\amp 1\amp 0\\ 0\amp 1\amp 1 \end{array} \right]\text{.}\) What do you notice?

Only some square matrices have inverses. However, every matrix has a pseudoinverse. A pseudoinverse \(A^{+}\) of a matrix \(A\) provides something like an inverse when a matrix doesn't have an inverse. Pseudoinverses are useful to approximate solutions to linear systems. If \(A\) is invertible, then the equation \(A \vx = \vb\) has the solution \(\vx = A^{-1}\vb\text{,}\) but when \(A\) is not invertible and \(\vb\) is not in \(\Col A\text{,}\) then the equation \(A \vx = \vb\) has no solution. In the invertible case of an \(n \times n\) matrix \(A\text{,}\) there is a matrix \(B\) so that \(AB = BA = I_n\text{.}\) This also implies that \(BAB = B\) and \(ABA = A\text{.}\) To mimic this situation when \(A\) is not invertible, we search for a matrix \(A^+\) (a pseudoinverse of \(A\)) so that \(AA^+A = A\) and \(A^+AA^+ = A^+\text{,}\) as we saw in Preview Activity 30.7. Then it turns out that \(A^+\) acts something like an inverse for \(A\text{.}\) In this case, we approximate the solution to \(A \vx = \vb\) by \(\vx^* = A^+\vb\text{,}\) and we will see that the vector \(A\vx^* = AA^+\vb\) turns out to be the vector in \(\Col A\) that is closest to \(\vb\) in the least squares sense.

A reasonable question to ask is how we can find a pseudoinverse of a matrix \(A\text{.}\) A singular value decomposition provides an answer to this question. If \(A\) is an invertible \(n \times n\) matrix, then 0 is not an eigenvalue of \(A\text{.}\) As a result, in the singular value decomposition \(U \Sigma V^{\tr}\) of \(A\text{,}\) the matrix \(\Sigma\) is an invertible matrix (note that \(U\text{,}\) \(\Sigma\text{,}\) and \(V\) are all \(n \times n\) matrices in this case). So

\begin{equation*} A^{-1} = \left(U \Sigma V^{\tr}\right)^{-1} = V \Sigma^{-1} U^{\tr}\text{,} \end{equation*}

where

\begin{equation*} \Sigma^{-1} = \left[ \begin{array}{ccccc} \frac{1}{\sigma_1}\amp \amp \amp \amp \\ \amp \frac{1}{\sigma_2}\amp \amp 0\amp \\ \amp \amp \frac{1}{\sigma_3}\amp \amp \\ \amp 0 \amp \amp \ddots \amp \\ \amp \amp \amp \amp \frac{1}{\sigma_n} \end{array} \right]\text{.} \end{equation*}

In this case, \(V \Sigma^{-1} U^{\tr}\) is a singular value decomposition for \(A^{-1}\text{.}\)

To understand in general how a pseudoinverse is found, let \(A\) be an \(m \times n\) matrix with \(m \neq n\text{,}\) or an \(n \times n\) with rank less than \(n\text{.}\) In these cases \(A\) does not have an inverse. But as in Preview Activity 30.7, a singular value decomposition provides a pseudoinverse \(A^+\) for \(A\text{.}\) Let \(U \Sigma V^{\tr}\) be a singular value decomposition of an \(m \times n\) matrix \(A\) of rank \(r\text{,}\) with

\begin{equation*} \Sigma = \left[ \begin{array}{ccccc|c} \sigma_1\amp \amp \amp \amp \amp \\ \amp \sigma_2\amp \amp 0\amp \amp 0 \\ \amp \amp \sigma_3\amp \amp \amp \\ \amp 0 \amp \amp \ddots \amp \amp \\ \amp \amp \amp \amp \sigma_r \\ \hline \amp \amp 0\amp \amp \amp 0 \end{array} \right] \end{equation*}

The matrices \(U\) and \(V\) are invertible, but the matrix \(\Sigma\) is not if \(A\) is not invertible. If we let \(\Sigma^+\) be the \(n \times m\) matrix defined by

\begin{equation*} \Sigma^{+} = \left[ \begin{array}{ccccc|c} \frac{1}{\sigma_1}\amp \amp \amp \amp \amp \\ \amp \frac{1}{\sigma_2}\amp \amp 0\amp \amp 0 \\ \amp \amp \frac{1}{\sigma_3}\amp \amp \amp \\ \amp 0 \amp \amp \ddots \amp \amp \\ \amp \amp \amp \amp \frac{1}{\sigma_r} \\ \hline \amp \amp 0\amp \amp \amp 0 \end{array} \right]\text{,} \end{equation*}

then \(\Sigma^{+}\) will act much like an inverse of \(\Sigma\) might. In fact, it is not difficult to see that

\begin{equation*} \Sigma\Sigma^{+} = \left[ \begin{array}{c|c} I_r\amp 0 \\ \hline 0\amp 0 \end{array} \right] \text{ and } \Sigma^{+}\Sigma = \left[ \begin{array}{c|c} I_r\amp 0 \\ \hline 0\amp 0 \end{array} \right]\text{,} \end{equation*}

where \(\Sigma\Sigma^{+}\) is an \(m \times m\) matrix and \(\Sigma^{+}\Sigma\) is an \(n \times n\) matrix.

The matrix

\begin{equation} A^{+} = V\Sigma^{+}U^{\tr}\tag{30.10} \end{equation}

is a pseudoinverse of \(A\text{.}\)

Activity 30.8.

(a)

Find the pseudoinverse \(A^+\) of \(A = \left[ \begin{array}{rc} 0\amp 5\\ 4\amp 3 \\ -2\amp 1 \end{array} \right]\text{.}\) Use the singular value decomposition \(U \Sigma V^{\tr}\) of \(A\text{,}\) where

\begin{equation*} U = \left[ \begin{array}{crc} \frac{\sqrt{2}}{2}\amp \frac{\sqrt{3}}{3}\amp 1 \\ \frac{\sqrt{2}}{2}\amp -\frac{\sqrt{3}}{3}\amp 0 \\ 0\amp \frac{\sqrt{3}}{3}\amp 0 \end{array} \right], \ \Sigma = \left[ \begin{array}{cc} \sqrt{40}\amp 0 \\ 0\amp \sqrt{15} \\ 0\amp 0 \end{array} \right], \ V = \frac{1}{\sqrt{5}} \left[ \begin{array}{cr} 1\amp -2 \\ 2\amp 1 \end{array} \right]\text{.} \end{equation*}
(b)

The vector \(\vb = \left[ \begin{array}{c} 0\\0\\1 \end{array} \right]\) is not in \(\Col A\text{.}\) The vector \(\vx^* = A^+ \vb\) is an approximation to a solution of \(A \vx = \vb\text{,}\) and \(AA^+\vb\) is in \(\Col A\text{.}\) Find \(A\vx^*\) and determine how far \(A\vx^*\) is from \(\vb\text{.}\)

Pseudoinverses satisfy several properties that are similar to those of inverses. For example, we had an example in Preview Activity 30.7 where \(AA^{+}A = A\) and \(A^+AA^+ = A^+\text{.}\) That \(A^+\) always satisfies these properties is the subject of the next activity.

Activity 30.9.

Let \(A\) be an \(m \times n\) matrix with singular value decomposition \(U \Sigma V^{\tr}\text{.}\) Let \(A^{+}\) be defined as in (30.10).

(a)

Show that \(AA^{+}A = A\text{.}\)

(b)

Show that \(A^{+}AA^{+} = A^{+}\text{.}\)

Activity 30.9 shows that \(A^{+}\) satisfies properties that are similar to those of an inverse of \(A\text{.}\) In fact, \(A^{+}\) satisfies several other properties (that together can be used as defining properties) as stated in the next theorem. The conditions of Theorem 30.6 are called the Penrose or Moore-Penrose conditions. 53  Verification of the remaining parts of this theorem are left for the exercises.

Also, there is a unique matrix \(A^+\) that satisfies these properties. The verification of this property is left to the exercises.

Subsection Least Squares Approximations

The pseudoinverse of a matrix is also connected to least squares solutions of linear systems as we encountered in Section 24. Recall from Section 24, that if the columns of \(A\) are linearly independent, then the least squares solution to \(A\vx = \vb\) is \(\vx = \left(A^{\tr}A\right)^{-1}A^{\tr} \vb\text{.}\) In this section we will see how to use a pseudoinverse to solve a least squares problem, and verify that if the columns of \(A\) are linearly dependent, then \(\left(A^{\tr}A\right)^{-1}A^{\tr}\) is in fact the pseudoinverse of \(A\text{.}\)

Let \(U \Sigma V^{\tr}\) be a singular value decomposition for an \(m \times n\) matrix \(A\) of rank \(r\text{.}\) Then the columns of

\begin{equation*} U = [\vu_1 \ \vu_2 \ \cdots \ \vu_m] \end{equation*}

form an orthonormal basis for \(\R^m\) and \(\{\vu_1, \vu_2, \ldots, \vu_r\}\) is a basis for \(\Col A\text{.}\) Remember from Section 25 that if \(\vb\) is any vector in \(\R^m\text{,}\) then

\begin{equation*} \proj_{\Col A} \vb = (\vb \cdot \vu_1) \vu_1 + (\vb \cdot \vu_2) \vu_2 + \cdots + (\vb \cdot \vu_r) \vu_r \end{equation*}

is the least squares approximation of the vector \(\vb\) by a vector in \(\Col A\text{.}\) We can extend this sum to all of columns of \(U\) as

\begin{equation*} \proj_{\Col A} \vb = (\vb \cdot \vu_1) \vu_1 + (\vb \cdot \vu_2) \vu_2 + \cdots + (\vb \cdot \vu_r) \vu_r + 0 \vu_{r+1} + 0 \vu_{r+2} + \cdots + 0 \vu_m\text{.} \end{equation*}

It follows that

\begin{align*} \proj_{\Col A} \vb \amp = \sum_{i=1}^r \vu_i (\vu_i \cdot \vb)\\ \amp = \sum_{i=1}^r \vu_i (\vu_i^{\tr}\vb)\\ \amp = \sum_{i=1}^r (\vu_i\vu_i^{\tr}) \vb\\ \amp = \left(\sum_{i=1}^r (1)(\vu_i\vu_i^{\tr})\right)\vb + \left(\sum_{i=r+1}^m 0(\vu_i\vu_i^{\tr})\right) \vb\\ \amp = (UDU^{\tr}) \vb\text{,} \end{align*}

where

\begin{equation*} D = \left[ \begin{array}{c|c} I_r \amp \vzero \\ \hline \vzero \amp \vzero \end{array} \right]\text{.} \end{equation*}

Now, if \(\vz = A^{+} \vb\text{,}\) then

\begin{equation*} A\vz = (U\Sigma V^{\tr})(V \Sigma^+ U^{\tr} \vb) = (U \Sigma \Sigma^+ U^{\tr})\vb = (UDU^{\tr})\vb = \proj_{\Col A} \vb\text{,} \end{equation*}

and hence the vector \(A \vz = AA^+ \vb\) is the vector \(A\vx\) in \(\Col A\) that minimizes \(||A \vx - \vb||\text{.}\) Thus, \(A\vz\) is in actuality the least squares approximation to \(\vb\text{.}\) So a singular value decomposition allows us to construct the pseudoinverse of a matrix \(A\) and then directly solve the least squares problem.

If the columns of \(A\) are linearly independent, then we do not need to use an SVD to find the pseudoinverse, as the next activity illustrates.

Activity 30.10.

Having to calculate eigenvalues and eigenvectors for a matrix to produce a singular value decomposition to find pseudoinverse can be computationally intense. As we demonstrate in this activity, the process is easier if the columns of \(A\) are linearly independent. More specifically, we will prove the following theorem.

To see how, suppose that \(A\) is an \(m \times n\) matrix with linearly independent columns.

(a)

Given that the columns of \(A\) are linearly independent, what must be the relationship between \(n\) and \(m\text{?}\)

(b)

Since the columns of \(A\) are linearly independent, it follows that \(A^{\tr}A\) is invertible (see Activity 26.4). So the eigenvalues of \(A^{\tr}A\) are all non-zero. Let \(\sigma_1\text{,}\) \(\sigma_2\text{,}\) \(\ldots\text{,}\) \(\sigma_r\) be the singular values of \(A\text{.}\) How is \(r\) related to \(n\text{,}\) and what do \(\Sigma\) and \(\Sigma^{+}\) look like?

(c)

Let us now investigate the form of the invertible matrix \(A^{\tr}A\) (note that neither \(A\) nor \(A^{\tr}\) is necessarily invertible). If a singular value decomposition of \(A\) is \(U \Sigma V^{\tr}\text{,}\) show that

\begin{equation*} A^{\tr}A = V \Sigma^{\tr} \Sigma V^{\tr}\text{.} \end{equation*}
(d)

Let \(\lambda_i = \sigma_i^2\) for \(i\) from 1 to \(n\text{.}\) It is straightforward to see that \(\Sigma^{\tr} \Sigma\) is an \(n \times n\) diagonal matrix \(D\text{,}\) where

\begin{equation*} D = \Sigma^{\tr} \Sigma = \left[ \begin{array}{ccccc} \lambda_1\amp \amp \amp \amp \\ \amp \lambda_2\amp \amp 0\amp \\ \amp \amp \lambda_3\amp \amp \\ \amp \amp \amp \ddots \amp \\ \amp 0\amp \amp \amp \lambda_n \end{array} \right]\text{.} \end{equation*}

Then \((A^{\tr}A)^{-1} = VD^{-1}V^{\tr}\text{.}\) Recall that \(A^{+} = V \Sigma^{+} U^{\tr}\text{,}\) so to relate \(A^{\tr}A\) to \(A^{+}\) we need a product that is equal to \(\Sigma^{+}\text{.}\) Explain why

\begin{equation*} D^{-1} \Sigma^{\tr} = \Sigma^{+}\text{.} \end{equation*}
(e)

Complete the activity by showing that

\begin{equation*} \left(A^{\tr}A\right)^{-1} A^{\tr} = A^{+}\text{.} \end{equation*}

Therefore, to calculate \(A^{+}\) and solve a least squares problem, Theorem 30.7 shows that as long as the columns of \(A\) are linearly independent, we can avoid using a singular value decomposition of \(A\) in finding \(A^{+}\text{.}\)

Subsection Examples

What follows are worked examples that use the concepts from this section.

Example 30.8.

Let

\begin{equation*} A = \left[ \begin{array}{ccc} 2\amp 5\amp 4\\6\amp 3\amp 0\\6\amp 3\amp 0\\2\amp 5\amp 4 \end{array} \right]\text{.} \end{equation*}

The eigenvalues of \(A^{\tr}A\) are \(\lambda_1 = 144\text{,}\) \(\lambda_2 = 36\text{,}\) and \(\lambda_3=0\) with corresponding eigenvectors

\begin{equation*} \vw_1 = \left[ \begin{array}{c} 2\\2\\1 \end{array} \right], \ \vw_1 = \left[ \begin{array}{r} -2\\1\\2 \end{array} \right], \ \text{ and } \ \vw_1 = \left[ \begin{array}{r} 1\\-2\\2 \end{array} \right]\text{.} \end{equation*}

In addition,

\begin{equation*} A \vw_1 = \left[ \begin{array}{c} 18\\18\\18\\18 \end{array} \right] \ \text{ and } A \vw_2 = \left[ \begin{array}{r} 9\\-9\\-9\\9 \end{array} \right]\text{.} \end{equation*}
(a)

Find orthogonal matrices \(U\) and \(V\text{,}\) and the matrix \(\Sigma\text{,}\) so that \(U \Sigma V^{\tr}\) is a singular value decomposition of \(A\text{.}\)

Solution.

Normalizing the eigenvectors \(\vw_1\text{,}\) \(\vw_2\text{,}\) and \(\vw_3\) to normal eigenvectors \(\vv_1\text{,}\) \(\vv_2\text{,}\) and \(\vv_3\text{,}\) respectively, gives us an orthogonal matrix

\begin{equation*} V = \left[ \begin{array}{crr} \frac{2}{3}\amp -\frac{2}{3}\amp \frac{1}{3}\\ \frac{2}{3}\amp \frac{1}{3}\amp - \frac{2}{3}\\ \frac{1}{3}\amp \frac{2}{3}\amp \frac{2}{3} \end{array} \right]\text{.} \end{equation*}

Now \(A \vv_i = A \frac{\vw_i}{||\vw_i||} = \frac{1}{||\vw_i||} A \vw_i\text{,}\) so normalizing the vectors \(A \vw_1\) and \(A \vw_2\) gives us vectors

\begin{equation*} \vu_1 = \frac{1}{2} \left[ \begin{array}{c} 1\\1\\1\\1 \end{array} \right] \ \text{ and } \ \vu_2 = \frac{1}{2} \left[ \begin{array}{r} 1\\-1\\-1\\1 \end{array} \right] \end{equation*}

that are the first two columns of our matrix \(U\text{.}\) Given that \(U\) is a \(4 \times 4\) matrix, we need to find two other vectors orthogonal to \(\vu_1\) and \(\vu_2\) that will combine with \(\vu_1\) and \(\vu_2\) to form an orthogonal basis for \(\R^4\text{.}\) Letting \(\vz_1 = [1 \ 1 \ 1 \ 1]^{\tr}\text{,}\) \(\vz_2 = [1 \ -1 \ -1 \ 1]^{\tr}\text{,}\) \(\vz_3 = [1 \ 0 \ 0 \ 0]^{\tr}\text{,}\) and \(\vz_4 = [0 \ 1 \ 0 \ 1]^{\tr}\text{,}\) a computer algebra system shows that the reduced row echelon form of the matrix \([\vz_1 \ \vz_2 \ \vz_3 \ \vz_4]\) is \(I_4\text{,}\) so that vectors \(\vz_1\text{,}\) \(\vz_2\text{,}\) \(\vz_3\text{,}\) \(\vz_4\) are linearly independent. Letting \(\vw_1 = \vz_1\) and \(\vw_2 = \vz_2\text{,}\) the Gram-Schmidt process shows that the set \(\{\vw_1, \vw_2, \vw_3, \vw_4\}\) is an orthogonal basis for \(\R^4\text{,}\) where \(\vw_3 = \frac{1}{4} [2 \ 0 \ 0 \ -2]^{\tr}\) and (using \([1 \ 0 \ 0 \ -1]^{\tr}\) for \(\vw_3\)) \(\vw_4 = \frac{1}{4} [0 \ 2 \ -2 \ 0]^{\tr}\text{.}\) The set \(\{\vu_1, \vu_2, \vu_3, \vu_4\}\) where \(\vu_1 = \frac{1}{2}[1 \ 1 \ 1 \ 1]^{\tr}\text{,}\) \(\vu_2 = \frac{1}{2}[1 \ -1 \ -1 \ 1]^{\tr}\text{,}\) \(\vu_3 = \frac{1}{\sqrt{2}}[1 \ 0 \ 0 \ -1]^{\tr}\) and \(\vu_4 = \frac{1}{\sqrt{2}}[0 \ 1 \ -1 \ 0]^{\tr}\) is an orthonormal basis for \(\R^4\) and we can let

\begin{equation*} U = \left[ \begin{array}{crrr} \frac{1}{2} \amp \frac{1}{2} \amp \frac{1}{\sqrt{2}} \amp 0 \\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp \frac{1}{\sqrt{2}} \\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp -\frac{1}{\sqrt{2}} \\ \frac{1}{2} \amp \frac{1}{2} \amp -\frac{1}{\sqrt{2}} \amp 0 \end{array} \right]\text{.} \end{equation*}

The singular values of \(A\) are \(\sigma_1 = \sqrt{\lambda_1} = 12\) and \(\sigma_2 = \sqrt{\lambda_2} = 6\text{,}\) and so

\begin{equation*} \Sigma = \begin{bmatrix}12\amp 0\amp 0 \\ 0\amp 6\amp 0 \\0\amp 0\amp 0 \\ 0\amp 0\amp 0 \end{bmatrix}\text{.} \end{equation*}

Therefore, a singular value decomposition of \(A\) is \(U \Sigma V^{\tr}\) of

\begin{equation*} \left[ \begin{array}{crrr} \frac{1}{2} \amp \frac{1}{2} \amp \frac{1}{\sqrt{2}} \amp 0 \\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp \frac{1}{\sqrt{2}} \\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp -\frac{1}{\sqrt{2}} \\ \frac{1}{2} \amp \frac{1}{2} \amp -\frac{1}{\sqrt{2}} \amp 0 \end{array} \right] \begin{bmatrix}12\amp 0\amp 0 \\ 0\amp 6\amp 0 \\0\amp 0\amp 0 \\ 0\amp 0\amp 0 \end{bmatrix} \left[ \begin{array}{rrc} \frac{2}{3}\amp \frac{2}{3}\amp \frac{1}{3}\\ -\frac{2}{3}\amp \frac{1}{3}\amp \frac{2}{3}\\ \frac{1}{3}\amp -\frac{2}{3}\amp \frac{2}{3} \end{array} \right]\text{.} \end{equation*}
(b)

Determine the best rank 1 approximation to \(A\text{.}\) Give an appropriate numerical estimate as to how good this approximation is to \(A\text{.}\)

Solution.

The outer product decomposition of \(A\) is

\begin{equation*} A = \sigma_1 \vu_1 \vv_1^{\tr} + \sigma_2 \vu_2 \vv_2^{\tr}\text{.} \end{equation*}

So the rank one approximation to \(A\) is

\begin{equation*} \sigma_1 \vu_1 \vv_1^{\tr} = 12 \left(\frac{1}{2}\right) \left[ \begin{array}{c} 1\\1\\1\\1 \end{array} \right] \left[ \begin{array}{ccc} \frac{2}{3} \amp \frac{2}{3} \amp \frac{1}{3} \end{array} \right] = \left[ \begin{array}{ccc} 4\amp 4\amp 2\\ 4\amp 4\amp 2 \\ 4\amp 4\amp 2\\ 4\amp 4\amp 2 \end{array} \right]\text{.} \end{equation*}

The error in approximating \(A\) with this rank one approximation is

\begin{equation*} \sqrt{\frac{\sigma_2^2}{\sigma_1^2+\sigma_2^2}} = \sqrt{\frac{36}{180}} = \sqrt{\frac{1}{5}} \approx 0.447\text{.} \end{equation*}
(c)

Find the pseudoinverse \(A^+\) of \(A\text{.}\)

Solution.

Given that \(A = U \Sigma V^{\tr}\text{,}\) we use the pseudoinverse \(\Sigma^+\) of \(\Sigma\) to find the pseudoinverse \(A^+\) of \(A\) by

\begin{equation*} A^+ = V \Sigma^+ U^{\tr}\text{.} \end{equation*}

Now

\begin{equation*} \Sigma^+ = \left[ \begin{array}{ccc} \frac{1}{12}\amp 0\amp 0 \\ 0\amp \frac{1}{6}\amp 0 \\0\amp 0\amp 0 \\ 0\amp 0\amp 0 \end{array} \right]\text{,} \end{equation*}

so

\begin{align*} A^+ \amp = \left[ \begin{array}{crr} \frac{2}{3}\amp -\frac{2}{3}\amp \frac{1}{3}\\ \frac{2}{3}\amp \frac{1}{3}\amp - \frac{2}{3}\\ \frac{1}{3}\amp \frac{2}{3}\amp \frac{2}{3}\end{array} \right] \left[ \begin{array}{ccc} \frac{1}{12}\amp 0\amp 0\\ 0\amp \frac{1}{6}\amp 0\\ 0\amp 0\amp 0\\ 0\amp 0\amp 0 \end{array} \right] \left[ \begin{array}{crrr} \frac{1}{2} \amp \frac{1}{2} \amp \frac{1}{\sqrt{2}} \amp 0\\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp \frac{1}{\sqrt{2}}\\ \frac{1}{2} \amp -\frac{1}{2} \amp 0 \amp -\frac{1}{\sqrt{2}}\\ \frac{1}{2} \amp \frac{1}{2} \amp -\frac{1}{\sqrt{2}} \amp 0 \end{array} \right]^{\tr}\\ \amp = \frac{1}{72} \left[ \begin{array}{rrrr} -2\amp 6\amp 6\amp -2\\ 4\amp 0\amp 0\amp 4\\ 5\amp -3\amp -3\amp 5 \end{array} \right]\text{.} \end{align*}
(d)

Let \(\vb = \left[ \begin{array}{c} 1\\0\\1\\0 \end{array} \right]^{\tr}\text{.}\) Does the matrix equation

\begin{equation*} A \vx = \vb \end{equation*}

have a solution? If so, find the solution. If not, find the best approximation you can to a solution to this matrix equation.

Solution.

Augmenting \(A\) with \(\vb\) and row reducing shows that

\begin{equation*} [A \ \vb ] \sim \left[ \begin{array}{crrr} 2\amp 5\amp 4\amp 1\\ 0\amp -12\amp -12\amp -3 \\ 0\amp 0\amp 0\amp 1\\ 0\amp 0\amp 0\amp 0 \end{array} \right]\text{,} \end{equation*}

so \(\vb\) is not in \(\Col A\) and the equation \(A\vx = \vb\) has no solution. However, the best approximation to a solution to \(A \vx = \vb\) is found using the pseudoinverse \(A^+\) of \(A\text{.}\) That best solution is

\begin{align*} \vx^*\amp = AA^+ \vb\\ \amp = \left[ \begin{array}{ccc} 2\amp 5\amp 4\\ 6\amp 3\amp 0\\ 6\amp 3\amp 0\\ 2\amp 5\amp 4 \end{array} \right] \frac{1}{72} \left[ \begin{array}{rrrr} -2\amp 6\amp 6\amp -2\\ 4\amp 0\amp 0\amp 4\\ 5\amp -3\amp -3\amp 5 \end{array} \right] \left[ \begin{array}{c} 1\\ 0\\ 1\\ 0 \end{array} \right]\\ \amp = \frac{1}{2} \left[ \begin{array}{c} 2\\ 1\\ 1\\ 2 \end{array} \right]\text{.} \end{align*}
(e)

Use the orthogonal basis \(\{\frac{1}{2}[1 \ 1 \ 1 \ 1]^{\tr}, \frac{1}{2}[1 \ -1 \ -1 \ 1]^{\tr}\}\) of \(\Col A\) to find the projection of \(\vb\) onto \(\Col A\text{.}\) Compare to your solution in part (c).

Solution.

The rank of \(A\) is 2 and an orthonormal basis for \(\Col A\) is \(\{\vu_1, \vu_2\}\text{,}\) where \(\vu_1 = \frac{1}{2}[1 \ 1 \ 1 \ 1]^{\tr}\) and \(\vu_2 = \frac{1}{2}[1 \ -1 \ -1 \ 1]^{\tr}\text{.}\) So

\begin{align*} \proj_{\Col A} \vb \amp = (\vb \cdot \vu_1) \vu_1 + (\vb \cdot \vu_2) \vu_2\\ \amp = \left(\frac{3}{2}\right)\left(\frac{1}{2}\right)[1 \ 1 \ 1 \ 1]^{\tr} + \left(\frac{1}{2}\right)\left(\frac{1}{2}\right)[1 \ -1 \ -1 \ 1]^{\tr}\\ \amp = \frac{1}{2}[2 \ 1 \ 1 \ 2]^{\tr} \end{align*}

as expected from part (c).

Example 30.9.

Table 30.10 shows the per capita debt in the U.S. in from 2014 to 2019 (source statistica.com 54 ).

Table 30.10. U.S. per capita debt
Year 2014 2015 2016 2017 2018 2019
Debt 55905 56513 60505 62174 65697 69064
(a)

Set up a linear system of the form \(A \vx = \vb\) whose least squares solution provides a linear fit to the data.

Solution.

A linear approximation \(f(x) = a_0 + a_1x\) to the system would satisfy the equation \(A \vx = \vb\text{,}\) where \(A = \left[ \begin{array}{cc} 1\amp 2014 \\ 1\amp 2015 \\ 1\amp 2016 \\ 1\amp 2017 \\ 1\amp 2018 \\ 1\amp 2019 \end{array} \right]\text{,}\) \(\vx = \left[ \begin{array}{c} a_0 \\ a_1 \end{array} \right]\text{,}\) and \(\vb = \left[ \begin{array}{c} 55905 \\ 56513 \\ 60505 \\ 62174 \\ 65697 \\ 69064 \end{array} \right]\text{.}\)

(b)

Use technology to approximate a singular value decomposition (round to four decimal places). Use this svd to approximate the pseudoinverse of \(A\text{.}\) Then use this pseudoinverse to approximate the least squares linear approximation to the system.

Solution.

Technology shows that a singular value decomposition of \(A\) is approximately \(U \Sigma V^{\tr}\text{,}\) where

\begin{align*} U \amp = \left[\begin{array}{rrrrrr} 0.4077 \amp 0.5980 \amp -0.3997 \amp -0.3615 \amp -0.3233 \amp -0.2851\\ 0.4079 \amp 0.3589 \amp -0.0621 \amp 0.1880 \amp 0.4381 \amp 0.6882\\ 0.4081 \amp 0.1199 \amp 0.8817 \amp -0.1181 \amp -0.1178 \amp -0.1176\\ 0.4083 \amp -0.1192 \amp -0.1291 \amp 0.8229 \amp -0.2251 \amp -0.2730\\ 0.4085 \amp -0.3582 \amp -0.1400 \amp -0.2361 \amp 0.6677 \amp -0.4285\\ 0.4087 \amp -0.5973 \amp -0.1508 \amp -0.2952 \amp -0.4396 \amp 0.4160 \end{array}\right]\\ \Sigma \amp = \left[\begin{array}{cc} 4939.3984 \amp 0.0\\ 0.0 \amp 0.0021\\ 0.0 \amp 0.0\\ 0.0 \amp 0.0\\ 0.0 \amp 0.0\\ 0.0 \amp 0.0 \end{array}\right]\\ V \amp = \left[\begin{array}{cr} 0.0005 \amp 1.0000\\ 1.0000 \amp -0.0005 \end{array}\right]\text{.} \end{align*}

Thus, with \(\Sigma^+ = \left[ \begin{array}{cccccc} \frac{1}{4939.3984}\amp 0\amp 0\amp 0\amp 0\amp 0 \\ 0\amp \frac{1}{0.0021}\amp 0\amp 0\amp 0\amp 0 \end{array} \right]\text{,}\) we have that the pseudoinverse of \(A\) is approximately

\begin{equation*} A^+ = V \Sigma^+ U^{\tr} = \left[\begin{array}{rrrrrr} 288.2381 \amp 173.0095 \amp 57.7809 \amp -57.4476 \amp -172.6762 \amp -287.9048 \\ -0.14286 \amp -0.0857 \amp -0.0286 \amp 0.02857 \amp 0.0857 \amp 0.14286 \end{array} \right]\text{.} \end{equation*}

So our least squares linear approximation is found by

\begin{equation*} A^{+} \vb = \left[ \begin{array}{r} -5412635.9714 \\ 2714.7429 \end{array} \right]\text{.} \end{equation*}

This makes our least squares linear approximation to be (to four decimal places)

\begin{equation*} f(x) = -5412635.9714 + 2714.7429x\text{.} \end{equation*}
(c)

Calculate \(\left(A^{\tr}A\right)^{-1}A^{\tr}\) directly and compare to the pseudoinverse you found in part (b).

Solution.

Calculating \(\left(A^{\tr}A\right)^{-1}A^{\tr}\) gives the same matrix as \(A^+\text{,}\) so we obtain the same linear approximation.

(d)

Use your approximation to estimate the U.S. per capita debt in 2020.

Solution.

The approximate U.S. per capita debt in 2020 is

\begin{equation*} f(2020) = -5412635.9714 + 2714.7429(2020) = 71144.60\text{.} \end{equation*}

Subsection Summary

  • The condition number of an \(m \times n\) matrix \(A\) is the number \(||A^{-1}|| \ ||A||\text{.}\) The condition number provides a measure of how well the relative error in a calculated value \(\Delta \vb\) predicts the relative error in \(\Delta \vx\) when we are trying to solve a system \(A \vx = \vb\text{.}\)

  • A pseudoinverse \(A^{+}\) of a matrix \(A\) can be found through a singular value decomposition. Let \(U \Sigma V^{\tr}\) be a singular value decomposition of an \(m \times n\) matrix \(A\) of rank \(r\text{,}\) with

    \begin{equation*} \Sigma = \left[ \begin{array}{ccccc|c} \sigma_1\amp \amp \amp \amp \amp \\ \amp \sigma_2\amp \amp 0\amp \amp \\ \amp \amp \sigma_3\amp \amp \amp 0 \\ \amp 0 \amp \amp \ddots \amp \amp \\ \amp \amp \amp \amp \sigma_r \\ \hline \amp \amp 0\amp \amp \amp 0 \end{array} \right] \end{equation*}

    If \(\Sigma^+\) is the \(n \times m\) matrix defined by

    \begin{equation*} \Sigma^{+} = \left[ \begin{array}{ccccc|c} \frac{1}{\sigma_1}\amp \amp \amp \amp \amp \\ \amp \frac{1}{\sigma_2}\amp \amp 0\amp \amp \\ \amp \amp \frac{1}{\sigma_3}\amp \amp \amp 0 \\ \amp 0 \amp \amp \ddots \amp \amp \\ \amp \amp \amp \amp \frac{1}{\sigma_r} \\ \hline \amp \amp 0\amp \amp \amp 0 \end{array} \right]\text{,} \end{equation*}

    then \(A^{+} = V\Sigma^{+}U^{\tr}\text{.}\)

  • A pseudoinverse \(A^{+}\) of a matrix \(A\) acts like an inverse for \(A\text{.}\) So if we can't solve a matrix equation \(A \vx = \vb\) because \(\vb\) isn't in \(\Col A\text{,}\) we can use the pseudoinverse of \(A\) to “solve” the equation \(A \vx = \vb\) with the “solution” \(A^+ \vb\text{.}\) While not an exact solution, \(A^+ \vb\) turns out to be the best approximation to a solution in the least squares sense.

Exercises Exercises

1.

Let \(A = \left[ \begin{array}{rcc} 20\amp 4\amp 32 \\ -4\amp 4\amp 2 \\ 35\amp 22\amp 26 \end{array} \right]\text{.}\) Then \(A\) has singular value decomposition \(U \Sigma V^{\tr}\) , where

\begin{align*} U \amp = \frac{1}{5}\left[ \begin{array}{crc} 3\amp 4\amp 0\\ 0\amp 0\amp 5\\ 4\amp -3\amp 0 \end{array} \right]\\ \Sigma \amp = \left[ \begin{array}{crc} 60\amp 0\amp 0\\ 0\amp 15\amp 0\\ 0\amp 0\amp 6 \end{array} \right]\\ V \amp = \frac{1}{3}\left[ \begin{array}{crr} 2\amp -1\amp -2\\ 1\amp -2\amp 2\\ 2\amp 2\amp 1 \end{array} \right]\text{.} \end{align*}
(a)

What are the singular values of \(A\text{?}\)

(b)

Write the outer product decomposition of \(A\text{.}\)

(c)

Find the best rank 1 approximation to \(A\text{.}\) What is the relative error in approximating \(A\) by this rank 1 matrix?

(d)

Find the best rank 2 approximation to \(A\text{.}\) What is the relative error in approximating \(A\) by this rank 2 matrix?

2.

Let \(A = \left[ \begin{array}{ccrr} 861\amp 3969\amp 70\amp 140 \\ 3969\amp 861\amp 70\amp 140 \\ 3969\amp 861\amp -70\amp -140 \\ 861\amp 3969\amp -70\amp -140 \end{array} \right]\text{.}\)

(a)

Find a singular value decomposition for \(A\text{.}\)

(b)

What are the singular values of \(A\text{?}\)

(c)

Write the outer product decomposition of \(A\text{.}\)

(d)

Find the best rank 1, 2, and 3 approximations to \(A\text{.}\) How much information about \(A\) does each of these approximations contain?

3.

Assume that the number of feet traveled by a batted baseball at various angles in degrees (all hit at the same bat speed) is given in Table 30.11.

Table 30.11. Distance traveled by batted ball
Angle \(10^{\circ}\) \(20^{\circ}\) \(30^{\circ}\) \(40^{\circ}\) \(50^{\circ}\) \(60^{\circ}\)
Distance 116 190 254 285 270 230
(a)

Plot the data and explain why a quadratic function is likely a better fit to the data than a linear function.

(b)

Find the least squares quadratic approximation to this data. Plot the quadratic function on same axes as your data.

(c)

At what angle (or angles), to the nearest degree, must a player bat the ball in order for the ball to travel a distance of 220 feet?

4.

How close can a matrix be to being non-invertible? We explore that idea in this exercise. Let \(A = [a_{ij}]\) be the \(n \times n\) upper triangular matrix with 1s along the diagonal and with every other entry being \(-1\text{.}\)

(a)

What is \(\det(A)\text{?}\) What are the eigenvalues of \(A\text{?}\) Is \(A\) invertible?

(b)

Let \(B = [b_{ij}]\) be the \(n \times n\) matrix so that \(b_{n1} = -\frac{1}{2^{n-2}}\) and \(b_{ij} = a_{ij}\) for all other \(i\) and \(j\text{.}\)

(i)

For the matrix \(B\) with \(n=3\text{,}\) show that the equation \(B \vx = \vzero\) has a non-trivial solution. Find one non-trivial solution.

(ii)

For the matrix \(B\) with \(n=4\text{,}\) show that the equation \(B \vx = \vzero\) has a non-trivial solution. Find one non-trivial solution.

(iii)

Use the pattern established in parts (i.) and (ii.) to find a non-trivial solution to the equation \(B \vx = \vzero\) for an arbitrary value of \(n\text{.}\) Be sure to verify that you have a solution. Is \(B\) invertible?

Hint.

For any positive integer \(m\text{,}\) the sum \(1+\sum_{k=0}^{m-1} 2^k\) is the partial sum of a geometric series with ratio \(2\) and so \(1+\sum_{k=0}^{m-1} 2^k = 1+\frac{1-2^m}{1-2} = 2^m\text{.}\)

(iv)

Explain why \(B\) is not an invertible matrix. Notice that \(A\) and \(B\) differ by a single entry, and that \(A\) is invertible and \(B\) is not. Let us examine how close \(A\) is to \(B\text{.}\) Calculate \(|| A - B ||_F\text{?}\) What happens to \(||A - B||_F\) as \(n\) goes to infinity? How close can an invertible matrix be to becoming non-invertible?

5.

Let \(A = \left[ \begin{array}{crr} 1\amp 0\amp 0 \\ 0\amp 1\amp -1 \\ 0\amp -1\amp 1 \end{array} \right]\text{.}\) In this exercise we find a matrix \(B\) so that \(B^2 = A\text{,}\) that is, find a square root of the matrix \(A\text{.}\)

(a)

Find the eigenvalues and corresponding eigenvectors for \(A\) and \(A^{\tr}A\text{.}\) Explain what you see.

(b)

Find a matrix \(V\) that orthogonally diagonalizes \(A^{\tr}A\text{.}\)

(c)

Exercise 8 in Section 29 shows if \(U \Sigma V^{\tr}\) is a singular value decomposition for a symmetric matrix \(A\text{,}\) then so is \(V \Sigma V^{\tr}\text{.}\) Recall that \(A^n = \left(V \Sigma V^{\tr}\right)^n = V \Sigma^n V^{\tr}\) for any positive integer \(n\text{.}\) We can exploit this idea to define \(\sqrt{A}\) to be the matrix

\begin{equation*} V \Sigma^{1/2}V^{\tr}\text{,} \end{equation*}

where \(\Sigma^{1/2}\) is the matrix whose diagonal entries are the square roots of the corresponding entries of \(\Sigma\text{.}\) Let \(B = \sqrt{A}\text{.}\) Calculate \(B\) and show that \(B^2 = A\text{.}\)

(d)

Why was it important that \(A\) be a symmetric matrix for this process to work, and what had to be true about the eigenvalues of \(A\) for this to work?

(e)

Can you extend the process in this exercise to find a cube root of \(A\text{?}\)

6.

Let \(A\) be an \(m \times n\) matrix with singular value decomposition \(U \Sigma V^{\tr}\text{.}\) Let \(A^{+}\) be defined as in (30.10). In this exercise we prove the remaining parts of Theorem 30.6.

(a)

Show that \((AA^{+})^{\tr} = AA^{+}\text{.}\)

Hint.

\(\Sigma \Sigma^+\) is a symmetric matrix.

(b)

Show that \((A^{+}A)^{\tr} = A^{+}A\text{.}\)

7.

In this exercise we show that the pseudoinverse of a matrix is the unique matrix that satisfies the Moore-Penrose conditions. Let \(A\) be an \(m \times n\) matrix with singular value decomposition \(U \Sigma V^{\tr}\) and pseudoinverse \(X = V\Sigma^{+}U^{\tr}\text{.}\) To show that \(A^{+}\) is the unique matrix that satisfies the Moore-Penrose conditions, suppose that there is another matrix \(Y\) that also satisfies the Moore-Penrose conditions.

(a)

Show that \(X = YAX\text{.}\)

Hint.

Use the fact that \(X= XAX\text{.}\)

(b)

Show that \(Y = YAX\text{.}\)

Hint.

Use the fact that \(Y= YAY\text{.}\)

(c)

How do the results of parts (a) and (b) show that \(A^{+}\) is the unique matrix satisfying the Moore-Penrose conditions?

Hint.

Compare the results of (a) and (b).

8.

Find the pseudoinverse of the \(m \times n\) zero matrix \(A=0\text{.}\) Explain the conclusion.

9.

In all of the examples that we have done finding a singular value decomposition of a matrix, it has been the case (though we haven't mentioned it), that if \(A\) is an \(m \times n\) matrix, then \(\rank(A) = \rank\left(A^{\tr}A\right)\text{.}\) Prove this result.

10.

Label each of the following statements as True or False. Provide justification for your response.

(a) True/False.

A matrix has a pseudo-inverse if and only if the matrix is singular.

(b) True/False.

The pseudoinverse of an invertible matrix \(A\) is the matrix \(A^{-1}\text{.}\)

(c) True/False.

If the columns of \(A\) are linearly dependent, then there is no least squares solution to \(A\vx = \vb\text{.}\)

(d) True/False.

If the columns of \(A\) are linearly independent, then there is a unique least squares solution to \(A\vx = \vb\text{.}\)

(e) True/False.

If \(T\) is the matrix transformation defined by a matrix \(A\) and \(S\) is the matrix transformation defined by \(A^{+}\text{,}\) then \(T\) and \(S\) are inverse transformations.

Subsection Project: GPS and Least Squares

In this project we discuss some of the details about how the GPS works. The idea is based on intersections of spheres. To build a basic understanding of the system, we begin with a 2-dimensional example.

Project Activity 30.11.

Suppose that there are three base stations \(A\text{,}\) \(B\text{,}\) and \(C\) in \(\R^2\) that can send and receive signals from your mobile phone. Assume that \(A\) is located at point \((-1,-2)\text{,}\) \(B\) at point \((36,5)\text{,}\) and \(C\) at point \((16,35)\text{.}\) Also assume that your mobile phone location is point \((x,y)\text{.}\) Based on the time that it takes to receive the signals from the three base stations, it can be determined that your distance to base station \(A\) is \(28\) km, your distance to base station \(B\) is \(26\) km, and your distance to base station \(C\) is \(14\) km using a coordinate system with measurements in kilometers based on a reference point chosen to be \((0,0)\text{.}\) Due to limitations on the measurement equipment, these measurements all contain some unknown error which we will denote as \(z\text{.}\) The goal is to determine your location in \(\R^2\) based on this information.

If the distance readings were accurate, then the point \((x,y)\) would lie on the circle centered at \(A\) of radius \(29\text{.}\) The distance from \((x,y)\) to base station \(A\) can be represented in two different ways: \(28\) km and \(\sqrt{(x+1)^2 + (y+2)^2}\text{.}\) However, there is some error in the measurements (due to the receiver clock and satellite clocks not being snychronized), so we really have

\begin{equation*} \sqrt{(x+1)^2 + (y+2)^2} + z = 28\text{,} \end{equation*}

where \(z\) is the error. Similarly, \((x,y)\) must also satisfy

\begin{equation*} \sqrt{(x-36)^2 + (y-5)^2} + z = 26 \end{equation*}

and

\begin{equation*} \sqrt{(x-16)^2 + (y-35)^2} + z = 14\text{.} \end{equation*}
(a)

Explain how these three equations can be written in the equivalent form

\begin{align} (x+1)^2+(y+2)^2\amp =(28-z)^2\tag{30.11}\\ (x-36)^2 + (y-5)^2 \amp = (26-z)^2\tag{30.12}\\ (x-16)^2 + (y-35)^2 \amp = (14-z)^2\text{.}\tag{30.13} \end{align}

Figure 30.12. Intersections of circles.

(b)

If all measurements were accurate, your position would be at the intersection of the circles centered at \(A\) with radius \(28\) km, centered at \(B\) with radius \(26\) km, and centered at \(C\) with radius \(14\) km as shown in Figure 30.12. Even though the figure might seem to imply it, because of the error in the measurements the three circles do not intersect in one point. So instead, we want to find the best estimate of a point of intersection that we can. The system of equations (30.11), (30.12), and (30.13) is non-linear and can be difficult to solve, if it even has a solution. To approximate a solution, we can linearize the system. To do this, show that if we subtract corresponding sides of equation (30.11) from (30.12) and expand both sides, we can obtain the linear equation

\begin{equation*} 37x + 7y + 2z = 712 \end{equation*}

in the unknowns \(x\text{,}\) \(y\text{,}\) and \(z\text{.}\)

(c)

Repeat the process in part (b), subtracting (30.11) from (30.13) and show that we can obtain the linear equation

\begin{equation*} 17x + 37y + 14z = 1032 \end{equation*}

in \(x\text{,}\) \(y\text{,}\) and \(z\text{.}\)

(d)

We have reduced our system of three non-linear equations to the system

\begin{alignat*}{4} {37}x \amp {}+{} \amp {7}y \amp {}+{} \amp {2}z \amp = \amp {} \amp 712\\ {17}x \amp {}+{} \amp {37}y \amp {}+{} \amp {14}z \amp = \amp {} \amp 1032 \end{alignat*}

of two linear equations in the unknowns \(x\text{,}\) \(y\text{,}\) and \(z\text{.}\) Use technology to find a pseudoinverse of the coefficient matrix of this system. Use the pseudoinverse to find the least squares solution to this system. Does your solution correspond to an approximate point of intersection of the three circles?

Project Activity 30.11 provides the basic idea behind GPS. Suppose you receive a signal from a GPS satellite. The transmission from satellite \(i\) provides four pieces of information — a location \((x_i,y_i,z_i)\) and a time stamp \(t_i\) according to the satellite's atomic clock. The time stamp allows the calculation of the distance between you and the \(i\)th satellite. The transmission travel time is calculated by subtracting the current time on the GPS receiver from the satellite's time stamp. Distance is then found by multiplying the transmission travel time by the rate, which is the speed of light \(c=299792.458\) km/s. 55  So distance is found as \(c(t_i-d)\text{,}\) where \(d\) is the time at the receiver. This signal places your location within in a sphere of that radius from the center of the satellite. If you receive a signal at the same time from two satellites, then your position is at the intersection of two spheres. As can be seen at left in Figure 30.13, that intersection is a circle. So your position has been narrowed quite a bit. Now if you receive simultaneous signals from three spheres, your position is narrowed to the intersection of three spheres, or two points as shown at right in Figure 30.13. So if we could receive perfect information from three satellites, then your location would be exactly determined.

Figure 30.13. Intersections of spheres.

There is a problem with the above analysis — calculating the distances. These distances are determined by the time it takes for the signal to travel from the satellite to the GPS receiver. The times are measured by the clocks in the satellites and the clocks in the receivers. Since the GPS receiver clock is unlikely to be perfectly synchronized with the satellite clock, the distance calculations are not perfect. In addition, the rate at which the signal travels can change as the signal moves through the ionosphere and the troposphere. As a result, the calculated distance measurements are not exact, and are referred to as pseudoranges. In our calculations we need to factor in the error related to the time discrepancy and other factors. We will incorporate these errors into our measure of \(d\) and treat \(d\) as an unknown. (Of course, this is all more complicated that is presented here, but this provides the general idea.)

To ensure accuracy, the GPS uses signals from four satellites. Assume a satellite is positioned at point \((x_1,y_1,z_1)\) at a distance \(d_1\) from the GPS receiver located at point \((x,y,z)\text{.}\) The distance can also be measured in two ways: as

\begin{equation*} \sqrt{(x-x_1)^2+(y-y_1)^2+(z-z_1)^2}\text{.} \end{equation*}

and as \(c(t_1-d)\text{.}\) So

\begin{equation*} c(t_1-d) = \sqrt{(x-x_1)^2 + (y-y_1)^2 + (z-z_1)^2}\text{.} \end{equation*}

Again, we are treating \(d\) as an unknown, so this equation has the four unknowns \(x\text{,}\) \(y\text{,}\) \(z\text{,}\) and \(d\text{.}\) Using signals from four satellites produces the system of equations

\begin{align} \sqrt{(x-x_1)^2 + (y-y_1)^2 + (z-z_1)^2} \amp = c(t_1-d)\tag{30.14}\\ \sqrt{(x-x_2)^2 + (y-y_2)^2 + (z-z_2)^2} \amp = c(t_2-d)\tag{30.15}\\ \sqrt{(x-x_3)^2 + (y-y_3)^2 + (z-z_3)^2} \amp = c(t_3-d)\tag{30.16}\\ \sqrt{(x-x_4)^2 + (y-y_4)^2 + (z-z_4)^2} \amp = c(t_4-d)\text{.}\tag{30.17} \end{align}

Project Activity 30.12.

The system of equations (30.14), (30.15), (30.16), and (30.17) is a non-linear system and is difficult to solve, if it even has a solution. We want a method that will provide at least an approximate solution as well as apply if we use more than four satellites. We choose a reference node (say \((x_1, y_1, z_1)\)) and make calculations relative to that node as we did in Project Activity 30.11.

(a)

First square both sides of the equations (30.14), (30.15), (30.16), and (30.17) to remove the roots. Then subtract corresponding sides of the new first equation (involving \((x_1,y_1,z_1)\)) from the new second equation (involving \((x_2,y_2,z_2)\)) to show that we can obtain the linear equation

\begin{equation*} 2(x_2-x_1)x + 2(y_2-y_1)y + 2(z_2-z_1)z + 2c^2(t_1-t_2)d = c^2(t_1^2-t_2^2) - h_1 +h_2\text{,} \end{equation*}

where \(h_i = x_i^2 + y_i^2 + z_i^2\text{.}\) (Note that the unknowns are \(x\text{,}\) \(y\text{,}\) \(z\text{,}\) and \(d\) — all other quantities are known.)

(b)

Use the result of part (a) to write a linear system that can be obtained by subtracting the first equation from the third and fourth equations as well.

(c)

The linearizations from part (b) determine a system \(A \vx = \vb\) of linear equations. Identify \(A\text{,}\) \(\vx\text{,}\) and \(\vb\text{.}\) Then explain how we can approximate a best solution to this system in the least squares sense.

We conclude this project with a final note. At times a GPS receiver may only be able to receive signals from three satellites. In these situations, the receiver can substitute the surface of the Earth as a fourth sphere and continue the computation.

For example, as stated in http://www2.imm.dtu.dk/~pch/Projekter/tsvd.html, “The SVD [singular value decomposition] has also applications in digital signal processing, e.g., as a method for noise reduction. The central idea is to let a matrix \(A\) represent the noisy signal, compute the SVD, and then discard small singular values of \(A\text{.}\) It can be shown that the small singular values mainly represent the noise, and thus the rank-\(k\) matrix \(A_k\) represents a filtered signal with less noise.”
Theorem 30.6 is often given as the definition of a pseudoinverse.
statista.com/statistics/203064/national-debt-of-the-united-states-per-capita/
The signals travel in radio waves, which are electromagnetic waves, and travel at the speed of light. Also, \(c\) is the speed of light in a vacuum, but atmosphere is not too dense so we assume this value of \(c\)