본문 바로가기

Fundamental

[Math] Useful Mathematical Identities and Tricks 정리

본 포스트에서는 수식을 유도할 때 자주 사용되는 수학적 성질 또는 트릭에 대하여 정리한다. 필자는 주로 SLAM과 관련된 분야에 대한 수식과 논문을 많이 접하기 때문에 이와 관련된 수식을 정리한다.

 

Skew-symmetric matrix 

3차원 벡터 $\mathbf{v} = [v_x, v_y, v_z]^{\intercal} \in \mathbb{R}^{3}$가 있을 때 이에 대한 반대칭 행렬을 $[\mathbf{v}]_{\times} = \begin{bmatrix} 0&-v_z&v_y \\ v_z & 0 & -v_x \\ -v_y & v_x & 0 \end{bmatrix}$라고 하면 다음과 같은 성질이 성립한다.

\begin{equation}
 \boxed{   \begin{aligned}
&[\mathbf{v}]_{\times}^{\intercal} = -[\mathbf{v}]_{\times} \\ 
& [\mathbf{v}]_{\times}^{2} = \mathbf{v}\mathbf{v}^{\intercal} - \mathbf{v}^{\intercal}\mathbf{v}\mathbf{I} \\
& [\mathbf{R}\mathbf{v}]_{\times} = \mathbf{R} [\mathbf{v}]_{\times} \mathbf{R}^{\intercal}
    \end{aligned}  }
\end{equation}

- $\mathbf{R} \in SO(3)$ : 임의의 회전 행렬

 

만약 $\left\| \mathbf{u} \right\|=1$을 만족하는 단위 벡터 $\mathbf{u}$가 주어진 경우 아래 공식이 성립한다.

\begin{equation}
 \boxed{   \begin{aligned}
&[\mathbf{u}]_{\times}^{3} = [\mathbf{u}]_{\times}^{\intercal} = -[\mathbf{u}]_{\times} \\ 
& [\mathbf{u}]_{\times}^{2} = \mathbf{u}\mathbf{u}^{\intercal} - \mathbf{I} \\
 \end{aligned}  }
\end{equation}

 

임의의 두 벡터 $\mathbf{a}, \mathbf{b} \in \mathbb{R}^{3}$가 주어졌을 때 다음 법칙이 성립한다.

\begin{equation}
 \boxed{   \begin{aligned}
& [\mathbf{a}]_{\times} \mathbf{b} = -[\mathbf{b}]_{\times} \mathbf{a}
    \end{aligned}  }
\end{equation}

 

임의의 세 벡터에 대하여 $\mathbf{a} = \mathbf{b} \times \mathbf{c}$ 관계가 주어진 경우 외적의 성질에 의해 다음 공식이 성립한다.

\begin{equation}
 \boxed{   \begin{aligned}
& [\mathbf{a}]_{\times} = \mathbf{cb}^{\intercal} - \mathbf{bc}^{\intercal}
    \end{aligned}  }
\end{equation}

 

Determinant of matrix

$\mathbf{X} \in \mathbb{R}^{2\times 2}$ 행렬에 대한 행렬식(determinant)은 다음과 같다.

\begin{equation}
\begin{aligned}
& \mathbf{X} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}
& \text{det}(\mathbf{X}) = ad-bc
    \end{aligned}  
\end{equation}

 

임의의 정방행렬 $\mathbf{A,B} \in \mathbb{R}^{n \times n}$에 대하여 행렬식은 다음과 같은 성질을 지닌다.

\begin{equation}
\boxed{ \begin{aligned}
& \text{det}(\mathbf{A}^{\intercal}) = \text{det}(\mathbf{A}) \\
& \text{det}(c\mathbf{A}) = c^n \text{det}(\mathbf{A}) \\
& \text{det}(\mathbf{AB}) = \text{det}(\mathbf{A})\text{det}(\mathbf{B})\\
& \text{det}(\mathbf{A}^{-1}) = \frac{1}{\text{det}(\mathbf{A})} \\
    \end{aligned} }
\end{equation}

 

Trace of matrix

Trace란 임의의 행렬 $\mathbf{A}$가 주어졌을 때 행렬의 trace는 행렬의 대각 성분의 합을 의미하며 $\text{tr}(\mathbf{A})$와 같이 표기한다.

\begin{equation}
    \begin{aligned}
\text{tr} (\mathbf{A}) = \sum_{i} [A]_{ii}
    \end{aligned}  
\end{equation}

- $[\mathbf{A}]_{ij}$ : 행렬 $\mathbf{A}$의 $i$행 $j$열의 원소

 

Trace는 다음과 같은 성질을 지닌다.

\begin{equation}
  \boxed{  \begin{aligned}
& \text{tr} (\mathbf{A}) = \text{tr} (\mathbf{A}^{\intercal}) \\
& \text{tr} (\mathbf{AB}) = \text{tr} (\mathbf{BA}) \\
& \text{tr} (\mathbf{A} + \mathbf{B}) = \text{tr} (\mathbf{A}) + \text{tr} (\mathbf{B}) \\
& \text{tr} (\mathbf{ABC}) = \text{tr} (\mathbf{BCA}) = \text{tr} (\mathbf{CAB}) \\
& \text{tr} (\mathbf{A}^{\intercal}\mathbf{B}) = \sum_{i=1}^{n}\sum_{j=1}^{n} [\mathbf{A}]_{ij}[\mathbf{B}]_{ij} \\
& \mathbf{a}^{\intercal}\mathbf{b} = \text{tr}(\mathbf{ba}^{\intercal})
    \end{aligned}  }
\end{equation}

- $\mathbf{a}$ : 임의의 벡터

 

Linear transformation of Gaussian random variable

벡터 랜덤 변수 $\mathbf{x} \in \mathbb{R}^{n}$가 가우시안 분포를 따를 때는 다음과 같이 표기할 수 있다.
\begin{equation}
    \begin{aligned}
        \mathbf{x} \sim \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma})
    \end{aligned}
\end{equation}

$\mathbf{x}$를 선형 변환(linear transformation)한 새로운 랜덤변수 $\mathbf{y} = \mathbf{Ax} + \mathbf{b}$가 주어졌다고 하면 $\mathbf{y}$는 아래와 같은 확률 분포를 따른다.
\begin{equation}
    \boxed{ \begin{aligned}
    \mathbf{y} & = \mathbf{Ax} + \mathbf{b} \\ 
   & \sim \mathcal{N}(\mathbf{A}\boldsymbol{\mu} + \mathbf{b}, \mathbf{A}\boldsymbol{\Sigma}\mathbf{A}^{\intercal})
    \end{aligned} }
\end{equation}

 

 

SO(3) Group

각속도 벡터 $\boldsymbol{\phi} \in \mathbb{R}^{3}$이 주어졌을 때 이에 exponential mapping을 수행하면 회전 행렬 $\mathbf{R}$을 얻는다. 아래와 같은 둘 사이의 변환 관계를 Rodrigues' formula라고 한다.

\begin{equation}
 \boxed{   \begin{aligned}
\mathbf{R} = \exp([\boldsymbol{\phi}]_{\times}) = \mathbf{I} + \frac{\sin (\left\| \boldsymbol{\phi} \right\|) }{\left\| \boldsymbol{\phi} \right\|} [ \boldsymbol{\phi} ]_{\times} + \frac{1 - \cos(\left\| \boldsymbol{\phi} \right\|)}{\left\| \boldsymbol{\phi} \right\|^{2}} [ \boldsymbol{\phi} ]_{\times}^{2}
    \end{aligned}  }
\end{equation}

 

만약 각속도 벡터 $ \boldsymbol{\phi} \in \mathbb{R}^{3}$의 크기가 작은 경우 다음과 같이 근사할 수 있다.

\begin{equation}
 \boxed{   \begin{aligned}
\exp([ \boldsymbol{\phi} ]_{\times}) \simeq \mathbf{I} + [ \boldsymbol{\phi} ]_{\times}
    \end{aligned}  }
\end{equation}

 

Exponential mapping은 다음과 같은 유용한 성질을 지닌다.

\begin{equation}
 \boxed{   \begin{aligned}
& \mathbf{R}\exp([\boldsymbol{\phi}]_{\times}) \mathbf{R}^{\intercal} = \exp(\mathbf{R}[\boldsymbol{\phi}]_{\times}\mathbf{R}^{\intercal}) = \exp([\mathbf{R}\boldsymbol{\phi}]_{\times}) 
    \end{aligned}  }
\end{equation}


위 식으로부터 다음 동치 관계가 성립한다.
\begin{equation} 
 \boxed{   \begin{aligned} 
 \exp([\boldsymbol{\phi}]_{\times}) \mathbf{R} = \mathbf{R} \exp([\mathbf{R}^{\intercal}\boldsymbol{\phi}]_{\times}) 
    \end{aligned}  } 
\end{equation}

Capital exponential and logarithmic mapping

수식 전개의 편리를 위해 $\text{Exp}(\cdot), \text{Log}(\cdot)$ 연산자를 다음과 같이 정의한다.
\begin{equation} 
 \boxed{   \begin{aligned} 
& \text{Exp}(\boldsymbol{\omega}) = \exp([ \boldsymbol{\omega} ]_{\times}) = \mathbf{R} \\ 
& \text{Log}(\mathbf{R})  = \boldsymbol{\omega} \\ 
    \end{aligned}  } 
\end{equation}
- $\log(\mathbf{R}) = [\boldsymbol{\omega}]_{\times}$

 

Perturbation on SO(3) 

임의의 회전행렬 $\mathbf{R} \in SO(3)$가 주어졌을 때 이를 지수 매핑(exponential mapping)에 대한 식으로 표현하면 다음과 같다.
\begin{equation} 
 \begin{aligned} 
\mathbf{R} = \text{Exp}(\boldsymbol{\omega})
\end{aligned} 
\end{equation}
- $\mathbf{R} \in SO(3)$
- $\boldsymbol{\omega} \in so(3)$
- $\text{Exp}(\boldsymbol{\omega}) = \exp([\mathbf{x}]_{\times})$
- $[\boldsymbol{\omega}]_{\times}$ : 3차원 벡터 $\boldsymbol{\omega}$의 반대칭행렬(skew-symmetric matrix)

임의의 작은 변화량 $\Delta \boldsymbol{\omega}$이 주어졌을 때 이를 기존 $\text{Exp}(\boldsymbol{\omega})$에 업데이트 하는 방법은 다음과 같은 두 가지 방법이 존재한다. 우선 [1] 기본적인 lie algebra를 사용한 업데이트 방법이 있다. 다음으로 [2] 섭동(perturbation) 모델을 활용한 업데이트 방법이 있다. 
\begin{equation}
  \begin{aligned}
     \text{Exp}(\boldsymbol{\omega} + \Delta \boldsymbol{\omega}) \quad \cdots \text{[1]} \\ 
     \text{Exp}(\boldsymbol{\omega}) \text{Exp}(\Delta \boldsymbol{\omega}) \quad \cdots \text{[2]} 
  \end{aligned}
\end{equation}

두 방법 사이에는 다음과 같은 변환 관계가 존재한다.
\begin{equation} \label{eq:app4}
\boxed{ \begin{aligned}
& \text{Exp}(\boldsymbol{\omega}+ \Delta \boldsymbol{\omega} ) =\text{Exp}(\boldsymbol{\omega})   \text{Exp}(\mathbf{J}_{r} \Delta \boldsymbol{\omega})  \\
&\text{Exp}(\boldsymbol{\omega})  \text{Exp}(\Delta \boldsymbol{\omega})  = \text{Exp}(\boldsymbol{\omega}+ \mathbf{J}_{r}^{-1}\Delta \boldsymbol{\omega} ) \\
\end{aligned} }
\end{equation}
- $\mathbf{J}_r = \mathbf{J}_r(\Delta \boldsymbol{\omega})$
- $\mathbf{J}_{r}(\mathbf{u}) = \mathbf{I} + \Big( \frac{1-\cos\left\| \mathbf{u} \right\|}{\left\| \mathbf{u} \right\|} \Big) \frac{[\mathbf{u}]_{\times}}{ \left\| \mathbf{u} \right\| } + \Big( 1 - \frac{ \sin\left\| \mathbf{u} \right\| }{ \left\| \mathbf{u} \right\| } \Big) \frac{ [\mathbf{u}]_{\times}^2 }{ \left\| \mathbf{u} \right\|^2 }$ : SO(3)군의 오른쪽 자코비안(right jacobian)
- $\mathbf{J}_{r}(\mathbf{u})^{-1} = \mathbf{I} + \frac{1}{2}[\mathbf{u}]_{\times} + \Big( \frac{1}{\left\| \mathbf{u} \right\|^2} - \frac{1 + \cos(\left\| \mathbf{u} \right\|)}{2\left\| \mathbf{u} \right\|\sin(\left\| \mathbf{u} \right\|)} \Big) [\mathbf{u}]_{\times}^2$ : SO(3)군의 오른쪽 자코비안의 역행렬

위 식에서 $\mathbf{J}_{r}$을 SO(3)군의 오른쪽 자코비안(right jacobian)이라고 부르며 $\mathbf{J}_{r}^{-1}$을 SO(3)군의 오른쪽 자코비안의 역행렬(inverse right jacobian)이라고 부른다.

만약 업데이트 위치가 $\text{Exp}(\boldsymbol{\omega})  \text{Exp}(\Delta \boldsymbol{\omega})$처럼 오른쪽이 아닌 $\text{Exp}(\Delta \boldsymbol{\omega})\text{Exp}(\boldsymbol{\omega})$와 같이 왼쪽에 곱해진다면 위와 유사한 공식이 유도되며 그 때 나오는 자코비안은 SO(3)군의 왼쪽 자코비안(left jacobian) $\mathbf{J}_{l}$이라고 한다. $\mathbf{J}_{l}^{-1}$ 또한 동일하게 유도된다.
\begin{equation}
\begin{aligned}
& \text{Exp}(\boldsymbol{\omega}+ \Delta \boldsymbol{\omega} ) = \text{Exp}(\mathbf{J}_{l} \Delta \boldsymbol{\omega}) \text{Exp}(\boldsymbol{\omega}) \\
& \text{Exp}(\Delta \boldsymbol{\omega}) \text{Exp}(\boldsymbol{\omega}) = \text{Exp}(\boldsymbol{\omega}+ \mathbf{J}_{l}^{-1}\Delta \boldsymbol{\omega} ) \\
\end{aligned}
\end{equation}

 

 

References

[1] Kay, Steven M. Fundamentals of statistical signal processing: estimation theory. Prentice-Hall, Inc., 1993.