An Invitation to 3-D Vision: Appendix A
Algebra is very generous: she often gives more than is asked for.
Jean d'Alembert
We assume that the reader already has basic training in linear algebra. This appendix provides a brief review of some of the important facts that are used in this book. For a more complete introduction, the reader should resort to a book such as [Strang, 1988].
In this book, we deal mostly with finite-dimensional (typically two-, three-, or four-dimensional) linear spaces, which are also often called linear vector spaces. For generality, we consider the linear space to be -dimensional. A linear space is typically denoted by the letter (for "vector space"). Although most of the time we will deal with vectors of real numbers , occasionally, we will encounter vectors of complex numbers . For simplicity, our review will be conducted for linear spaces over the field of real numbers with the understanding that most definitions and results generalize to the complex case with little change.
Definition A. 1 (A linear space or a vector space). A set (of vectors) is considered a linear space over the field if its elements, called vectors, are closed under two basic operations: scalar multiplication and vector summation "+." That is, given any two vectors and any two scalars , the linear combination is also a vector in . Furthermore, the addition is commutative and associative, it has an identity 0, and each element has an inverse,"-v," such that . The scalar multiplication respects the structure of ; i.e. and . The addition and scalar multiplication are related by the distributive laws: and .
Some familiarity with the numerical software Matlab is also encouraged.
For instance, the eigenvalues or eigenvectors of a real matrix could be complex.
For example, is a linear space over the field of real numbers . To be consistent, we always use a column to represent a vector:
where means "the (row) vector transposed." Given two scalars and two vectors and , their linear combination is a componentwise summation weighted by and :
A.1 Basic notions associated with a linear space
We will now provide a brief review of basic notions and frequently used notation associated with a linear vector space (i.e. ).
A.1.1 Linear independence and change of basis
Definition A. 2 (Subspace). A subset of a linear space is called a subspace if the zero vector 0 is in and for all and .
Definition A. 3 (Spanned subspace). Given a set of vectors , the subspace spanned by is the set of all finite linear combinations for all . This subspace is usually denoted by .
For example, the two vectors and span a subspace of whose vectors are of the general form .
Definition A. 4 (Linear independence). A set of vectors is linearly independent if the equation
implies
On the other hand, a set of vectors is said to be linearly dependent if there exist not all zero such that
Definition A. 5 (Basis). A set of vectors of a linear space is said to be a basis if is a linearly independent set and spans the entire space ; i.e. .
Fact A. 6 (Properties of a basis). Suppose and are two bases for a linear space . Then:
and contain exactly the same number of linearly independent vectors. This number, say , is the dimension of the linear space .
Let and . Then each basis vector of can be expressed as a linear combination of those in ; i.e.
for some .
- Any vector can be written as a linear combination of vectors in either of the bases:
where the coefficients and are uniquely determined and are called the coordinates of with respect to each basis.
In particular, if and are two bases for the linear space , we may put the basis vectors as columns of two matrices and also call them and , respectively:
Then we can express the relationship between them in the matrix form as
The role of the matrix is to transform one basis to the other . Since such a transformation can go the opposite way, the matrix must be invertible. So we can also write .
If is a vector in , it can be expressed in terms of linear combinations of either basis as
Thus, we have
Since the coordinates of with respect to are unique, we obtain the following transformation of coordinates of a vector from one basis to the other:
Let and denote the two coordinate vectors. We may summarize in matrix form the relationships between two bases and coordinates with respect to the bases as
Be aware of the difference in transforming bases from transforming coordinates!
A.1.2 Inner product and orthogonality
Definition A. 7 (Inner product). A function
is an inner product if
,
, and .
For each vector is called its norm.
The inner product is also called a metric, since it can be used to measure length and angles.
For simplicity, a standard basis is often chosen for the vector space as the set of vectors
The matrix with these vectors as columns is exactly the identity matrix.
In some literature, an inner product is also called a dot product, denoted by . However, in this book, we will not use that name.
Definition A. 8 (Canonical inner product on ). Given any two vectors and in , we define the canonical inner product to be
This inner product induces the standard 2-norm, or Euclidean norm, , which measures the length of each vector as
Notice that if we choose another basis related to the above standard basis as , then the coordinates of the vectors related to the new basis are and , respectively, and they relate to by and . The inner product in terms of the new coordinates becomes
We denote this expression of the inner product with respect to the new basis by
This is called an induced inner product from the matrix . Knowing the matrix , we can compute the canonical inner product directly using coordinates with respect to the nonstandard basis .
Definition A. 9 (Orthogonality). Two vectors are said to be orthogonal if their inner product is zero: . This is often indicated as .
A.1.3 Kronecker product and stack of matrices
Definition A. 10 (Kronecker product of two matrices). Given two matrices and , their Kronecker product, denoted by , is a new matrix
If and are two vectors, i.e. , the product is also a vector but of dimension .
In Matlab, one can easily compute the Kronecker product by using the command .
Definition A. 11 (Stack of a matrix). Given an matrix , the stack of the matrix is a vector, denoted by , in obtained by stacking its column vectors, say , in order:
As mutually inverse operations, is called "stacked," and is called "unstacked."
The Kronecker product and stack of matrices together allow us to rewrite algebraic equations that involve multiple vectors and matrices in many different but equivalent ways. For instance, the equation
for two vectors and a matrix of proper dimensions can be rewritten as
The second equation is particularly useful when is the only unknown in the equation.
A.2 Linear transformations and matrix groups
Linear algebra studies the properties of the linear transformations, or linear maps, between different linear spaces. Since such transformations can be represented as matrices, linear algebra to a large extent studies the properties of matrices.
Definition A. 12 (Linear transformation). A linear transformation from a linear (vector) space to is defined as a map such that
;
.
With respect to the standard bases of and , the map can be represented by a matrix such that
The th column of the matrix is then nothing but the image of the standard basis vector under the map ; i.e.
The set of all (real) matrices is denoted by . When viewed as a linear space, can be identified as the space . When there is little ambiguity, we refer to a linear map by its matrix representation . If , the set forms an algebraic structure called a ring (over the field ). That is, matrices in are closed under both matrix multiplication and summation: If are two matrices, so are and .
Linear maps or matrices that we encounter in computer vision often have a special algebraic structure called a group.
Definition A. 13 (Group). A group is a set with an operation " " on the elements of that:
is closed : If , then also ;
is associative: , for all ;
has a unit element , for all ;
is invertible: For every element , there exists an element such that .
Definition A. 14 (The general linear group ). The set of all nonsingular (real) matrices with matrix multiplication forms a group. Such a group of matrices is usually called the general linear group and denoted by .
Definition A. 15 (Matrix representation of a group). A group has a matrix representation or can be realized as a matrix group if there exists an injective
which preserves the group structure of . That is, the inverse and composition of elements in are preserved by the map in the following way:
Below, we identify a few important subsets of that have special algebraic structures (as examples of matrix groups) and nice properties.
The group itself can be identified as the set of all invertible linear transformations from to in the sense that for every , we obtain a linear map
Notice that if , then so is its inverse: . We know that an matrix is invertible if and only if its determinant is nonzero. Therefore, we have
The general linear group, when matrices are considered to be known only up to a scalar factor, , is referred to as the projective transformation group, whose elements are called projective matrices or homographies.
map is called injective if as long as .
Such a map is called a group homomorphism in algebra.
Matrices in of determinant +1 form a subgroup called the special linear group, denoted by . That is, for all . It is easy to verify that if , then so is , since .
Definition A. 16 (The affine group ). An affine transformation from to is defined jointly by a matrix and a vector such that
The set of all such affine transformations is called the affine group of dimension and is denoted by .
Notice that the map so-defined is not a linear map from to unless . Nevertheless, we may "embed" this map into a space one dimension higher so that we can still represent it by a single matrix. If we identify an element with then becomes a map from to in the following sense:
Thus, a matrix of the form
fully describes an affine map, and we call it an affine matrix. This matrix is an element in the general linear group . In this way, is identified as a subset (and in fact a subgroup) of . The multiplication of two affine matrices in the set is
which is also an affine matrix in and represents the composition of two affine transformations.
Given and its standard inner product structure, , let us consider the set of linear transformations (or matrices) that preserve the inner product.
Definition A. 17 (The orthogonal group ). An matrix (representing a linear map from to itself) is called orthogonal if it preserves the inner product, i.e.
The set of all orthogonal matrices forms the orthogonal group of dimension , and it is denoted by .
This is the so-called homogeneous representation of . Notice that this identification does not preserve the vector structure of .
Obviously, is a subset (and in fact a subgroup) of . If is an orthogonal matrix, we must have . Therefore, the orthogonal group can be characterized as
The determinant of an orthogonal matrix can be either +1 or -1 . The subgroup of with determinant +1 is called the special orthogonal group and is denoted by . That is, for any , we have . Equivalently, one may define as the intersection . In the case , the special orthogonal matrices are exactly the rotation matrices (studied in Chapter 2).
The affine version of the orthogonal group gives the Euclidean (transformation) group:
Definition A. 18 (The Euclidean group ). A Euclidean transformation from to is defined jointly by a matrix and a vector such that
The set of all such transformations is called the Euclidean group of dimension and is denoted by .
Obviously, is a subgroup of . Therefore, it can also be embedded into a space one-dimension higher and has a matrix representation
If further belongs to , such transformations form the special Euclidean group, which is traditionally denoted by . When represents the conventional rigid-body motion in , where is the rotation of a rigid body and is the translation (with respect to a chosen reference coordinate frame).
Since all the transformation groups introduced so far have natural matrix representations, they are matrix groups. To summarize their relationships, we have
A.3 Gram-Schmidt and the QR decomposition
A matrix in has independent rows (or columns). A matrix in has orthonormal rows (or columns). The Gram-Schmidt procedure can be viewed as a map from to , for it transforms a nonsingular matrix into an orthogonal one. Call the subset of consisting of lower triangular matrices with positive elements along the diagonal. Such matrices form a subgroup of .
Since these groups themselves admit a differential structure, they belong to the Lie groups.
Theorem A.19 (Gram-Schmidt procedure). For every , there exists a lower triangular matrix and an orthogonal matrix such that
Proof. Contrary to the convention of the book, for simplicity in this proof all vectors indicate row vectors. That is, if is an -dimensional row vector, it is of the form: . Denote the th row vector of the given matrix by for . The proof consists in constructing and iteratively from the row vectors :
Then , and the matrix is obtained as
By construction is orthogonal; i.e. .
Remark A.20. The Gram-Schmidt's procedure has the peculiarity of being causal, in the sense that the ith row of the transformed matrix depends only upon rows with index of the original matrix . The choice of the name for the orthogonal matrix above is not accidental. In fact, we will view the Kalman filter (to be reviewed in the next appendix) as a way to perform a Gram-Schmidt orthonormalization in a special Hilbert space, and the outcome of the procedure is traditionally called the innovation.
There are a few useful variations to Gram-Schmidt procedure. By transposing , we get . Notice that is an upper triangular matrix. Thus, by applying Gram-Schmidt procedure to the transpose of a matrix, we can also decompose it into the form where is an orthogonal matrix and an upper triangular matrix. Such a decomposition is called the decomposition. In Matlab, this can be done by the command . Furthermore, by inverting , we get . Notice that is still an upper triangular matrix. Thus, we can also decompose any matrix into the form of an upper triangular matrix followed by an orthogonal one. The latter one is the kind of "QR decomposition" we use in Chapter 6 for camera calibration.
A.4 Range, null space (kernel), rank and eigenvectors of a matrix
Let be a general matrix that also conveniently represents a linear map from the vector space to .
Definition A. 21 (Range, span, null space, and kernel). Define the range or span of , denoted by range or span , to be the subspace of such that if and only if for some . Define the null space of , denoted by null , to be the subspace of such that if and only if . When is viewed as an abstract linear map, null is also referred to as the kernel of the map, denoted by .
Notice that the range of a matrix is exactly the span of all its column vectors; the null space of a matrix is exactly the set of vectors which are orthogonal to all its row vectors (for a definition of orthogonal vectors see Definition A.9). The notion of range or null space is useful whenever the solution to a linear equation of the form is considered. In terms of range and null space, this equation will have a solution if and will have a unique solution only if (the empty set).
In Matlab, the null space of a matrix can be computed using the command = null(A).
Definition A. 22 (Rank of a matrix). The rank of a matrix is the dimension of its range:
Fact A.23 (Properties of matrix rank). For an arbitrary matrix , its rank has the following properties:
.
.
is equal to the maximum number of linearly independent column (or row) vectors of .
is the highest order of a nonzero minor of .
Sylvester’s inequality: Let be an matrix. Then is an matrix and
minor of order is the determinant of a submatrix of .
- For any nonsingular matrices and , we have
In Matlab, the rank of a matrix is just rank (A) .
Definition A. 24 (Orthogonal complement to a subspace). Given a subspace of , we define its orthogonal complement to be the subspace such that if and only if for all . We write .
The notion of orthogonal complement is used in this book to define the "coim-age" of an image of a point or a line. Also, with respect to any linear map from to , the space can be decomposed as a direct sum of two subspaces,
and can be decomposed similarly as
We also have the following not so obvious relationships:
Theorem A.25. Let be a linear map from to . Then:
(a) ,
(b) ,
© ,
(d) .
Proof. To prove part : null , we have
, hence .
; hence .
To prove part , , we first need to prove that is a direct sum of and , i.e. part of the theorem. Part can then be proved similarly. We prove this by showing that a vector is in if and only if it is orthogonal to . Hence null is exactly the subspace that is the orthogonal complement to range (denoted by range ). Therefore, is a direct sum of range and null . Now to complete our proof of part , let denote the image of a subspace under the map . Then we have range (in the second equality we used the fact that is a direct sum of and ). These relations are depicted by Figure A.1.
In fact, the same result holds even if the domain of the linear map is replaced by an infinite-dimensional linear space with an inner product (i.e. is replaced by a Hilbert space). In that case, this theorem is also known as the finite-rank operator fundamental lemma [Callier and Desoer, 1991]. We will later use this result to prove the singular value decomposition. But already it implies a result that is extremely useful in the study of multiple-view geometry:

Figure A.1. The orthogonal decomposition of the domain and codomain of a linear map .
Lemma A.26 (Rank reduction lemma). Let be a matrix and let be a matrix of the form
for some matrices and . Then, regardless of what is, we always have
The proof is easy using the fact range with the second identity from the previous theorem, and we leave the rest of the proof to the reader as an exercise.
A linear map from to itself is represented by a square matrix . For such a map, we sometimes are interested in subspaces of that are "invariant" under the map. This notion turns out to be closely related to the eigenvectors of the matrix .
Definition A. 27 (Eigenvalues and eigenvectors of a matrix). Let be an complex matrix in . A nonzero vector is said to be its (right) eigenvector if
for some scalar is called an eigenvalue of . Similarly, a nonzero row vector is called a left eigenvector of if for some .
More rigorously speaking, a subspace is -invariant if .
Although will mostly be a real matrix in this book, to talk about its eigenvectors, it is more convenient to think of it as a complex matrix (with all entries that happen to be real).
Unless otherwise stated, an eigenvector in this book by default means a right eigenvector. The set of all eigenvalues of a matrix is called its spectrum, denoted by . The Matlab command produces a diagonal matrix of eigenvalues and a full-rank matrix whose columns are the corresponding eigenvectors, so that .
We give the following facts about eigenvalues and eigenvectors of a matrix without a proof.
Fact A.28 (Properties of eigenvalues and eigenvectors). Given a matrix , we have:
If , then for the same eigenvalue , there also exists a left eigenvector such that and vice versa. Hence .
The eigenvectors of associated with different eigenvalues are linearly independent.
All its eigenvalues are the roots of the (characteristic) polynomial equation . Hence is equal to the product of all eigenvalues of .
If for some nonsingular matrix , then .
If is a real matrix, then is an eigenvalue implies that its conjugate is also an eigenvalue. Simply put, for real matrices.
A.5 Symmetric matrices and skew-symmetric matrices
Definition A.29 (Symmetric matrix). A matrix is called symmetric if . A symmetric matrix is called positive (semi-)definite, if (or ) for all , denoted by (or ).
Fact A. 30 (Properties of symmetric matrices). If is a real symmetric matrix, then:
All eigenvalues of must be real, i.e. .
Let be an eigenvalue-eigenvector pair. If , then ; i.e. eigenvectors corresponding to distinct eigenvalues are orthogonal.
There always exist orthonormal eigenvectors of , which form a basis for .
if ; i.e. is positive (semi-)definite if all eigenvalues are positive (nonnegative).
If and , then and
From point 3, we see that if is the matrix of all the eigenvectors, and is the diagonal matrix of the corresponding eigenvalues, then we can write
where is an orthogonal matrix. In fact, can be further chosen to be in (i.e. of determinant +1) if is odd, since and
Definition A. 31 (Induced 2-norm of a matrix). Let . We define the induced 2-norm of (as a linear map from to ) as
Similarly, other induced operator norms on can be defined starting from different norms on the domain and codomain spaces on which operates.
Let be as above. Then is clearly symmetric and positive semidefinite, so it can be diagonalized by a orthogonal matrix . The eigenvalues, being nonnegative, can be written as . By ordering the columns of so that the eigenvalue matrix has decreasing eigenvalues on the diagonal, we see, from point 5 of the preceding fact, that and
The induced 2-norm of a matrix is different from the "2-norm" of viewed as a vector in . To distinguish them, the latter one is conventionally called the Frobenius norm of , precisely defined as . Notice that is nothing but the trace of (or ). Thus, we have
The inverse problem of retrieving from the symmetric matrix is usually solved by Cholesky factorization. For the given , its eigenvalues must be nonnegative. Thus, we have for , where is the "square root" of the diagonal matrix . Since for any orthogonal matrix, the solution for is not unique: is also a solution. Cholesky factorization then restricts the solution to be an upper-triangular matrix (exactly what we need for camera calibration in Chapter 6). In Matlab, the Cholesky factorization is given by the command A = chol (S).
Definition A.32 (Skew-symmetric (or antisymmetric) matrix). A matrix is called skew-symmetric (or antisymmetric) if .
Fact A.33 (Properties of a skew-symmetric matrix). If is a real skew-symmetric matrix, then:
All eigenvalues of are either zero or purely imaginary, i.e. of the form for and some .
There exists an orthogonal matrix such that
where is a block-diagonal matrix , where each is a real skew-symmetric matrix of the form
From point 2, we conclude that the rank of any skew-symmetric matrix must be even. A commonly used skew-symmetric matrix in computer vision is associated with a vector , denoted by
The reason for such a definition is that is equal to the conventional cross product of two vectors in . Then we have if and the (left and right) null space of is exactly spanned by the vector itself. That is, and . In other words, columns and rows of the matrix are always orthogonal to .
Obviously, is also a skew-symmetric matrix. Then for some . We want to know what the relationship between and is.
Fact A. 34 (Hat operator). If is a matrix of determinant 1, then we have
This is an extremely useful fact, which will be extensively used in our book. For example, this property allows us to "push" a matrix through a skew-symmetric matrix in the following way: . We leave to the reader as an exercise to think about how this result needs to be modified when the determinant of is not 1, or when is not even invertible.
A.6 Lyapunov map and Lyapunov equation
An important type of linear equation that we will encounter in our book is of Lyapunov type: Find a matrix that satisfies the equation
for a given pair of matrices . Although solutions to this type of equation can be difficult in general, simple solutions exist when both and have independent eigenvectors. Suppose are the right eigenvectors of , and are the left eigenvectors of ; i.e.
It is also called Sylvester equation in some literature.
for eigenvalues for each . Here means the complex-conjugate and transpose of , since can be complex.
Fact A. 35 (Lyapunov map). For the above matrix and , the eigenvectors of the Lyapunov map
are exactly , and the corresponding eigenvalues are
Proof. The matrices are linearly independent, and they must be all the eigenvectors of .
Due to this fact, any matrix that satisfies the Lyapunov equation 0 must be in the subspace spanned by eigenvectors that have zero eigenvalues: . In Matlab, the command solves the more general Lyapunov equation .
In this book, we often look for solutions with extra requirements on its structure. For instance, needs to be real and symmetric (Chapter 6), or has to be a rotation matrix (Chapter 10). If so, we have only to take the intersection of the space of solutions to the Lyapunov equation with the space of symmetric matrices or rotation matrices.
A.7 The singular value decomposition (SVD)
The singular value decomposition (SVD) is a useful tool to capture essential features of a matrix (that represents a linear map), such as its rank, range space, null space, and induced norm, as well as to "generalize" the concept of "eigenvalue- eigenvector" pair to non-square matrices. The computation of the SVD is numerically well conditioned, making it extremely useful for solving many linear-algebraic problems such as matrix inversion, calculation of the rank, linear least-squares estimate, projections, and fixed-rank approximations. Since this book will use the SVD quite extensively, here we give a detailed proof of its properties.
A.7.1 Algebraic derivation
Given a matrix , we have the following theorem.
Theorem A.36 (Singular value decomposition of a matrix). Let have rank . Furthermore, suppose, without loss of generality, that . Then
whose columns are orthonormal,
whose columns are orthonormal, and
diagonal with
such that .
Proof. We prove the claim by construction.
Compute : it is symmetric and positive semi-definite of dimension . Then order its eigenvalues in decreasing order and call them . Call the ’s singular values.
From an orthonormal set of eigenvectors of create an orthonormal basis for such that
Note that the latter eigenvectors correspond to the zero singular values, since null (according to Theorem A.25).
Define such that , and see that the set is orthonormal (proof left as exercise).
Complete the basis , which spans range (by construction), to all .
Then,
which we name .
- Hence, .
Then the claim follows by deleting the columns of and the rows of that multiply the zero singular values.
In Matlab, to compute the SVD of a given matrix , simply use the command , which returns matrices satisfying (where replaces ). Notice that in the standard SVD routine, the orthogonal matrices and do not necessarily have determinant +1 . So the reader should exercise extra caution when using the SVD to characterize the essential matrix in epipolar geometry in this book.
A.7.2 Geometric interpretation
Notice that in the SVD of a square matrix , columns of and columns of form orthonormal bases for . The SVD essentially states that if (as a linear map) maps a point to , then coordinates of with respect to the basis are related to coordinates of with respect to the basis by the diagonal matrix that scales each coordinate by the corresponding singular value.
Theorem A.37. Let be a square matrix. Then maps the unit sphere to an ellipsoid with semi-axes , where is the ith column of .
Proof. let be such that . The set is an orthonormal basis for . With respect to such a basis has coordinates
That is, . With respect to the basis has coordinates
We also have . Hence . Now , and so we have , which implies that the point satisfies the equation of an ellipsoid with semi-axes of length . This is illustrated in Figure A. 2 for the case .
A.7.3 Some properties of the SVD
Problems involving orthogonal projections onto invariant subspaces of , such as the linear least-squares (LLS) problem, can be easily solved using the SVD.
Definition A.38 (Generalized (Moore Penrose) inverse). Given a matrix of rank with its SVD , we then define the generalized inverse of to be
The generalized inverse is sometimes also called the pseudo-inverse.

Figure A.2. The image of a unit sphere on the left under a nonsingular map is an ellipsoid on the right.
In Matlab, the pseudo-inverse of a matrix is computed by the command X = pinv (A).
Fact A.39 (Properties of generalized inverse).
The generalized inverse can then be used to solve linear equations in general.
Proposition A.40 (Least-squares solution of a linear systems). Consider the problem with of rank . The solution that minimizes is given by .
The following two results have something to do with the sensitivity of solving linear equations of the form .
Proposition A.41 (Perturbations). Consider a nonsingular matrix . Let be a full-rank perturbation. Then
where denotes the ith singular value.
Proposition A.42 (Condition number). Consider the problem , and consider a "perturbed" full-rank problem . Since , then to first-order approximation, . Hence , from which
where is called the condition number of . It easy to see that if is invertible.
Last but not the least, one of the most important properties of the SVD is related to a fixed-rank approximation of a given matrix. Given a matrix of rank , we want to find a matrix such that it has fixed rank and the Frobenius norm of the difference is minimal. The solution to this problem is given simply by setting all but the first singular values to zero
where denotes the matrix obtained from by setting to zero its elements on the diagonal after the th entry. The matrix has exactly the same induced 2-norm of , i.e. , and satisfies the requirement on the rank.
Proposition A.43 (Fixed rank approximation). Let be defined as above. Then . Furthermore, such a norm is the minimum achievable.
The proof is an easy exercise that follows directly from the properties of orthogonal projection and the properties of the SVD given above.