Appendix B Function Spaces

These notes give a quick overview of a few linear algebra concepts that go beyond ℝd . 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 ℝd . You might not be familiar yet with more general notions of vector spaces, which abstract important pieces of the structure of ℝd 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 V along with the operations of vector addition, denoted v+w∈V for any v,w∈V , and scalar multiplication, denoted a⁢v∈V for any v∈V and a∈ℝ , satisfying the following requirements:

  • •

    Vector addition is associative: for all u,v,w∈V , u+(v+w)=(u+v)+w .

  • •

    Vector addition is commutative: for all v,w∈V , v+w=w+v .

  • •

    Vector addition has an identity: there is some zero vector 0∈V such that for all v∈V , v+0=v .

  • •

    Vector addition has inverses: for each v∈V , there is some −v∈V such that v+(−v)=0 .

  • •

    Compatibility of scalar multiplication: for all a,b∈ℝ and v∈V , a⁢(b⁢v)=(a⁢b)⁢v .

  • •

    Identity of scalar multiplication: for all v∈V , (1)⁢v=v .

  • •

    Vector addition distributes: for all a∈ℝ and v,w∈V , a⁢(v+w)=a⁢v+a⁢w .

  • •

    Scalar addition distributes: for all a,b∈ℝ and v∈V , (a+b)⁢v=a⁢v+b⁢v .

The axioms imply many things you’d expect, like that the additive identity is unique, that additive inverses are unique and given by (−1)⁢v , that 0⁢v=0 (where the left-hand 0 is in ℝ and the right-hand is the zero vector in V ), etc.

These eight axioms are all things that you probably use all the time without thinking about it for ℝd . Given anything with those structures, though, we can do a lot that we do with ℝd . 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 f,g∈ℱ and a∈ℝ ,

f+g=(x↦f⁢(x)+g⁢(x))a⁢f=(x↦a⁢f⁢(x)).

These definitions make sense if:

  • •

    𝒴 is itself a vector space, so that adding f⁢(x)+g⁢(x) and multiplying a⁢f⁢(x) make sense. This could be just ℝ , or could be more general: ℝd would be common, but it could be itself a function space….

  • •

    The set ℱ needs to be “closed” under both of these operations, so that f+g and a⁢f are also in ℱ . (This is the v+w∈V and a⁢v∈V 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 k . Much more generally, we can also think about spaces like “all continuous functions” or “all infinitely-differentiable functions.”

Definition B.2.

A subspace U of a real vector space V is a nonempty subset U⊆V such that for all v,w∈U and a∈ℝ , v+w∈U and a⁢v∈U .

The sum of two subspaces U,W of V , given by U+W={u+w:u∈U,w∈W} , is itself a subspace, and is the smallest subspace containing both U and W . The sum of finitely many subspaces is analogous: ∑iUi={∑iui:∀i,ui∈Ui} .

Note that this implies that any subspace must contain 0 (why?), and that for any V both {0} and V are subspaces of V .

Linear functions are a subspace of the space of quadratic functions. More generally, the space of polynomials with degree at most k is a subspace of the space of polynomials with degree at most K for any k≤K , and is also a subspace of the space of all continuous functions.

Something like {f∈ℱ:|f⁢(0)|≤1} , however, is not a subspace unless f⁢(0)=0 for all f∈ℱ , since a subspace containing f must also contain e.g.  3f⁢(0)⁢f .

Definition B.3.

The span of a set of vectors S⊆V is the subspace

span⁡(S)={a1⁢v1+⋯+am⁢vm:m∈ℕ,a1,…,am∈ℝ,v1,…,vm∈S}.

We define span⁡({})={0} .

It can be seen that span⁡(S) is the intersection of all subspaces of V containing S .

Definition B.4.

A nonempty set of vectors S⊆V is linearly independent if for any distinct v1,…,vm∈S ,

a1⁢v1+⋯+am⁢vm=0⁢ implies ⁢a1=⋯=am=0.

The set {} is defined to be linearly independent. A set which is not linearly independent is linearly dependent.

A basis for V is a linearly independent set which spans V .

The dimension of a vector space V , dimV , is the size of the smallest basis for V ; 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 dim{0}=0 , while any other vector space has dimension at least one. It can also be seen that if |S|>dimV , then S is linearly dependent; thus all bases are of the same size, dimV .

B.1.1 Linear maps

Definition B.5.

Let V and W be real vector spaces. 111Some authors use “linear operator” only for V→V maps. A linear map or linear operator is a function T:V→W satisfying that for all v,v′∈V and a∈ℝ ,

T⁢(a⁢v+v′)=a⁢T⁢(v)+T⁢(v′).

We also frequently write T⁢v rather than T⁢(v) .

If ℱ is the function space of infinitely differentiable functions ℝ→ℝ , then the derivative operator D⁢f=(x↦f′⁢(x)) is a linear operator ℱ→ℱ . If ℱk is the space of functions with k derivatives, then D:ℱk→ℱk−1 is a linear map.

Definition B.6.

A bijective linear map T:V→W is called an isomorphism. If an isomorphism exists, we say that V and W 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 V to W is itself a vector space.

Definition B.7.

Let T:V→W be linear. 222The null space is also called the “kernel” of T . “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 T is null⁡(T)={v∈V:T⁢v=0} , a subspace of V ; the image of T is image⁡(T)={T⁢v:v∈V} , a subspace of W . The rank of T is rank⁡(T)=dimimage⁡(T) .

The celebrated rank-nullity theorem says that, when dimV<∞ , rank⁡(T)+dimnull⁡(T)=dimV .

B.2 Normed spaces

One thing that our vector spaces don’t yet have is a notion of magnitude. In ℝd , we usually use the Euclidean norm ∥x∥=∑ixi2 , but you’ve also probably seen at least ∥x∥1=∑i|xi| and ∥x∥∞=maxi⁡|xi| . What properties do these have in common?

Definition B.8.

A real normed vector space is a real vector space V with a norm: a function V→ℝ , written ∥v∥ , satisfying

  • •

    Non-negativity: for all v∈V , ∥v∥≥0 .

  • •

    Positive-definiteness: for every v∈V , ∥v∥=0 if and only if v=0 .

  • •

    Absolute homogeneity: for every a∈ℝ and v∈V , ∥a⁢v∥=|a|⁢∥v∥ .

  • •

    Sub-additivity / triangle inequality: for every v,w∈V , ∥v+w∥≤∥v∥+∥w∥ .

The norm of a normed vector space induces the metric ρ⁢(v,w)=∥v−w∥ ; the properties of a metric (definition 4.1) are easy to see from the properties of a norm.

Definition B.9.

Consider a sequence x1,x2,… in a metric space 𝒳 .

This sequence has a limit x∞∈𝒳 if for every ε>0 , there exists a positive integer N such that for all n>N , ρ⁢(xn,x∞)<ε .

This sequence is called Cauchy if, for every ε>0 , there exists a positive integer N such that for all m,n>N , ρ⁢(xm,xn)<ε .

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 ∥f∥∞=supx∈𝒳|f⁢(x)| , is a Banach space.

B.3 Inner product spaces

There’s one other major structure in ℝd that we don’t have yet: dot products.

Definition B.11.

A real inner product space is a real vector space V together with an inner product, a function V×V→ℝ written ⟨v,w⟩ , satisfying

  • •

    Symmetry: for all v,w∈V , ⟨v,w⟩=⟨w,v⟩ .

  • •

    Linearity: for all u,v,w∈V and a,b∈ℝ , ⟨a⁢u+b⁢v,w⟩=a⁢⟨u,w⟩+b⁢⟨v,w⟩ .

  • •

    Positive-definiteness: if v≠0 , then ⟨v,v⟩>0 .

An inner product space is also a normed vector space with ∥v∥=⟨v,v⟩ , and hence a metric space with ρ⁢(v,w)=∥v−w∥=⟨v−w,v−w⟩ .

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 L2 , which has the usual vector space operations and the inner product

⟨f,g⟩L2=∫f⁢(x)⁢g⁢(x)⁢dx.

A function f is L2 if ∥f∥L2<∞ , i.e. it’s square-integrable. A slight variant is L2⁢(P) , where P is a probability distribution on 𝒳 ; this has inner product

⟨f,g⟩L2⁢(P)=𝔼X∼Pf⁢(X)⁢g⁢(X).

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 P is standard normal, and f~⁢(x)={f⁢(x)x≠0100x=0, then ∥f−f~∥=0 , 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 (chapter 14).