[선형대수] Lecture 17: Orthogonal matrices and Gram-Schmidt

이재호·2025년 3월 11일

선형대수

목록 보기
16/31

https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/video_galleries/video-lectures/

먼저 강의에서 다음과 같은 내용을 정리한다.

<orthonormal vectorsqiTqj={0,if ij1,if i=j\text{<orthonormal vectors\>> } \\ q_i^Tq_j= \begin{cases} 0, & \text{if } i \ne j \\ 1, & \text{if } i = j \end{cases}
orthogonal basis:q1,q2,...,qnorthogonal matrix:Q\text{orthogonal basis} : q_1,q_2,...,q_n \\ \text{orthogonal matrix} : Q
how can AQ ?“Gran-Schmidt"\text{how can $A \rightarrow Q$ ?} \rightarrow \text{``Gran-Schmidt"}

즉, orthonomal vector의 조건은 위와 같고, 이를 orthogonal basis로 구성하는 orthogonal matrix Q를 "Gran-Shcmidt" 방식으로 구할 수 있다는 것이다.


예시와 함께 보자.

Q=[q1q2...qn]Q= \begin{bmatrix} | & | & | & | \\ q_1 & q_2 & ... & q_n \\ | & | & | & | \\ \end{bmatrix}
QTQ=[(q1)T(q2)T.(qn)T][q1q2...qn]=[1  001 0....0  1]=IQ^TQ = \begin{bmatrix} -(q_1)^T- \\ -(q_2)^T- \\ . \\ -(q_n)^T- \\ \end{bmatrix} \begin{bmatrix} | & | & | & | \\ q_1 & q_2 & ... & q_n \\ | & | & | & | \\ \end{bmatrix} = \begin{bmatrix} 1 & \ & \ & 0 \\ 0 & 1 & \ & 0 \\ . & . & . & . \\ 0 & \ & \ & 1 \\ \end{bmatrix} = I

위 수식을 통해서 QTQ=IQ^TQ=I를 알 수 있다.

그리고 다음과 같이 정리할 수 있다.

If Q is square then QTQ=I tell us QT=Q1\text{If $Q$ is square then $Q^TQ=I$ tell us $Q^T=Q^{-1}$}
Ex.:Q=[001100010],Q=[cosθsinθsinθcosθ],Q=12[1111]Q=12[1111111111111111]\text{Ex.} : Q=\begin{bmatrix}0 & 0 & 1 \\1 & 0 & 0 \\0 & 1 & 0 \\\end{bmatrix}, Q=\begin{bmatrix}cos\theta & -sin\theta \\ sin\theta & cos\theta\end{bmatrix}, Q=\frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix} \\ Q=\frac{1}{2}\begin{bmatrix}1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1 \\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1\\ \end{bmatrix}

그렇다면 QQ가 rectangular(=not square)라면 어떻게 구할 수 있을까? (이 방법이 Gram-Schmidt 이다.)

Q=13[122122]13[122212221]Q= \frac{1}{3} \begin{bmatrix} 1 & -2 \\ 2 & -1 \\ 2 & 2 \\ \end{bmatrix} \rightarrow \frac{1}{3} \begin{bmatrix} 1 & -2 & 2 \\ 2 & -1 & 2 \\ 2 & 2 & 1 \\ \end{bmatrix}

위 과정은 Gram-Schmidt의 개략적인 과정을 의미한다.
좀더 자세히 알아보자.

Suppose : Q has orthonormal columns.proejct onto it’s column space.\text{Suppose : $Q$ has orthonormal columns.} \\ \text{proejct onto it's column space.}
p=Q(QTQ)1QT=QI1QT=QQT(=1 if Q is square)p=Q(Q^TQ)^{-1}Q^T=QI^{-1}Q^T=QQ^T \text{(=1 if Q is square)}
(QQT)(QQT)=QIQT=QQT(QQ^T)(QQ^T)=QIQ^T=QQ^T
ATAx^=ATbAQA^T A \hat x=A^Tb \\ A \rightarrow Q
QTQx^=QTbQ^TQ\hat x=Q^Tb
Ix^=QTbI\hat x=Q^Tb
x^=QTb\therefore \hat x=Q^Tb
x^i=qiTb\therefore \hat x_i=q_i^Tb

그럼 이제 위 식을 이용해서 Gram-Schmidt를 적용하는 절차를 알아보자.

Gram-Schmidt\text{Gram-Schmidt}
(independent vectors) a,b(orthogonal vectors) A,Borthonormal vectors q1=AAq2=BB\text{(independent vectors) $a, b$} \rightarrow \text{(orthogonal vectors) $A,B$} \\ \rightarrow \text{orthonormal vectors $q_1=\frac{A}{||A||}$, $q_2=\frac{B}{||B||}$}


그림으로 표시하면 위와 같이 서로 independent인 두 벡터 a,ba,b에 대해서 적용한다.
우선, orthogonal vector AAa=Aa=A로 봐도 무방하다. 대신에 BBAA와 perpendicuar하게 만들면 된다. 따라서 이를 위해 BBee라고 볼 수 있다.

지난 강의에서 배운 projection 방법을 적용하여 BB를 구해보자.

B=bATbATAAB=b-\frac{A^Tb}{A^TA}A

또한 다음과 같은 점도 발견할 수 있다.

ATB=AT(bATbATAA)=ATbATbATAATA=ATbATb=0A^TB=A^T(b-\frac{A^Tb}{A^TA}A)=A^Tb - \frac{A^Tb}{A^TA}A^TA=A^Tb-A^Tb=0
ATB=0AB\therefore A^TB=0 \rightarrow \text{$A \perp B$}

이렇게 orthogonal vectors를 구한 후, q1=AAq_1=\frac{A}{||A||}, q2=BBq_2=\frac{B}{||B||} 식을 통해서 orthgonormal vectors를 구하면 끝이다.

다만 위는 2개의 벡터에 대해서만 적용하였는데, 만약 벡터의 개수가 늘어난다면 어떻게 적용할 수 있을까? 예를 들어 3개의 벡터에 대해서 Gram-Schmidt를 적용한다고 해보자.

  • independent vectors a,b,ca,b,c
  • orthgonal vectors
    • A=aA=a
    • B=bATbATAAB=b-\frac{A^Tb}{A^TA}A
    • C=cATcATAABTcBTBBC=c - \frac{A^Tc}{A^TA}A - \frac{B^Tc}{B^TB}B
  • orthnormal vectors
    • q1=AAq_1=\frac{A}{||A||}
    • q2=BBq_2=\frac{B}{||B||}
    • q3=CCq_3=\frac{C}{||C||}

위와 같이 BB는 이전처럼 구하면 되고, CCAABB 모두 반영하여 구하면 된다.


예시와 함께 Gram-Schmidit을 적용해보자.

a=[111],b=[102]a=\begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}, b=\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}
A=[111]A=\begin{bmatrix}1 \\ 1 \\ 1\end{bmatrix}
B=bATbATAA=[102]33[111]=[011]B=b-\frac{A^Tb}{A^TA}A=\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}-\frac{3}{3}\begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \\ 1 \end{bmatrix}
q1=AA=13[111]q_1=\frac{A}{||A||}=\frac{1}{\sqrt3}\begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}
q2=BB=12[011]q_2=\frac{B}{||B||}=\frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ -1 \\ 1 \end{bmatrix}
Q=[1/301/31/21/31/2]\therefore Q= \begin{bmatrix}1/\sqrt3 & 0 \\ 1/\sqrt3 & -1/\sqrt2\\ 1/\sqrt3 & 1/\sqrt2 \end{bmatrix}

그리고 Gram-Schmidt를 구하는 과정을 다음과 같이 행렬로 표시할 수 있다.

A=QRA=LUA=QR \sim A=LU

즉, A=QRA=QR에서 RR은 upper triangluar matrix이다. 왜 그럴까? 다음을 보자.

A=[ab]=[q1q2]QRA= \begin{bmatrix} | & | \\ a & b \\ | & | \end{bmatrix} = \underbrace{ \begin{bmatrix} | & | \\ q_1 & q_2 \\ | & | \end{bmatrix}}_Q R

따라서 위에서 RR은 다음과 같이 나올 것이다.

[ab]=[q1q2][q1Taq1Tbq2Taq2Tb]R\begin{bmatrix} a & b \\ \end{bmatrix} = \begin{bmatrix} q_1 & q_2 \end{bmatrix} \underbrace{ \begin{bmatrix} q_1^Ta & q_1^Tb\\ q_2^Ta & q_2^Tb \end{bmatrix} }_R

그리고 q2Taq_2^Ta는 0이 나올 것이다. 왜냐하면 q2q_2a=Aa=A와 perpendicuar(orthogonal)이기 때문이다.
(대신 q1Tbq_1^Tb는 0이 아니다. 왜냐하면 bbq1Tq_1^T가 존재하는 subspace AA와 수직이라는 증명이 없기 때문이다.)
따라서 A=QRA=QR에서 RRUU(upper triangle)라고 볼 수 있다.

profile
천천히, 그리고 꾸준히.

0개의 댓글