Matrix Algebra

Matrix โ€” The mother of all data structures. The nonmathematical uses of the word matrix reflect its Latin origins in mater, or motherโ€ฆ The word has two meanings โ€” a representation of a linear mapping and the basis for all our existence.

Linear Systems

Linear algebra๋Š” ํ˜•ํƒœ์˜ the system of linear equations์— ๋Œ€ํ•œ ์„ฑ์งˆ์„ ํƒ๊ตฌํ•œ๋‹ค.

์ด ๋Š” row picture๋กœ๋Š” n๊ฐœ์˜ plane์— ๋Œ€ํ•œ intersection์ด๋ฉฐ, column picture๋กœ๋Š” A์˜ column vectors๋“ค์˜ ์กฐํ•ฉ์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ๋Š” column picture๋กœ์จ ๋ฌธ์ œ๋ฅผ ์ฃผ๋กœ ๋ฐ”๋ผ๋ณธ๋‹ค.

Vector Products

๋‘ ๊ฐœ์˜ Vector๋ฅผ ๊ฐ€์ •ํ•˜์ž.

์ผ๋ฐ˜์ ์œผ๋กœ vector๋Š” column vector๋ฅผ ์˜๋ฏธํ•œ๋‹ค.

  • Inner product (dot product, ๋‚ด์ ) : scalar
  • Outer product (์™ธ์ ) : matrix
  • Elementwise product (์›์†Œ๊ณฑ) : vector

Matrix Multiplication

, ๋ผ๊ณ  ํ•˜์ž. ์ด ๋•Œ, ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

๋ชจ๋ฅด๋Š” ์‚ฌ๋žŒ์ด ์—†์„ ๊ณต์‹์ธ๋ฐ, ๊ธฐ๋ณธ์ ์œผ๋กœ A์˜ row vector๋ฅผ ์›์†Œ๋กœ ๊ฐ€์ง€๋Š” vector์™€ B์˜ column vector๋ฅผ ์›์†Œ๋กœ ๊ฐ€์ง€๋Š” vector์— ๋Œ€ํ•ด์„œ, ์›์†Œ ๊ฐ„ ๊ณฑ์„ inner product๋ผ๊ณ  ํ–ˆ์„ ๋•Œ์˜ outer product๋กœ ๊ณ„์‚ฐ๋œ๋‹ค.

๋˜ํ•œ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ‘œํ˜„ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

์ฆ‰, A์˜ column vector๋ฅผ ์›์†Œ๋กœ ๊ฐ€์ง€๋Š” vector์™€ B์˜ row vector๋ฅผ ์›์†Œ๋กœ ๊ฐ€์ง€๋Š” vector์— ๋Œ€ํ•ด์„œ, ์›์†Œ ๊ฐ„ ๊ณฑ์„ outer product๋ผ๊ณ  ํ–ˆ์„ ๋•Œ์˜ inner product๋กœ ๊ณ„์‚ฐ๋œ๋‹ค.

Matrix Multiplication์„ ํšจ์œจ์ ์ด๊ณ  ๋น ๋ฅด๊ฒŒ ํ•˜๋Š” ๊ฒƒ์ด ํ•™์Šต ์†๋„๋ฅผ ๊ฒฐ์ •ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด ๋ถ€๋ถ„์„ ์—ด์‹ฌํžˆ ํŒŒ๋ณด๋Š” ๊ฒƒ๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™๋‹ค.

Determinant and Positive Definite

Determinant of a Matrix

A์˜ determinant๋Š” A์˜ row vector๋“ค๋กœ ํ‘œํ˜„๋œ -dimensional space ์ƒ์˜ parallelepiped ์˜ ๋ถ€ํ”ผ์™€ ๊ฐ™๋‹ค.

์•„๋งˆ Matrix๋ฅผ ํ•˜๋‚˜์˜ ๊ฐ’์œผ๋กœ ํ‘œํ˜„ํ•œ๋‹ค๋ฉด ๊ฐ€์žฅ ํ”ํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ๊ฐ’์ด ๋ฐ”๋กœ determinant ์ด๋‹ค. (Determinant ๊ฐ’์ด ์Œ์ˆ˜๋ผ๋ฉด ๊ณต๊ฐ„์˜ ๋ฐฉํ–ฅ(orientation)์ด ๋’ค์ง‘ํžŒ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค.)

Determinant์™€ ๊ด€๋ จ๋œ ๊ณต์‹์€ ๋งŽ์ง€๋งŒ, ์•„๋ž˜ ์ •๋„๋งŒ ๊ธฐ์–ตํ•ด๋„ ๊ณ ์ฐจ์› ์ˆ˜ํ•™์„ ๋‹ค๋ฃฐ ์˜ˆ์ •์ด ์•„๋‹ˆ๋ผ๋ฉด ๋ณ„ ๋ฌธ์ œ๋Š” ์—†์—ˆ๋˜ ๊ฒƒ ๊ฐ™๋‹ค.

  • A matrix has an inverse matrix if and only if
  • If is triangular, then . In Particular, .

๊ฐ„ํ˜น invese matrix๋ฅผ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋‚ด์—์„œ ์ง์ ‘ explicitํ•˜๊ฒŒ ๊ณ„์‚ฐํ•˜๋„๋ก ์ฝ”๋“œ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์ด ์žˆ๋Š”๋ฐ, ๋†’์€ ํ™•๋ฅ ๋กœ ๋ป—์–ด๋ฒ„๋ฆดํ…Œ๋‹ˆ ๊ผญ ํ”ผํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค.

Symmetric Positive Definite (SPD) Matrix

Symmetric Positive Definite(SPD) ๋Š” ์ดํ›„ ๋‹ค๋ฃฐ Optimization ๋‚ด์šฉ์—์„œ ์ค‘์š”ํ•˜๊ฒŒ ์‚ฌ์šฉ๋˜๋Š” ์„ฑ์งˆ์ด๋‹ค.

SPD์˜ ์ •์˜๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • Symmetric:
  • Positive Definite (or positive semi-definite): if (or ) for all nonzero , denoted by (or ).

๋งŒ์•ฝ ๊ฐ€ full rank๋ฅผ ๊ฐ€์ง€๊ณ  ์ด๋ฉด, ๋Š” SPD์ด๋‹ค.

์ฐธ๊ณ ๋กœ Covariance Matrix๋Š” SPD์ด๋‹ค.

where .

The Cholesky Factorization

The Cholesky Factorization๋Š” SPD matrix๊ฐ€ ๊ฐ–๋Š” ์ค‘์š”ํ•œ ์„ฑ์งˆ๋กœ, ๋ชจ๋“  SPD๋Š” positive diagonal entry๋ฅผ ๊ฐ–๋Š” upper-triangular matrix๋กœ uniqueํ•˜๊ฒŒ ๋ถ„ํ•ด๋œ๋‹ค.

Theorem: Cholesky factorization Every SPD matrix has a uniqe Cholesky factorization

where is an upper-triangular matrix with positive diagonal entries.

์œ„ ์„ ๋กœ ํ‘œํ˜„ํ•˜๊ธฐ๋„ ํ•œ๋‹ค.

Tests for Positive Definiteness

์–ด๋–ค Matrix๊ฐ€ Positive Definite์ธ์ง€ ํŒ๋ณ„ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™ ์€ ๊ฒƒ๋“ค์ด ์žˆ๋‹ค.

  • All the eigenvalues of satisfy .

  • All the upper left submatrices have positive determinants.

  • -matrix is positive definite when and .

Linear Algebra

Linear Dependency and Basis

  • The vectors ์— ๋Œ€ํ•ด ์„ ๋งŒ์กฑํ•˜๋Š” ์กฐ๊ฑด์ด ์˜ค์ง ์ด๋ฉด, ์ด๋Š” linearly independent ์ด๋‹ค. (๋ฐ˜๋Œ€๋Š” linearly dependent)

    • ๋งŒ์•ฝ ๋“ค์ด linearly dependentํ•˜๋ฉด, ๋“ค ์ค‘ ํ•˜๋‚˜()๋ฅผ ๋‚˜๋จธ์ง€ vector๋“ค ์˜ linear combination์œผ๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์–ด๋–ค vector space ์— ๋Œ€ํ•ด, ๋‚ด ๋ชจ๋“  vector ๋ฅผ ๋“ค์˜ linear combination๋“ค๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ, ๋“ค์ด ๋ฅผ ์ƒ์„ฑ(span)ํ•œ๋‹ค๊ณ  ๋งํ•œ๋‹ค.

  • ๋งŒ์•ฝ ๋‹ค์Œ ์กฐ๊ฑด๋“ค์ด ๋งŒ์กฑ๋˜๋Š” ๊ฒฝ์šฐ ๋ฅผ ์˜ basis ๋ผ๊ณ  ํ•œ๋‹ค.

    1. โ€™s are linearly independent.
    2. spans the space .
  • Vector space ์˜ basis๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” vector์˜ ์ˆ˜๋ฅผ ์˜ dimension ์ด๋ผ๊ณ  ํ•œ๋‹ค.

Norms

  • Let be a vector space with elements .
    ์ด ๋•Œ, ๋‹ค์Œ ์กฐ๊ฑด๋“ค์„ ๋งŒ์กฑํ•˜๋Š” real-valued function ์„ norm ์ด๋ผ๊ณ  ํ•œ๋‹ค:
    1. for any
    2. if and only if
    3. , where is an arbitrary scalar
    4. (triangular inequality)

์ƒˆ๋กœ์šด Norm์„ ๋งŒ๋“ค ๋•Œ, triangular inequality๋ฅผ ๋งŒ์กฑํ•˜๋Š”์ง€ ๊ผญ ์ฒดํฌํ•ด์•ผํ•œ๋‹ค.

Vector Norms

  • Vector -norm:

  • Manhattan:

  • Euclidian:

  • Chebyshev:

Matrix Norms

  • Matrix -norm
  • Frobenius norm

Matrix Operation on Vectors

Linear Transformations

๋งŒ์•ฝ ํŠน์ • ๊ณต๊ฐ„์˜ basis๋“ค์— ๋Œ€ํ•œ linear transformation () ๋ฅผ ์•ˆ๋‹ค๋ฉด, ์šฐ๋ฆฌ๋Š” ๊ทธ ๊ณต๊ฐ„ ์ „์ฒด์— ๋Œ€ํ•œ linear transformation์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

  • Linearity: If , then .

์ž์ฃผ ์‚ฌ์šฉ๋˜๋Š” linear transformation์œผ๋กœ๋Š” Scaling, Rotation, Identity, Projection, Reflection ๋“ฑ์ด ์žˆ๋‹ค.

Projection Using Inner Products

WANT: project to .

  • if

  • in general

    • ์ด ๋•Œ, ๋ฅผ projection matrix ๋ผ๊ณ  ํ•œ๋‹ค.

Least Squares

Least Squares Solution

Theorem: Least Squares Solution The least squares solution to :

satisfies the following normal equation :

Least square ๋ฌธ์ œ๋Š” ์•„๋ž˜ figure์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋“ฏ์ด Ax ์œ„๋กœ์˜ b์˜ projection ๋ฌธ์ œ์™€ ๋™์ผํ•˜๋‹ค.

์ด๋Š” ์•ž์œผ๋กœ ๋‚˜์˜ฌ ์ˆ˜๋งŽ์€ dimension reduction ๊ธฐ๋ฒ•์˜ ๊ฐ€์žฅ ๊ธฐ์ดˆ๊ฐ€ ๋œ๋‹ค.

  • If is invertible, then

  • If is the projection of b onto the column space of , then ,
    where is an orthogonal projection matrix given by

  • is said to be a projection if .

  • is an orthogonal projection if and .

Orthogonal Matrix

  • Matrix ์˜ column๊ณผ row vector๋“ค์ด orthogonal unit vectors (orthonormal vectors)์ด๋ฉด, i.e. , ์ด ๋•Œ์˜ ๋ฅผ orthogonal matrix๋ผ๊ณ  ํ•œ๋‹ค.

Orthogonal matrix๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ข‹์€ ์„ฑ์งˆ์„ ๊ฐ€์ง„๋‹ค.

Orthogonal matrix๋ฅผ ์ด์šฉํ•œ transformation์€ lengths์™€ inner products๋ฅผ ๋ณด์กดํ•œ๋‹ค.

Theorem: Orthogonal Matrix If the columns of are an orthonormal basis for a subspace , then the least squares problem becomes easy

The projection of and the unique orthogonal projection matrix onto the column space is

๋งŒ์•ฝ ์˜ column๋“ค์ด orthonormal basis์ด๋ฉด, ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์“ธ ์ˆ˜ ์žˆ๋‹ค.

์–ด๋–ค vector๋ฅผ ๋‹ค๋ฅธ basis๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ธฐ๋ฒ•์œผ๋กœ, ์ด ์—ญ์‹œ dimension reduction์„ ํฌํ•จํ•œ feature transformation ๊ธฐ๋ฒ•์˜ ๊ธฐ์ดˆ๊ฐ€ ๋œ๋‹ค.