[Mathematics for Machine Learnig] Linear Algebra (2)

1. Linear Algebra - (2)

Vector Space

Matrix는 Vector를 변환하거나 Vector Space를 정의하는 등 Matrix와 Vector는 매우 밀접한 연관이 있다.


Group

Definition of Group:

  • Consider a set G4\mathcal{G}^4 and an operator ⊗\otimes : G\mathcal{G} × G\mathcal{G} → G\mathcal{G} defined on G\mathcal{G}. Then G := (G\mathcal{G}, ⊗\otimes) is called group if the following holds:

    • Closure(닫힘성): 어떠한 Operation ⊗\otimes 에 대하여 ∀x,y∈G\forall{x,y}\in\mathcal{G} 인 x,yx, y 에 대하여 x⊗y∈Gx\otimes y \in \mathcal{G} 이다.
    • Associativity(결합법칙): ∀x,y,z∈G\forall{x,y,z}\in\mathcal{G} 에 대하여 (x⊗y)⊗z=x⊗(y⊗z)(x\otimes y) \otimes z = x\otimes (y \otimes z) 이다.
    • Neutral element(중립원) or Identity element: ∃e∈G, ∀x∈G\exists{e}\in\mathcal{G},\ \forall{x}\in\mathcal{G}: x⊗e=xx\otimes e = x and e⊗x=xe\otimes x = x
    • Inverse element(역원): ∀x∈G, ∃y∈G\forall{x}\in\mathcal{G},\ \exists{y}\in\mathcal{G} : x⊗y=ex\otimes y = e and y⊗x=ey\otimes x = e 이면 y=x−1y = x^{-1}를 xx 의 inverse 라고 부른다.
    • Commutative(Abelian group): ∀x,y∈G\forall{x,y}\in\mathcal{G}: x⊗y=y⊗xx\otimes y = y\otimes x. 벡터공간에서의 덧셈은 아벨군이라고도 부름.

Vector Group의 예시는 다음과 같다.

  1. (Z,+)(\mathbb{Z},+) 는 Group이다.

    • Closure: 두 정수를 더하면 여전히 정수임.
    • Associativity: 정수의 덧셈은 결합 법칙을 만족.
    • Neutral element: 0.
    • Inverse element: x,−xx, -x
  2. (N0,+)(\mathbb{N}_0, + ) 는 Group이 아니다.

    • Inverse element 가 존재하지 않는다. (e.g. <0, 1>)
  3. (Z,⋅)(\mathbb{Z},\cdot) 는 Group이 아니다.

    • Inverse element 가 존재하지 않는다. (e.g. <4, 1> → inverse = 1/4)
  4. (R,⋅)(\mathbb{R}, \cdot) 는 Group이 아니다.

    • Inverse element 가 존재하지 않는다. (e.g. <0, 1>)
  5. (Rm×n,+)(\mathbb{R^{m\times n}}, +) 는 Abelian Group 이다.

    • 실수 행렬에 대해서 덧셈은 조건들을 만족함.

(Z\mathbb{Z}=정수, N0\mathbb{N}_0=0을 포함한 자연수)


Vector Spaces

Definition of Vector Space:

  • A real-valued vector space V=(V,+,⋅)V=(\mathcal{V}, +, \cdot) 는 다음과 같은 두가지 연산이 정의된 set V\mathcal{V} 이고

    • Vector Addition : V+V→V\mathcal{V}+\mathcal{V}→\mathcal{V}
    • Scalar multiplication : R×V→V\mathbb{R}\times \mathcal{V}→\mathcal{V}
  • 이 두가지 연산이

    • (V,+)(\mathcal{V}, +) is an Abelian group
    • Distributivity:

       ∀λ∈R, x,y∈V\ \forall{\lambda}\in\mathbb{R},\ x,y\in\mathcal{V} : λ⋅(x+y)=λ⋅x+λ⋅y\lambda\cdot(x+y)=\lambda\cdot x+\lambda\cdot y

      ∀λ,ψ∈R, x∈V\forall{\lambda,\psi}\in\mathbb{R},\ x\in\mathcal{V}: (λ+ψ)⋅x=λ⋅x+ψ⋅x(\lambda+\psi)\cdot x = \lambda\cdot x + \psi\cdot x

    • Associativity: ∀λ,ψ∈R, x∈V\forall{\lambda,\psi}\in\mathbb{R},\ x\in\mathcal{V}: λ(ψ⋅x)=(λψ)⋅x\lambda(\psi\cdot x) = (\lambda\psi)\cdot x
    • Neutral element with respect to the dot operation: x∈Vx\in\mathcal{V} : 1⋅x=x1\cdot x=x

    위의 네 가지를 모두 만족하면 V\mathcal{V} 는 Vector Space이다.


추가적으로 Vector Subspace 의 정의는 다음과 같다.

  • Let V=(V,+,⋅)V = (\mathcal{V}, +, \cdot) be a vector space and U⊆V\mathcal{U} \subseteq \mathcal{V}, U≠∅\mathcal{U} \neq \emptyset. Then U=(U,+,⋅)\mathcal{U}=(\mathcal{U},+,\cdot) is called vector subspace of VV (or linear subspace) if U\mathcal{U} is a vector space with the vector space operations + and ⋅\cdot restricted to U×U\mathcal{U} \times \mathcal{U} and R×U\mathbb{R}\times \mathcal{U} (closed). We write U⊆VU \subseteq V to denote a subspace U\mathcal{U} of V

예를 들어,

The solution of a homogeneous system of linear equations Ax=0Ax = 0 with unknown xx is a subspace of Rn\mathbb{R}^n 이다.

아래의 그림에서는 Vector space (R2,+,⋅)(\mathbb{R}^2, +, \cdot) 에 대하여 A, B, C, D 중 D만이 Vector subspace이다.

image.png


Linear Independence


Linear Combination

Definition of Linear Combination:

  • Vector Space VV 의 vectors x1,x2,…,xk∈Vx_1, x_2, …, x_k \in V 와 scalars λ1,λ2,…,λk∈R\lambda_1, \lambda_2, …, \lambda_k \in \mathbb{R} 에 대하여 이 둘의 조합 v=∑i=1kλixi∈Vv = \sum_{i=1}^k \lambda_i x_i \in V 를 Linear Combination 이라고 한다.

Linear (In)dependence

Definition of Linear (In)dependence:

  • Let us consider a vector space V with k∈Nk \in \mathbb{N} and x1,...,xk∈Vx_1 , ..., x_k \in V . If there is a non-trivial linear combination, such that 0=∑i=1kλixi0 = \sum_{i=1}^k \lambda_i x_i with at least one λi≠0\lambda_i \neq 0, the vectors x1,...,xkx_1 , ..., x_k are linearly dependent. If only the trivial solution exists, i.e., ∀λi=0\forall\lambda_i = 0, the vectors x1,...,xkx_1 , ..., x_k are linearly independent
  • 즉 Linearly independent 하려면, 어떤 vector도 나머지 vector들의 linear combination으로 나타낼 수 없음을 의미함. (λixi=0\lambda_i x_i = 0 의 해가 모든 Scalar가 0이 되는것 뿐)
  • Row-Echelon Form 의 형태를 만들면, 해당 Vector의 Linear (In)dependence 를 체크할 수 있다.

Basis and Rank


Span

Definition of Generating set and Span:

  • Consider a vector space V=(V,+,⋅)V = (\mathcal{V}, +, \cdot) and set of vectors A={x1,...,xk} ⊆VA = \{x_1 , ..., x_k\} \ \subseteq \mathcal{V}. If every vector v∈Vv \in \mathcal{V} can be expressed as a linear combination of x1,...,xkx_1 , ..., x_k , A\mathcal{A} is called a generating set of VV. The set of all linear combinations of vectors in A\mathcal{A} is called the span of A\mathcal{A}. If A\mathcal{A} spans the vector space VV , we write V=span(A)V = span(\mathcal{A}) or V=span(x1,...,xk)V = span(x_1 , ..., x_k)

즉 Vector Space VV 안에 존재하는 Vector V\mathcal{V} 들로 구성된 임의의 set A\mathcal{A} 에 대하여, Vector space 안의 모든 Vector가 set A\mathcal{A} 안의 vector들의 linear combination 으로 표현이 가능하다면 A\mathcal{A} 는 VV 의 generating set이다. 즉, A\mathcal{A} 안의 vector 들이 Vector space VV 를 생성한다.

A\mathcal{A} 안에 포함된 모든 벡터들의 linear combination을 A\mathcal{A} 의 span 이라고 하며, 만약 A\mathcal{A} 의 span이 Vector Space VV 와 같다면 V=span(A)V = span(\mathcal{A}) 라고 표현할 수 있다.


Basis

Definition of Basis:

  • Consider a vector space V=(V,+,⋅)V = (\mathcal{V}, +, \cdot) and A⊆V\mathcal{A} \subseteq \mathcal{V}. AA generating set A\mathcal{A} of VV is called minimal if there exists no smaller set A′⊆A⊆V\mathcal{A}^′ \subseteq \mathcal{A} \subseteq \mathcal{V} that spans VV . Every linearly independent generating set of VV is minimal and is called a basis of VV .

즉 Basis는 Vector Space AA 에 대한 minimal generating set의 linear independent vector set 라고 할 수 있다.

(e.g. R2,B={e1,e2}\mathbb{R}^2, \mathcal{B} = \{\mathbf{e}_1, \mathbf{e}_2 \})

Vector들의 Linear independence를 파악하기 위해서, 앞서 배운 Gaussian elimination을 사용할 수 있다.

Gaussian elimination을 거치면 Vector는 RREF 형태로 나오게 되고, 모든 Column에 대해서 Pivot이 존재한다면 linear independent 하다.

image.png

예를 들어, 위의 B2\mathcal{B_2} 를 RREF로 만들면 B2={[1,0,0]T,[0,1,0]T,[0,0,1]T}\mathcal{B}_2 = \{ [1, 0,0]^T, [0, 1 ,0]^T, [0,0,1]^T\} 가 되므로 linearly independent하고 각 vector로 R3\mathbb{R}^3 공간 상의 모든 Vector를 표현할 수 있는 mininmal generating set이므로, R3\mathbb{R}^3 의 Basis 라고 할 수 있다.


Dimension and Rank

Definition of Dimension:

  • There can be many basis of a vector space.
  • However, all bases possess the same number of basis vectors.
  • The number of basis vectors are called dimension of the vector space.
  • The dimension is not necessarily the number of elements in a vector.

즉 Dimension은 해당 Vector Space를 생성하기 위한 최소한의 Vector 수 를 뜻하며, 이는 곧 Basis 의 vector 수를 의미한다.

Definition of Rank:

  • The number of linearly independent columns of a matrix A∈Rm×nA \in \mathbb{R}^{m×n}
  • (=) The number of linearly independent rows of a matrix A∈Rm×nA \in \mathbb{R}^{m×n}
  • The columns of AA span a subspace U⊆RmU \subseteq \mathbb{R}^m with dim(U)=rk(A)dim(U) = rk(A). This subspace is called image or range
  • A matrix A has full rank if rk(A)=min(n,m)rk(A) = min(n, m)
  • A square matrix B∈Rm×mB \in \mathbb{R}^{m×m} is invertible iff BB has full rank

Ref:

  • POSTECH CSED343 (Prof. Dongwoo Kim)
  • Mathematics for Machine Learning, Marc Peter Deisenroth, A. Aldo Faisal, and Cheng Soon Ong, Cambridge University Press 2020