Determinant

When studying linear algebra, the determinant function det⁡(⋅)\det(\cdot) is a horrifying subject. We try to give a friendly approach to it in this article.

I think it is the study of the volume of the parallelotope specified by v1,v2,...,vn∈Rnv_1, v_2, ... ,v_n \in \mathbb{R}^n that gives it away. The parallelotope is defined as the set

{∑i∈[n]λivi:λi∈[0,1],∀i∈[n]} \left\{ \sum_{i \in [n]} \lambda_i v_i : \lambda_i \in [0, 1], \forall i \in [n] \right\}

Let's denote f(v1,v2,...,vn):Rn×n→Rf(v_1, v_2, ... ,v_n) : \mathbb{R}^{n \times n} \rightarrow \mathbb{R} the singed volume function, i.e., ∣f(v1,v2,...,vn)∣|f(v_1, v_2, ... ,v_n)| gives the volume of the parallelotope. We will show how to determine the sign of ff later. At this point, we do not know how det⁡(⋅)\det(\cdot) is related to the volume. Therefore, we use the notation ff instead.

We show how to derive the formula of ff by its properties. The two key properties associated with volume are

  1. ff is multi-linear. Specially, it is a linear function in any dimension when other dimensions are fixed:

    • f(v1,v2,...,cvi,...,vn)=cf(v1,v2,...,vn)f(v_1, v_2, ..., cv_i, ... ,v_n)=cf(v_1, v_2, ... ,v_n) for ∀i∈[n]\forall i \in [n] and c∈Rc \in \mathbb{R}. Geometrically, if we scale the ii-th vector viv_i by a factor cc, then the volume of the parallelotope should change by the same factor. In the above example, when v2v_2 is fixed, the area of the parallelogram is determined by its height, i.e., the projection of v1v_1 to the orthogonal direction of v2v_2. When v1v_1 doubles, the length of its projection doubles.

    • f(v1,v2,...,vi+ui,...,vn)=f(v1,v2,...,vi,...,vn)+f(v1,v2,...,ui,...,vn)f(v_1, v_2, ..., v_i + u_i, ... ,v_n)= f(v_1, v_2, ..., v_i, ... ,v_n) + f(v_1, v_2, ..., u_i, ... ,v_n). In the above example, when v2v_2 is fixed, the projection to the orthogonal direction of v2v_2 are additive. In particular, denote P(v1)\mathcal{P}(v_1) the length of the projection of v1v_1 to the orthogonal direction of v2v_2. Similarly we define P(v2)\mathcal{P}(v_2) and P(v1+v2)\mathcal{P}(v_1 + v_2). Then

    P(v1+v2)=P(v1)+P(v2) \mathcal{P}(v_1 + v_2) = \mathcal{P}(v_1) + \mathcal{P}(v_2)
    • Note that the projection of two vector can cancel each other in some cases, in the sense that they points to different direction. In the above example, if we write v1=v1,1e1+v1,2e2v_1 = v_{1, 1} e_1 + v_{1, 2} e_2, then P(v1,1e1)\mathcal{P} (v_{1, 1} e_1) and P(v1,2e2)\mathcal{P} (v_{1,2} e_2) points to opposite directions. This implies that we should give volume a sign. For example, we can define the direction pointed by purple vector points to be positive. The volume of the parallelogram increases if a vector's projection moves along this direction and decrease otherwise.
  2. If v1,v2,...,vnv_1, v_2, ..., v_n are linearly independent, then the parallelotope is contained in a subspace with dimension smaller than nn and should have volume zero. Intuitively, the parallelotope collapses to a lower dimension space. Examples include colinear vectors in two dimension case and the third vector lying in the hyperplane spanned by the other two in the three dimension case.
    Finally, we emphases an important case here:

f(...,vi,...,vj,...,)=0, if vi=vj,∀i,j∈[n],i≠j f(..., v_i,..., v_j, ... , ) = 0, \textbf{ if } v_i = v_j, \forall i, j \in [n], i \neq j

If we write

vi=vi,1e1+vi,2e2+...+vi,nen v_i = v_{i, 1} e_1 + v_{i, 2} e_2 + ... + v_{i, n} e_n

for all i∈[n]i \in [n], then by linearity

f(v1,v2,...,vn)=f(v1,1e1+v1,2e2+...+v1,nen,v2,1e1+v2,2e2+...+v2,nen,...vn,1e1+vn,2e2+...+vn,nen)=∑k1,k2,...,kn∈[n]v1,k1v2,k2...vn,knf(ek1,ek2,...,ekn) \begin{aligned} f(v_1, v_2, ..., v_n) &= f( v_{1, 1} e_1 + v_{1, 2} e_2 + ... + v_{1, n} e_n, \\ &\qquad v_{2, 1} e_1 + v_{2, 2} e_2 + ... + v_{2, n} e_n, \\ &\qquad ...\\ &\qquad v_{n, 1} e_1 + v_{n, 2} e_2 + ... + v_{n, n} e_n) \\ &= \sum_{k_1, k_2, ..., k_n \in [n]} v_{1, k_1} v_{2, k_2} ... v_{n, k_n} f(e_{k_1}, e_{k_2}, ..., e_{k_n}) \end{aligned}

Note that if ki=kjk_i = k_j for i≠ji \neq j, then f(ek1,ek2,...,ekn)=0f(e_{k_1}, e_{k_2}, ..., e_{k_n}) = 0. Therefore,

f(v1,v2,...,vn)=∑k is a permutationv1,k1v2,k2...vn,knf(ek1,ek2,...,ekn) f(v_1, v_2, ..., v_n) = \sum_{ k \text{ is a permutation} } v_{1, k_1} v_{2, k_2} ... v_{n, k_n} f(e_{k_1}, e_{k_2}, ..., e_{k_n})

We are almost done. It is left to determined the value of f(ek1,ek2,...,ekn)f(e_{k_1}, e_{k_2}, ..., e_{k_n}), where k=(k1,k2,...,kn)k = (k_1, k_2, ..., k_n) is a permutation of (1,2,....,n)(1, 2, ...., n). Here we claim that is purely determined by the value of f(e1,e2,...,en)f(e_1, e_2, ..., e_n). By conversion, we define

f(e1,e2,...,en)=1 f(e_1, e_2, ..., e_n) = 1

Then we have the key lemma:

Lemma

f(ek1,ek2,...,ekn)=−1 f(e_{k_1}, e_{k_2}, ..., e_{k_n}) = -1

if k1,k2,...,kn{k_1}, {k_2}, ..., {k_n} can be recovered to 1,2,...,n1, 2, ..., n by odd number of neighboring swaps and

f(ek1,ek2,...,ekn)=1 f(e_{k_1}, e_{k_2}, ..., e_{k_n}) = 1

if k1,k2,...,kn{k_1}, {k_2}, ..., {k_n} can be recovered to 1,2,...,n1, 2, ..., n by even number of neighboring swaps.

Proof. The key is to prove that we swap two neighboring vectors, then the sign of the volume change:

f(ek1,ek2,...,eki,eki+1,...,ekn)=−f(ek1,ek2,...,eki+1,eki,...,ekn) f(e_{k_1}, e_{k_2}, ..., e_{k_{i } }, e_{k_{i + 1} }, ..., e_{k_n}) = -f(e_{k_1}, e_{k_2}, ..., e_{k_{i + 1 } }, e_{k_{i } }, ..., e_{k_n})

This is because

f(ek1,ek2,...,eki+eki+1,eki+eki+1,...,ekn)=f(ek1,ek2,...,eki,eki+1,...,ekn)+f(ek1,ek2,...,eki+1,eki,...,ekn)=0 \begin{aligned} f(e_{k_1}, e_{k_2}, ..., e_{k_{i } } + e_{k_{i + 1} }, e_{k_{i } } + e_{k_{i + 1} }, ..., e_{k_n}) &= f(e_{k_1}, e_{k_2}, ..., e_{k_{i } }, e_{k_{i + 1} }, ..., e_{k_n})\\ &\quad + f(e_{k_1}, e_{k_2}, ..., e_{k_{i + 1 } }, e_{k_{i } }, ..., e_{k_n}) \\ &= 0 \end{aligned}

□\square

Cross Product

If we fix v2,v3,...,vnv_2, v_3, ..., v_n, then det⁡(x,v2,...,vn):Rn→R\det(x, v_2, ..., v_n): \R^n \rightarrow \R is a linear function. Then

det⁡(x,v2,...,vn)=∑i=1ndet⁡(xiei,v2,...,vn)=∑i=1nxidet⁡(ei,v2,...,vn) \begin{aligned} \det(x, v_2, ..., v_n) &= \sum_{i = 1}^n \det(x_i e_i, v_2, ..., v_n) \\ &= \sum_{i = 1}^n x_i \det(e_i, v_2, ..., v_n) \end{aligned}

where xix_i is the i-th coordinator of xx. If we write

d=<det(e1,v2,...,vn),det(e2,v2,...,vn),...,det(en,v2,...,vn)> d = \left< det(e_1, v_2, ..., v_n), det(e_2, v_2, ..., v_n), ..., det(e_n, v_2, ..., v_n)\right>

Then

det⁡(x,v2,...,vn)=d⋅x \det(x, v_2, ..., v_n) = d \cdot x

Indeed, in a similar manner, we can prove that for any h:Rn×n→Rnh: \R^{n \times n} \rightarrow \R^n linear function, there exists a vector h⃗\vec h, such that

h(x)=h⃗⋅x h(x) = \vec h \cdot x

Conventionally, dd is called the cross product of v2,...,vnv_2, ..., v_n is written as

d=v2×v3×...×vn d = v_2 \times v_3 \times ... \times v_n

It has some interesting properties:

  1. dd is perpendicular to the subspace spanned by v2,...,vnv_2, ..., v_n, as d⋅vi=det⁡(vi,v2,...,vn)=0d \cdot v_i = \det(v_i, v_2, ..., v_n) = 0 for 2≤i≤n2 \le i \le n.

  2. For any x∈Rnx \in \R^n, d⋅xd \cdot x gives the signed volume of the parallelotope spanned by x,v2,...,vnx, v_2, ..., v_n.

    • When n=2n = 2, the length of dd equals to that of v2v_2.
    • When n=3n = 3, the length of dd equals to the area of the parallelogram spanned by v2,v3v_2, v_3. Combined with the fact that dd is perpendicular to v2,v3v_2, v_3, we see why d⋅xd \cdot x gives the volume of the parallelotope spanned by x,v2,v3x, v_2, v_3: it takes the projection of xx to the direction that is perpendicular to v2v_2 and v3v_3, scaled by a factor of the area spanned by v2v_2 and v3v_3.
  3. The direction given of dd is given by right hand rule, when n=2n = 2 or n=3n = 3.

□\square

Cramer's Rule

Cramer's rule is a formula for solving linear equations. In particular, given an invertible matrix A∈Rn×nA \in \R^{n \times n}, and vector b∈Rnb \in \R^n, then the solution for the equation

Ax=b Ax = b

is given by (∀i∈[n]\forall i \in [n]),

xi=det⁡(Ai)det⁡(A) x_i = \frac{\det(A_i) }{\det (A)}

where xix_i is the i-th coordinate of xx and AiA_i is the matrix formed by replacing AA's the ii-th column by column vector bb.

To understand the formula, we view AA as a mapping T:Rn→RnT: \R^n \rightarrow \R^n that takes ei(i∈[n])e_i (i \in [n]) to A[:,i]A[:,i], i.e.,

T(ei)=A[:,i] T(e_i) = A[:, i]

where A[:,i]A[:, i] is the i-th column of AA. The image of the hypercube

{∑i∈[n]λiei:λi∈[0,1],∀i∈[n]} \left\{ \sum_{i \in [n]} \lambda_i e_i : \lambda_i \in [0, 1], \forall i \in [n] \right\}

is given as

{∑i∈[n]λiA[:,i]:λi∈[0,1],∀i∈[n]} \left\{ \sum_{i \in [n]} \lambda_i A[:, i] : \lambda_i \in [0, 1], \forall i \in [n] \right\}

Original the hypercube has volume 1. After the transformation it has volume det⁡(A)\det(A). One interesting fact about linear transformation is that it preserves volumes ratio. Define V(⋅)\mathbb{V}(\cdot) the volume of a parallelotope.

Fact. For any parallelotope PP, its volume under transformation TT is given by

det⁡(A)V(P)=V(T(P)) \det(A) \mathbb{V}(P) = \mathbb{V}(T(P))

Now, we rewrite the Cramer's rule as

det⁡(A)xi=det⁡(Ai) \det(A) x_i = \det(A_i)

Its meaning is clear: there is a parallelotope PP whose volume is xix_i and after the transformation it has volume det⁡(Ai)\det(A_i).

It is left to verify that the parallelotope indeed exists. We observe that det⁡(Ai)\det(A_i) can be viewed as the volume of the following parallelotope formed by

{∑j∈[n],j≠iλjA[:,j]+λibi:λj∈[0,1],∀j,λi∈[0,1]} \left\{ \sum_{j \in [n], j \neq i} \lambda_j A[:, j] +\lambda_i b_i: \lambda_j \in [0, 1], \forall j, \lambda_i \in [0, 1] \right\}

But this parallel0tope is the image of

{∑j∈[n],j≠iλjej+λixi:λj∈[0,1],∀j,λi∈[0,1]} \left\{ \sum_{j \in [n], j \neq i} \lambda_j e_j +\lambda_i x_i: \lambda_j \in [0, 1], \forall j, \lambda_i \in [0, 1] \right\}

as

T({∑j∈[n],j≠iλjej+λixi:λj∈[0,1],∀j,λi∈[0,1]})={∑j∈[n],j≠iλjT(ej)+λiT(xi):λj∈[0,1],∀j,λi∈[0,1]}={∑j∈[n],j≠iλjA[:,j]+λibi:λj∈[0,1],∀j,λi∈[0,1]} \begin{aligned} & T \left( \left\{ \sum_{j \in [n], j \neq i} \lambda_j e_j +\lambda_i x_i: \lambda_j \in [0, 1], \forall j, \lambda_i \in [0, 1] \right\} \right) \\ &= \left\{ \sum_{j \in [n], j \neq i} \lambda_j T(e_j) +\lambda_i T(x_i): \lambda_j \in [0, 1], \forall j, \lambda_i \in [0, 1] \right\} \\ &= \left\{ \sum_{j \in [n], j \neq i} \lambda_j A[:, j] +\lambda_i b_i: \lambda_j \in [0, 1], \forall j, \lambda_i \in [0, 1] \right\} \end{aligned}

□\square