Machine Learning Math

Table of contents
This blog is deprecated as there are no plans to make updates here, even in the near future. As a result, there are some inaccuracies that are yet to be ironed out. Proceed at your own caution.
Groups.

Def. A set $G$ of elements with an operation $+: G \times G \to G$ is called a group if the following properties hold:

  1. Associativity : $\forall a,b,c \in G \quad (a+b)+c=a+(b+c)$
  2. Identity : $\exists e \in G \quad \forall g \in G$ s.t. $e+g=g+e=g$
  3. Inverse : $\forall a \in G \quad \exists b \in G$ s.t. $a+b=b+a=e$

The group is called a commutative (Abelian) group if we have additionally \(\forall a, b \in G \quad a+b=b+a\) Example: $S_n \coloneqq {\pi : {1, \dots, n} \to {1, \dots, n} \mid \pi \text{ is bijective}}$

Fields.

Def. A set $F$ with 2 operations $+, * : F \times F \to F$ is called a field if the following properties hold:

  1. $(F, t)$ is a commutative group with identity element 0, $t = +, *$
  2. $(F \setminus { 0 }, *)$ is also a commutative group with identity element 1
  3. Distributivity: $\forall a, b, c \in F \quad a(b+c)=ab + a*c$

Example: For a $n \in \mathbb{Z}$ consider $\mathbb{Z}_n \coloneqq { 0, 1, \dots, n-1 }$ such that $a +_n b \coloneqq (a+b) \mod{n}$, $a _n b \coloneqq (ab)\mod n$. Then $(\mathbb{Z}, +_n, _n)$ is a field iff $n\geq 1$ is prime, otherwise it will always be a *ring.

Vector Spaces.

Def. Let $F$ be a field with identity elements 0 and 1. A vector space over the field $F$ is a set $V$ with a mapping $+ : V \times V \to V$ and $* : F \times V \to V$ then:

  1. $(V, +)$ is a commutative group
  2. Multiplicative identity : $\forall v \in V \quad 1*v = v$
  3. Distributive property : $\forall a, b \in F$ and $\forall u, v \in V$ such that $a(u+v)=au + av$ and $(a+b)u=au+bu$
Function Spaces:

$\mathbb{R}^\mathcal{X} \coloneqq { f : \mathcal{X} \to \mathbb{R} }$ represents the space of all real valued functions on a set $\mathcal{X}$

\[\begin{gather*} + : \mathbb{R}^\mathcal{X} \times \mathbb{R}^\mathcal{X} \to \mathbb{R}^\mathcal{X}\\ (f+g)(x) \coloneqq f(x) + g(x)\\ \\ * : \mathbb{R} \times \mathbb{R}^\mathcal{X} \to \mathbb{R}^\mathcal{X}\\ (\lambda f)(x) \coloneqq \lambda f(x) \end{gather*}\]

$\mathcal{C}(\mathcal{X}) \coloneqq { f : \mathcal{X} \to \mathbb{R} \mid f \text{ is constant} }$

$\mathcal{C}^r([a, b]) \coloneqq { f : [a,b] \to \mathbb{R} \mid f \text{ is r times continuous differentiable} }$

Subspace.

Def. Let $V$ be a vector space, $U \subset V$ non-empty set, we call $U$ a subspace of $V$ if it is closed under linear combination: \(\forall \lambda, \mu \in F \quad \forall u, v \in U \quad \lambda u + \mu v \in U\)

Linear Combinations.

Def. $V$ vector space over $F$, $u_1, \dots, u_n \in V$, $\lambda_1, \dots, \lambda_n \in F$ then $\sum_{i=1}^n \lambda_i u_i$ is called a Linear Combination. The set of all linear combinations of $u_1, \dots, u_n \in V$ is called the span (linear hull) of $u_1, \dots, u_n \in V$. \(\text{Span}(u_1, \dots, u_n) \coloneqq \left\{ \sum_{i=1}^n \lambda_i u_i \mid \lambda_i \in F \right\}\) The set $U \coloneqq {u_1, \dots, u_n}$ is the generator of Span($u_1, \dots, u_n$). To find good generators, we need to know what is linear independence and dependence.

Linear Independence.

Def. A set of vectors $v_1, \dots, v_n$ is called linearly independent if $\sum^n_{i=1} \lambda_i v_i =0 \implies \lambda_1 = \lambda_2 = \dots = \lambda_n = 0$

Basis.

Def. A subset $B$ of a vector space $V$ is called a (Hamel) basis if:

  1. $\text{Span}(B) = V$
  2. $B$ is linearly independent

Proposition. If $U={ u_1, \dots, u_n }$ spans a vector space $V$, then the set $U$ can be reduced to the basis of $V$.

Proof.

  • If $U$ is already linearly independent : Done
  • If $U$ is dependent : there exists $a \in U$ that is a linear combination of other vectors in $U$, we remove it.
  • We keep removing all $a$ until the remaining set is linearly independent $\blacksquare$

Def. A vector space is called finite dimensional if it contains a finite basis.

Prop. Let $U = { u_1, \dots, u_n } \subset V$ be a set of linearly independent vectors and $V$ be a finite dimensional vector space, then $U$ can be extended to a basis of $V$.

Proof. (Sketch) Let $w_1, \dots, w_n$ be basis of $V$. Consider the set ${ u_1, \dots, u_n, w_1, \dots, w_n }$. Remove vectors from the set until remaining vectors are linearly independent.

Corollary. Let $V$ be a finite dimensional vector space then any two basis of $V$ have the same length.

Dimension.

Def. The length of the basis of a finite dimensional vector space is called the dimension of $V$.

Def. Assume that we have $U_1$, $U_2$ subspaces of $V$ , the sum of the two spaces is defined as : \(U_1 + U_2 \coloneqq \{ u_1 + u_2 \mid u_1\in U_1, u_2\in U_2 \}\) the sum is called the direct sum, if each element in the sum can be written in exactly one way. \(U_1 \oplus U_2 \quad \text{s.t.} \quad U_1 \cap U_2 = \{0\}\) This is a way of combining two (or more) subspaces into a larger vector space, in a way such that the decomposition of vectors is unique. For some vector space $V$ we can have have its unique $k$ constituents as follows: \(\begin{gather*} \forall v \in V, \quad \exists u_1 \in U_1, u_2 \in U_2, \dots, u_k \in U_k \text{ such that } v = \sum_{i=1}^k u_i\\ V = \bigoplus_{i=1}^k U_i \end{gather*}\) Prop. Suppose $V$ is finite dimensional and $U \subset V$ is a subspace the there exists a subspace $W \subset V$ such that $U\oplus W = V$.

Proof. (Sketch) Let ${ u_1, \dots, u_n }$ basis of $U$ extend it to a basis of $V$, say the resulting set is \(\{ \underbrace{u_1, \dots, u_n}_{U}, \underbrace{v_1, \dots, v_m}_{W} \}\) Define = $\text{Span}{v_1, \dots, v_m}$

Linear Mapping.

Def. Let $U$, $V$ vector space over $F$, a mapping $T:U\to V$ is called a linear if $\forall u_1, u_2 \in U$, $\forall \lambda \in F$ \(\begin{gather*} f(u_1 + u_2) = f(u_1) + f(u_2)\\ f(\lambda u_1) = \lambda f(u_1) \end{gather*}\) the set of all linear mappings for $U\to V$ is denoted $\mathcal{L} (U, V)$. If $U\equiv V$ then $\mathcal{L}(U)$.

Def. $T \in \mathcal{L}(U,V)$ then kernel (nullspace) of $T$ is defined as $\text{ker}(T) \coloneqq \text{null}(T) \coloneqq { u \in U \mid Tu=0 }$ (all points that the transformation $T$ maps to 0).

Prop.

  • $\text{ker}(T)$ is a subspace of U.
  • $T$ is injective iff $\text{ker}(T) = {0}$

Def. The range of $T$ is defined as $\text{range}(T) \coloneqq \text{Im}(T) \coloneqq { Tu \mid u \in U }$.

Prop. The range is always a subspace of $V$ ($T$ is surjective iff $\text{range}(T)=V$)

Def. For any set $V^\prime \subset V$, the pre-image of $V^\prime$ is defined as \(T^{-1}(V^\prime) \coloneqq \{ u \in U \mid Tu \in V^\prime \}\)

Prop. If $V^\prime \subset V$ is a subspace of $V$, then $T^{-1}(V^\prime)$ is a subspace of $U$

rangeT

Theorem. Let $V$ be finite dimensional, $W$ any vector space, $T \in \mathcal{L}(V,W)$ Let $u_1, \dots, u_n$ be a basis of $\text{ker}(T) \in V$ Let $w_1, \dots, w_m$ be a basis of $\text{range}(T) \subset W$ Then $u_1, \dots, u_n, T^{-1}(w_1), \dots, T^{-1}(w_m) \subset V$ form a basis of $V$ In particular $\text{dim}(V)= \text{dim}(\text{ker}(T)) + \text{dim}(\text{range}(T))$

Proof. Denote $z_1 \coloneqq T^{-1}(w_1), \dots, z_m \coloneqq T^{-1}(w_m)$ subspace_proof Step 1: $V \subset \text{Span}{ u_1, \dots, u_n, z_1, \dots, z_m }$ let $v\in V$, consider $Tv \in \text{range}(T)$ $\implies \exists \lambda_1, \dots, \lambda_m$ s.t. $Tv = \lambda_1 w_1 + \dots + \lambda_m w_m = \lambda_1 T(z_1) + \dots + \lambda_m T(z_m)$ $\implies Tv = T(\lambda_1 z_1+ \dots + \lambda_m z_m)$ $\implies Tv - T(\lambda_1 z_1+ \dots + \lambda_m z_m) = 0$ $\implies T(\underbrace{v - (\lambda_1 z_1+ \dots + \lambda_m z_m)}{\in \text{ker}(T)})=0$ $\exists \mu_1, \dots \mu_n$ s.t. $v - (\lambda_1 z_1+ \dots + \lambda_m z_m) = \mu_1 u_1 + \dots$ $\implies v = \underbrace{\lambda_1 z_1+ \dots + \lambda_m z_m}{\text{range}} + \underbrace{\mu_1 v_1 + \dots + \mu_n u_n}{\text{ker}}$ Step 2: $u_1, \dots, u_n, z_1, \dots, z_m$ are linearly independent Assume that $\mu_1u_1 + \dots + \mu_n u_n + \lambda_1 z_1 + \dots + \lambda_m z_m = 0$ –(i) $\mu_1u_1 + \dots + \mu_n u_n = \lambda_1 T(z_1) + \dots + \lambda_m T(z_m)$ $= \lambda_1 T(z_1) + \dots + \lambda_m T(z_m) + \underbrace{\mu_1 T(u_1) + \dots + \mu_n T(u_n)}{=0}$ $T(\underbrace{\lambda_1 z_1 + \dots + \lambda_m z_m + \mu_1 u_1 + \dots + \mu_n u_n}_{=0 \text{ by (i)}})=0$ $\lambda_1 w_1 + \dots + \lambda_m w_m =0$ only if $\lambda_1=\dots = \lambda_m =0$ since $w_1, \dots, w_m$ are bases.

Prop. $T \in \mathcal{L}(V, W)$ where $V$, $W$ are finite dimensional. Then these following statements are equivalent

  1. $T$ is injective
  2. $T$ is surjective
  3. $T$ is bijective \(A=\begin{pmatrix} a_{11} &\quad &a_{1n}\\ \\ a_{m1} &\quad &a_{mn} \end{pmatrix} = (a_{ij})_{\begin{gather*} \\ i=1, \dots, m\\ j=1, \dots, n \end{gather*}}\) Consider $T \in \mathbb{L}(V, W)$, $V, W$ are finite dimensional

Let, $v_1, \dots, v_n$ be a basis of $V$ $w_1, \dots, w_m$ be a basis of $W$

  • $V = \lambda_1 v_1 + \dots + \lambda_n v_n$ $T(v)=T(\lambda_1 v_1 + \dots + \lambda_n v_n)=\lambda_1 T(v_1) + \dots +\lambda_n T(v_n)$

  • Each image vector $T(v_j)$ can be expressed in basis $w_1, \dots, w_m$ There exists coefficients $a_{1j}, \dots, a_{mj}$ such that $T(v_j) = a_{ij} w_1 + \dots + a_{mj} w_m$

  • We may now stack these coefficients in a matrix: matrix $m$ rows, one for each basis vector of $W$ $n$ columns, one for each basis vector of $V$ = matrix of mapping $T$ w.r.t. the basis $v_1, \dots, v_n$ of $V$ and $w_1, \dots, w_m$ of $W$

Notation: Let $T: V \to W$ be linear, let $B_V$ be a basis of $V$, $C_W$ basis of $W$. We denote by $M(T, B_V, C_W)$ the matrix corresponding to $T$ w.r.t bases $B_V$ and $C_W$.

Properties of Matrices.

Let $V$, $W$ vector spaces consider the basis fixed. Let $S, T \in \mathcal{L}(V, W)$

  • $M(S + T) = M(S)+M(T)$
  • $M(\lambda S) = \lambda M(S)$
  • For $v = \lambda_1 v_1 + \dots + \lambda_n v_n$ we have that \(\underbrace{T(v)}_{\text{image of V under T}} = \underbrace{M(T) \begin{pmatrix}\lambda_1\\ \dots\\ \lambda_n\end{pmatrix}}_{matrix vector product}\) where $v_1, \dots, v_n$ is basis of $V$.
  • $T: U \to V$, $S: V \to W$ linear, then $M(S \circ T) = M(S)\cdot M(T)$

Cite this post

@misc{2025-ml-math,
  title  = {Machine Learning Math},
  author = {Sayak Chowdhury},
  year   = {2025},
  howpublished = {\url{https://sykchw.github.io/blog/2025/09/27/ml-math/}},
  note   = {Blog post, accessed 2026-11-26}
}