티스토리 뷰

선형대수학

2. Matrix Multiplication

금복이 2024. 2. 17. 23:11

1. 행렬과 벡터의 곱의 계산적 의미

\begin{align*}
  A{x}=
  \left[
    \begin{array}{cccc}
      a_{11} & a_{12} & \ldots & a_{1n}\\
      a_{21} & a_{22} & \ldots & a_{2n}\\
      \vdots & \vdots & \ddots & \vdots\\
      a_{m1} & a_{m2} & \ldots & a_{mn}
    \end{array}
  \right]
  \left[
    \begin{array}{c}
      x_1\\
      x_2\\
      \vdots\\
      x_n
    \end{array}
  \right]
  =
  \left[
    \begin{array}{c}
      a_{11}x_1+a_{12}x_2 + \cdots + a_{1n} x_n\\
      a_{21}x_1+a_{22}x_2 + \cdots + a_{2n} x_n\\
      \vdots\\
      a_{m1}x_1+a_{m2}x_2 + \cdots + a_{mn} x_n\\
    \end{array}
  \right]
\end{align*}

결과 벡터의 각 원소는 행렬의 각 행과 벡터의 내적이다.

 

행렬 곱의 다양한 계산적 해석

1. https://angeloyeo.github.io/2020/09/08/matrix_multiplication.html\

2. https://eli.thegreenplace.net/2015/visualizing-matrix-multiplication-as-a-linear-combination/

 

 

 

2. Column의 Linear combination(선형 결합)으로 이해하기

\begin{align*}
Ax = \begin{bmatrix} \mathbf{a}_1 &  \mathbf{a} _2 & \cdots &  \mathbf{a} _n \\ \end{bmatrix}
\begin{bmatrix}  x _{1} \\ x_{2} \\ \vdots \\ x_{n} \\ \end{bmatrix} = 
x_{1} \mathbf{a}_{1} + x_{1} \mathbf{a}_{1}  + ... x_{n} \mathbf{a}_{n}\end{align*}

 

Note : 행렬과 벡터의 곱을 이해하는 매우 중요한 관점이다.

 

오른쪽 피연산자가 벡터가 아니라 행렬이라면, 오른쪽 행렬의 각 열(vector)과의 linear combination을 한 후 결과 벡터들을 concat 하면 된다.

 

행렬이 선형 변환이라는 사실은 매우 중요하다. 행렬과 선형변환은 행렬이 선형 변환이라는 사실에 의거하여, 행렬과 벡터의 곱이 왜 행렬의 열의 linear combination인지 설명한다.

 

Properties of Multiplication : $AB \neq BA$, $(AB)C = (AB)C$. 행렬과 행렬의 곱은 선형변환의 합성이다. 이에 기반하여 생각해보면 자명한 속성임을 알 수 있다.

 

 

Properties of Transpose : $(A+B)^{T} = A^{T} + B^{T}, (AB)^{T} = B^{T}A^{T}$

 

Let $\mathbf{v} \in \mathbb{R}^{n}$ and $\mathbf{w} \in \mathbb{R}^{n}$ 

Inner product of vectors : $\mathbf{v} \cdot \mathbf{w} = \mathbf{v}^{T} \mathbf{w} \in \mathbb{R}$

 

Let $\mathbf{v} \in \mathbb{R}^{n}$ and $\mathbf{w} \in \mathbb{R}^{m}$ 

Outer product of vectors : $\mathbf{v} \otimes \mathbf{w} = \mathbf{v} \mathbf{w}^{T} \in \mathbb{R}^{n \times m}$

 

 

 

3. Some Special Matrices

Identity matrix $I$ : $n \times n$ square matrix $I$ that has diagonal entries all $1$ and off-diagonal entris all $0$, i.e., $I_{3}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}$

 

For $m \times n$ matix $A$, $AI = A$ and $n \times m$ matrix $A$, $IA = A$

 

 

Permutation matrix $P$ : $(n \times n)$ binary matrix that has exactly one enrty $1$ in each row and each column

  • $P =\begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}$, $PA$ moves the first row (of $A$) to the second, and second to first
  • $AP$ moves the second column to the first, and first to second

 

 

Diagonal matrix $D$ : $(n \times n)$ square matrix that has only diagonal entries nonzero and all others zero

  • $D =\begin{bmatrix} 2 & 0 & 0\\ 0 & 3 & 0 \\ 0 & 0 & 4 \end{bmatrix}$, $DA$ doubles the first row(of $A$), triples the second row, and quadriples the third row
  • $AD$ double the fist column, ...

 

 

Inverse matrix $A^{-1}$ : For $n \times n$ matrix $A$, the inverse matrix is a $n \times n$ square matrix $A^{-1}$ satisfying $AA^{-1} = I$ and $A^{-1}A = I$ and $(A^{-1})^{T} = (A^{T})^{-1}$

 

 

 

4. Linear Equations as Matrix-Vector Multiplication

The linear equations
\begin{align*}
x_{1} + 3x_{2} + 4x_{3} &= 2 \\ x_{1} + 7x_{2} - x_{3} &= -1 \\ x_{1} + 4x_{2} + x_{3} &= 5
\end{align*}

 

can be rewritten as

$$A \mathbb{x} = \mathbb{b}$$

 

where $A= \begin{bmatrix} 1 & 3 & 4  \\ 1 & 7 & -1  \\ 1 & 4 & 1  \\ \end{bmatrix}, \mathbf{x} = \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \end{bmatrix}, \mathbf{b} = \begin{bmatrix} 2 \\ -1 \\ 5 \end{bmatrix} $

 

 

선형 결합으로 나타낼 수 있으므로

 

 

\begin{align*}
 x_{1} \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} + x_{2} \begin{bmatrix} 3 \\ 7 \\ 4 \end{bmatrix} + x_{3} \begin{bmatrix} 4 \\ -1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ -1 \\ 5 \end{bmatrix} 
\end{align*}

 

즉세 벡터의 span에 $ \begin{bmatrix} 2 \\ -1 \\ 5 \end{bmatrix} $가 없다면 해가 없는 것이다.

'선형대수학' 카테고리의 다른 글

6. Rank and Linear Independence  (0) 2024.02.27
5. Subspaces  (0) 2024.02.25
4. Inverse Matrices  (0) 2024.02.20
3. Gaussian Elimination and LU Factorization  (0) 2024.02.18
1. Vectors and Matrices  (0) 2024.02.17
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31