A.14  Linear Algebra

A.14.1  Inner products and norms

In general, a norm is a function f (also denoted as ∥⋅∥) that takes a vector x and outputs a non-negative real number y +. The norm y is often interpreted as the distance between x and the adopted origin. A norm can be defined for any real or complex vector space, and the vector x will belong to this adopted vector space. For example, assuming the Euclidean space and a vector x = [x1,x2,,xD] with real-valued elements, the so-called L2 norm is denoted as x2 = x1 2 + x2 2 + + xD 2.

Another useful norm is the Manhattan norm x1 = |x1| + |x2| + + |xD|, also known as the L1 norm, which correspond to the sum of the absolute values of the elements in vector x.

A third common norm is the maximum norm x = max {|x1|,|x2|, ,|xD|}, also known as the infinity norm or Chebyshev norm, which measures the maximum distance along any dimension of the vector. For example, the maximum norm of x = [3,10,20] is x = 20.

To be a valid norm, the function ∥⋅∥ needs to have some fundamental properties: a) x 0; b) if x = 0 then x is the zero vector; c) αx = |α|x and d) (triangle inequality) x + yx + y.

The inner product in a K-dimensional space with complex-valued vectors is:

a,b = i=1Ka ibi = a bcos (𝜃).
(A.32)

See Table 2.2 for alternative definitions of inner products.

When a = b, Eq. (A.32) can be written as

a = a , a .
(A.33)

An inner product a,b can also be written as a multiplication of two vectors

a,b = bHa,
(A.34)

where in this case both are assumed to be column vectors (row vectors would suggest abH).

In case a vector b = Aa is obtained via multiplication by a unitary matrix A, Eq. (A.33) and Eq. (A.34) lead to

b = A a , A a = (A a )H A a = a H A H A a = a H I a = a
(A.35)

because AHA = I, which indicates that the unitary A does not alter the norm of the input vector.

A.14.2  Projection of a vector using inner product

To explore the properties and advantages of linear transforms, it is useful to study the vector projection (or simply projection) of a vector onto another one.

PIC

Figure A.2: The perpendicular line for obtaining the projection pxy of a vector x onto y in 2. Note that 𝜃 = cos 1(x,y(xy) is the angle between x and y and the inner product x,y = pxyy = pyxx.

Using 2 for simplicity, note that the projection pxy of a vector x in another vector y is obtained by choosing the point along the direction of y that has the minimum distance to x. This line is perpendicular to y, as indicated in Figure A.2. Using the Pythagorean theorem and assuming that 0 𝜃 π2, the norm pxy of the projection can be written as pxy = xcos (𝜃). If π2 < 𝜃 π, pxy = xcos (π 𝜃) = xcos (𝜃). Hence, in general,

pxy = x |cos (𝜃)| = |x,y| y .
(A.36)

For a given norm y, the larger the inner product, the larger the norm of the projection. The same is valid for pyx as depicted in Figure A.3:

pyx = y |cos (𝜃)| = |x,y| x .

PIC

Figure A.3: Projections of a vector x and y onto each other. Note the errors are orthogonal to the directions of the respective projections.

Any vector z can be written as its norm z multiplied by a unity norm vector zz that indicates its direction. Note that the vector pyx is in the same or the opposite direction of x, which can be specified by the unity norm vector sign(cos (𝜃)) xx . Hence, one has

pyx = pyxsign(cos (𝜃)) x x = (x,y x2 ) x,

where x,y ||x||2 is a scaling factor that can be negative but does not change the direction of x. Similarly, the projection pxy of x onto y is given by

pxy = (x,y y2 ) y.

Note that if the vector y has unitary norm, the absolute value of the inner product x,y coincides with the norm pxy. These expressions are valid for other vector spaces, such as n, n > 2.

Using geometry to interpret a projection vector is very useful. When one projects x in y, the result pxy is the “best” representation (in the minimum distance sense, or least-square sense) of x that y alone can provide. The error vector exy = x pxy is orthogonal to y (and, consequently, to pxy), i. e., exy,y = 0. The vector exy represents what should be added to pxy in order to completely represent x, and the orthogonality exy,y = 0 indicates that y cannot contribute any further.

Figure A.3 completes the example. It was obtained using the following Matlab/Octave script.1 The example assumes x = [2,2] and y = [5,1], having an angle 𝜃 of approximately 33.7 degrees between them.

Listing A.1: MatlabOctaveCodeSnippets/snip_transforms_projection.m
1x=[2,2]; %define a vector x 
2y=[5,1]; %define a vector y 
3magx=sqrt(sum(x.*x))%magnitude of x 
4magy=sqrt(sum(y.*y))%magnitude of y 
5innerprod=sum(x.*y) %<x,y>=||x|| ||y|| cos(theta) 
6theta=acos(innerprod / (magx*magy)) %angle between x and y 
7%obs: could use acosd to have angle in degrees 
8disp(['Angle is ' num2str(180*theta/pi) ' degrees']); 
9%check if inverting direction is needed: 
10invertDirection=1; if theta>pi/2 invertDirection=-1; end 
11%find the projection of x over y (called p_xy) and p_yx 
12mag_p_xy = magx*abs(cos(theta)) %magnitude of p_xy 
13%directions: obtained as y normalized by magy, x by magx 
14y_unitary=y/magy; %normalize y by magy to get unitary vec. 
15p_xy = mag_p_xy * y_unitary* invertDirection %p_xy 
16mag_p_yx = magy*abs(cos(theta)); %magnitude of p_yx 
17x_unitary=x/magx; %normalize x by magx to get unitary vec. 
18p_yx = mag_p_yx * x_unitary* invertDirection %p_yx 
19%test orthogonality of error vectors: 
20error_xy = x - p_xy; %we know: p_xy + error_xy = x 
21sum(error_xy.*y) %this inner product should be zero 
22error_yx = y - p_yx; %we know: p_yx + error_yx = y 
23sum(error_yx.*x) %this inner product should be zero
  

The concept of projections via inner products will be extensively used in our discussion about transforms. For example, the coefficients of a Fourier series of a signal x(t) correspond to the normalized projections of x(t) on the corresponding basis functions. A large value for the norm of a projection indicates that the given basis function provides a good contribution in the task of representing x(t).

Chapter 2 discusses block transforms and relies on orthogonal functions. Hence, it is useful to discuss why orthogonality is important.

A.14.3  Orthogonal basis allows inner products to transform signals

Assume the existence of a set of orthogonal vectors composing the basis of a vector space. For example, in 2, a convenient basis is the standard, composed by i¯ = [1,0] and j¯ = [0,1]. The inner product i¯,j¯ = 0 indicates that these two vectors are orthogonal. The orthogonality property simplifies the following analysis task: given any vector x, the coefficients α and β of the linear combination x = αi¯ + βj¯, can be easily found by using the dot products α = x,i¯ and β = x,j¯. The following theorem proves this important result.

Theorem 4. Analysis via inner products. If the basis set {b1,,bN} of an inner product space (e. g., Euclidean) is orthonormal, the coefficients of a linear combination x = i=1Nαibi that generates a vector x can be calculated by the inner product αi = x,bi between x and the respective vector bi in the basis set.

Proof: Recall the following properties of a dot product: a¯ + b¯,c¯ = a¯,c¯ + b¯,c¯ and αa¯,b¯ = αa¯,b¯ and write

x,bj = i=1Nα ibi,bj = i=1Nα ibi,bj

because the basis vectors are orthonormal, bi,bj = 1 if i = j and bi,bj = 0 if ij. Therefore,

x,bj = αj.

because all the terms in the above summation are zero but the one for i = j.   

Example A.1. Obtaining the coefficients of a linear combination of basis functions. A simple example can illustrate the analysis procedure: the coefficients of x = 4i¯ + 8j¯ are α = 4 and β = 8 by inspection, but they could be calculated as α = x,i¯ = [4,8],[1,0] = 4 and β = x,j¯ = [4,8],[0,1] = 8. Note that the zeros in these basis vectors make the calculation overly simple. Another example may be more useful to highlight orthogonality and the following alternative basis set is assumed: i¯ = [0.5,0.866] and j¯ = [0.866,0.5]. Let x = 3i¯ + 2j¯ = [3.232,1.5980]. Given x, the task is again to find the coefficients such that x = αi¯ + βj¯. Due to the orthonormality of i¯ and j¯, one can for example obtain α = x,i¯ = [3.232,1.5980],[0.5,0.866] = 3. These computations can be done in Matlab/Octave as follows.

1i=[0.5,0.866], j=[0.866 -0.5] %two orthonormal vectors 
2x=3*i+2*j %create an arbitrary vector x to be analyzed 
3alpha=sum(x.*i), beta=sum(x.*j) %find inner products

In contrast, let us modify the previous example, adopting a non orthogonal basis. Assume that i¯ = [1,1] and j¯ = [0,1] (note that i¯,j¯ = 1, hence the vectors are not orthogonal). Let x = 3i¯ + 2j¯ = [3,5]. In this case, x,i¯ = 8 and x,j¯ = 5, which do not coincide with the coefficients α = 3 and β = 2. How could the coefficients be properly recovered in this case? An alternative is to write the problem as a set of linear equations, organize it in matrix notation and find the coefficients by inverting the matrix. In Matlab/Octave:

Listing A.2: MatlabOctaveCodeSnippets/snip_transforms_non_orthogonal_basis.m
1i=transpose([1,1]), j=transpose([0,1]) %non-orthogonal 
2x=3*i+2*j %create an arbitrary vector x to be analyzed 
3A=[i j]; %organize basis vectors as a matrix 
4temp=inv(A)*x; alpha=temp(1), beta=temp(2) %coefficients
  

In summary, the analysis procedure for many linear transforms (such as Fourier, Z, etc.) obtain the coefficients via an inner product, and the procedure can be interpreted as calculating the projection of x onto basis i¯ (eventually scaled by the norm of i¯).   

This discussion leads to the conclusion that a basis with orthogonal vectors significantly simplifies the task: in this case, the analysis procedure can be done via inner products. This applies when the basis vectors do not have unitary-norm, but in this case a normalization by their norms is needed. Orthogonal basis vectors are a property of all block transforms discussed in this text.

A.14.4  Moore-Penrose pseudoinverse

Pseudoinverses2 are generalizations of the inverse matrix and are useful when the given matrix does not have an inverse (for example, when the matrix is not square or full rank).

The Moore-Penrose pseudoinverse has several interesting properties and is adequate to least square problems. It provides the minimum-norm least squares solution z = Xb to the problem of finding a vector z that minimizes the error vector norm ||Xz b||. Assuming X is an m × n matrix, the pseudoinverse provides the solution for a set of overdetermined or underdetermined equations if m > n or m < n, respectively.

Two properties of a Moore-Penrose pseudoinverse X+ are

XH = XHXX+,
(A.37)

and

XH = X+XXH.
(A.38)

With r being the rank of X, then:

Whenever available, instead of Eq. (A.39) or Eq. (A.40) that requires linear independence, one should use a robust method to obtain X+ such as the pinv function in Matlab/Octave, which adopts a SVD decomposition to calculate X+. Listing A.3 illustrates such calculations and the convenience of relying on pinv when the independence of rows or columns is not guaranteed.

Listing A.3: MatlabOctaveCodeSnippets/snip_systems_pseudo_inverse.m
1test=3; %choose the case below 
2switch test 
3    case 1 %m>n (overdetermined/tall) and linearly indepen. columns 
4        X=[1 2 3; -4+1j -5+1j -6+1j;1 0 0;0 1 0]; %4 x 3 
5    case 2 %n>m (underdetermined/fat) and linearly independent rows 
6        X=[1 2 3; -4+1j -5+1j -6+1j]; %2 x 3 
7    case 3 %neither rows nor columns of X are linearly independent 
8        %rows X(2,:)=2*X(1,:) and columns X(:,4)=3*X(:,1) 
9        X=[1 2 3 3; 2 4 6 6; -4+1j -5+1j -6+1j -12+3*1j]; %3 x 4 
10end 
11Xp_svd = pinv(X) %pseudoinverse via SVD decomposition 
12Xp_over = inv(X'*X)*X' %valid when columns are linearly independent 
13Xp_under = X'*inv(X*X') %valid when rows are linearly independent 
14rank(X'*X) %X'*X is square but may not be full rank 
15rank(X*X') %X*X' is square but may not be full rank 
16Xhermitian=X'*X*pinv(X) %equal to X' (this property is always valid) 
17Xhermitian2=pinv(X)*X*X' %equal to X' (the property itself is valid) 
18maxError_over=max(abs(Xp_svd(:)-Xp_over(:))) %error for overdetermin. 
19maxError_under=max(abs(Xp_svd(:)-Xp_under(:))) %for underdetermined