Matrix Calculus — Preliminaries
The Derivative
We can begin the discussion of matrix calculus by revisiting the definition of a derivative. For many students, the difference quotient definition will be familiar. We will show that it is equivalent to defining the derivative as the best linear approximator of the function — a setup that lays the foundations for discussing derivatives of matrix-like objects.
Recall the difference quotient definition of the derivative. Let be an open subset (for simplicity) and a sufficiently smooth, single variable, scalar-valued function. Let . Then we can define the derivative of at to be
If has a derivative at every point in its domain, then we say is a differentiable function, and its derivative is the function defined by the difference quotient:
This function is unique to , although that property will not be proven here. Refer to Strichartz, Chapter 5, for more details.
If you are unfamiliar with the rigorous definitions of "open subset" or "sufficiently smooth," that is fine. The idea behind them in the definition is to rule out the case where we try to define the derivative of a non-differentiable function. A more rigorous discussion of differentiability and subset topology belongs to an analysis course and is unfortunately out of scope for this guide.
Now observe how we can convert the difference quotient expression into a linear approximation. If we remove the limit, then there must exist a function representing the error between the difference quotient and the derivative at a point. We know that must satisfy . So we can write
and consequently
As , the term , using little-O notation.
Here is a quick recap of little-O notation and the main property we will use: if , then
We can rearrange the expression above to show how the derivative is a linear approximation:
For small values of , the error term can be disregarded. Observe how can be approximated by an affine function (of the type ) where the derivative acts as the slope. We can define the derivative to be the unique scalar value for which the error is minimal (uniqueness not proven here). By rearranging the terms and dividing both sides by , we get
If we take the limit of both sides as (equivalently, the limit of the absolute value of the quotient), we arrive at an alternate definition of the derivative.
Let be an open subset and a sufficiently smooth, single variable, scalar-valued function. Let . If there exists a scalar value such that
then we say that is differentiable at , and we can usually denote the quantity as
If is differentiable at every point , then we say is differentiable on , and its derivative is the function that maps points in the domain to the scalar value satisfying the pointwise condition above. Now that we have established this alternate definition of the derivative, we are in good shape to continue deciphering matrix calculus.
Partial Derivatives
The partial derivative is closely related to the ordinary derivative. However, partial derivatives pertain to functions with several variables in the domain. The partial derivative of a function of several variables is its derivative with respect to one of the variables, with the others held constant. We can formalize this the following way.
Let be an open subset and a function. The partial derivative of at the point with respect to the 'th variable is the scalar value that satisfies
This is equivalent to
Here, is the unit vector in with zeros in all elements except for a in the 'th element. The value is often denoted
and read as the partial derivative of with respect to at the point . The partial derivative will be important for deciphering what elements make up the total derivative discussed in the next chapter.
Linear Maps
Soon we will learn that the total derivative is defined to be a linear map. But before we get into that topic, we must first recall some properties of linear maps. Here is a hopefully familiar definition from linear algebra.
Let and be vector spaces over the same field . A mapping from the vector space to the vector space is said to be a linear map if it satisfies the following two conditions for any and any scalar :
- Additivity:
- Degree 1 Homogeneity:
Another useful property of linear maps is that they can be entirely determined by their action on a set of basis vectors for the domain. This allows us to create a matrix that represents the linear mapping, so that applying the linear mapping to a vector becomes equivalent to multiplying the matrix by the vector. This is vastly useful because it allows for concrete computations. Secondly, most applications of matrix calculus deal with linear mappings in , and thus the values of the linear transformation matrix and the vectors in the domain correspond to real quantities.
Suppose and are finite-dimensional vector spaces, and let and be bases for and respectively. Every vector can be uniquely determined by the coefficients :
Note that, conventionally, the entries make up the elements of the vector when it is written out in the coordinate system. That is,
If the basis for a certain coordinate system is already understood, then the subscript is often dropped from the explicit vector notation. If is a linear map, then
This shows that the function can be entirely determined by the vectors for . Since each of these vectors is in , we can represent each as
Putting this into the expression above, we get
Now watch what happens when we put the entries into an matrix. Consider the matrix
If we take an arbitrary and multiply it by , we get
Rearranging the terms, we arrive at the exact same expression as :
which shows that we can indeed represent any linear transformation with a matrix whose entries depend on the bases we choose for the domain and codomain vector spaces.
Linearity of Differentiation
Consider two differentiable functions and , and the scalar . The sum and constant rules for derivatives are hopefully a familiar concept. For instance,
and
Proofs of the sum and constant rules can be found here, and essentially require using the difference quotient definition of the derivative to derive these properties.
Notice that differentiation, if treated like an operator on the space of functions, satisfies the properties of a linear map. Hence, the linearity of the derivative is a property we hope to preserve for multivariable and vector-valued functions.
Vector-Valued Functions
We now investigate the derivative of functions that map to . This generalization is not significantly more complicated, and putting it here sets up the necessary pre-work for discussing the total derivative in the next chapter. Let be a single-variable, vector-valued function. If we expand into its components,
then is differentiable at if and only if all of its components are differentiable at , and is the matrix where the 'th entry is . That is,
If is differentiable everywhere in its domain, we can define its derivative to be the function
This characterization of the derivative of vector-valued functions does preserve the linearity of the differentiation operator. For instance, let be two differentiable vector-valued functions and scalars. We will drop the subscript within the matrix, since it is understood that each and has only a single variable in the domain to differentiate with respect to. Then we can write
using the linearity property for scalar-valued functions discussed earlier. It follows, then, that
This shows that the linearity property holds for single-variable, vector-valued functions as well.
We now have the necessary tools to discuss the total derivative — what it means, what it is comprised of, and how to begin computing it — in the next chapter.
Sources
- Partial derivative — Wikipedia
- Derivative — Wikipedia
- Directional derivative — Wikipedia
- Linear map — Wikipedia
- Strichartz, Robert. The Way of Analysis.
- Rudin, Walter. Principles of Mathematical Analysis.