These notes give a quick overview of a few linear algebra concepts
that go beyond .
For a more thorough introduction,
the book of [DFO20] is focused towards ML,
that of [AXL25] is meant as a second course in linear algebra from a more mathematical viewpoint,
and that of [ROM07] is a comprehensive graduate-level reference book.
B.1 Vector spaces
You should already be familiar with .
You might not be familiar yet with more general notions of vector spaces,
which abstract important pieces of the structure of
to let us treat things other than Euclidean vectors in a similar way.
While the definitions can be made more general, we’re only going to deal with real vector spaces.
Definition B.1.
A real vector space
is a nonempty set
along with the operations of
vector addition,
denoted for any ,
and scalar multiplication,
denoted for any and ,
satisfying the following requirements:
•
Vector addition is associative: for all , .
•
Vector addition is commutative: for all , .
•
Vector addition has an identity: there is some zero vector such that for all , .
•
Vector addition has inverses: for each , there is some such that .
•
Compatibility of scalar multiplication: for all and , .
•
Identity of scalar multiplication: for all , .
•
Vector addition distributes: for all and , .
•
Scalar addition distributes: for all and , .
The axioms imply many things you’d expect,
like that the additive identity is unique,
that additive inverses are unique and given by ,
that (where the left-hand is in and the right-hand is the zero vector in ),
etc.
These eight axioms are all things that you probably use all the time without thinking about it for .
Given anything with those structures, though, we can do a lot that we do with .
For example, we often use function spaces.
Here is some set of functions ,
and we can treat them as vectors if we define a way to add two functions and to do scalar multiplication,
which we will always define as follows:
if and ,
These definitions make sense if:
•
is itself a vector space, so that adding and multiplying make sense. This could be just , or could be more general: would be common, but it could be itself a function space….
•
The set needs to be “closed” under both of these operations, so that and are also in . (This is the and part of the definition.)
So, one reasonable function space could be where
and is the set of quadratic functions (where here linear or constant functions also count as quadratic).
Adding two quadratics gets you another quadratic, as does scaling by a constant.
More generally, could be the space of polynomials with degree at most .
Much more generally,
we can also think about spaces like
“all continuous functions”
or “all infinitely-differentiable functions.”
Definition B.2.
A subspace of a real vector space
is a nonempty subset
such that for all and ,
and .
The sum of two subspaces of ,
given by ,
is itself a subspace, and is the smallest subspace containing both and .
The sum of finitely many subspaces is analogous:
.
Note that this implies that any subspace must contain (why?),
and that for any
both and are subspaces of .
Linear functions are a subspace of the space of quadratic functions.
More generally, the space of polynomials with degree at most
is a subspace of the space of polynomials with degree at most for any ,
and is also a subspace of the space of all continuous functions.
Something like , however, is not a subspace unless for all , since a subspace containing must also contain e.g. .
Definition B.3.
The span of a set of vectors is
the subspace
We define .
It can be seen that is the intersection of all subspaces of containing .
Definition B.4.
A nonempty set of vectors is linearly independent if
for any distinct ,
The set is defined to be linearly independent.
A set which is not linearly independent is linearly dependent.
A basis for is a linearly independent set which spans .
The dimension of a vector space , , is the size of the smallest basis for ;
this may be a natural number,
or may be infinite.
Every vector space has a basis,
and thus has a unique, well-defined dimension.
Note that ,
while any other vector space has dimension at least one.
It can also be seen that if , then is linearly dependent;
thus all bases are of the same size, .
B.1.1 Linear maps
Definition B.5.
Let and be real vector spaces.
111Some authors use “linear operator” only for maps.
A linear map or linear operator
is a function satisfying
that for all and ,
We also frequently write rather than .
If is the function space of infinitely differentiable functions ,
then the derivative operator is a linear operator .
If is the space of functions with derivatives,
then is a linear map.
Definition B.6.
A bijective linear map is called an isomorphism.
If an isomorphism exists, we say that and are isomorphic.
It turns out that two vector spaces are isomorphic if and only if they have the same dimension.
Note that not all infinite-dimensional vector spaces are isomorphic,
because they could have different infinite dimensions,
e.g. having a countable or an uncountable basis;
we won’t need to worry about this.
The space of all linear maps from to is itself a vector space.
Definition B.7.
Let be linear.
222The null space is also called the “kernel” of . “Kernel” refers to about ten thousand different concepts in ML and adjacent areas, so please don’t use this terminology if you can help it!
The null space of is , a subspace of ;
the image of is , a subspace of .
The rank of is .
The celebrated rank-nullity theorem says that,
when ,
.
B.2 Normed spaces
One thing that our vector spaces don’t yet have is a notion of magnitude.
In , we usually use the Euclidean norm ,
but you’ve also probably seen at least
and .
What properties do these have in common?
Definition B.8.
A real normed vector space
is a real vector space
with a norm:
a function , written , satisfying
•
Non-negativity: for all , .
•
Positive-definiteness: for every , if and only if .
•
Absolute homogeneity: for every and , .
•
Sub-additivity / triangle inequality: for every , .
The norm of a normed vector space
induces the metric ;
the properties of a metric (definition4.1)
are easy to see from the properties of a norm.
Definition B.9.
Consider a sequence in a metric space .
This sequence has a limit
if for every ,
there exists a positive integer
such that for all ,
.
This sequence is called Cauchy if,
for every ,
there exists a positive integer
such that for all ,
.
The metric space is called complete
if all Cauchy sequences in have limits in .
Definition B.10.
A real Banach space
is a real normed vector space
whose norm induces a complete metric space.
You can check that, for example, the space of all bounded continuous functions , with the norm , is a Banach space.
B.3 Inner product spaces
There’s one other major structure in that we don’t have yet:
dot products.
Definition B.11.
A real inner product space
is a real vector space
together with an inner product,
a function
written ,
satisfying
•
Symmetry: for all , .
•
Linearity: for all and , .
•
Positive-definiteness: if , then .
An inner product space is also a normed vector space
with ,
and hence a metric space
with .
Definition B.12.
A real Hilbert space
is a real inner product space
whose induced metric space is complete.
A common example of a Hilbert space onfunctions (…almost …) is ,
which has the usual vector space operations and the inner product
A function is if , i.e. it’s square-integrable.
A slight variant is , where is a probability distribution on ;
this has inner product
The reason this is “almost” a function space is that we have to treat
some functions that are slightly different, but equal almost everywhere, as the same.
If is standard normal, and
then , all inner products are the same, etc.
So we usually think of these as being spaces of equivalence classes of functions,
rather than of functions proper.
The other major kind of function space is reproducing kernel Hilbert spaces
(chapter14).