[선형대수] Lecture 16: Projection matrices and least squares

이재호·2025년 3월 10일

선형대수

목록 보기
15/31

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

지난번 강의에서 Ax=bAx=b에서 벡터 bb를 subspace C(A)C(A)에 project하여,

  • p=Pbp=Pb
  • P=A(ATA)1ATP=A(A^TA)^{-1}A^T 라는 것을 배웠다.

그렇다면 다음과 같이 생각해보자.

  • 만약 bb가 column space에 있다면?
  • 혹은 만약 bb가 clumn space와 orthogonal이라면? (bbATA^T의 null space에 있다면)

그림은 다음과 같다.

그리고 정리하면 다음과 같다.

If b in column spaceb=Ax.\text{If $b$ in column space} \rightarrow b=Ax.
Pb=A(ATA)1ATAx=AIx=Ax=b\rightarrow Pb=A(A^TA)^{-1}A^TAx=AIx=Ax=b
Pb=b\therefore Pb=b
If b  column spaceATb=0\text{If $b$ $\perp$ column space} \rightarrow A^Tb=0
Pb=A(ATA)1ATb=0\rightarrow Pb=A(A^TA)^{-1}A^Tb=0
Pb=0\therefore Pb=0
b=p+e=Pb+(IP)b\therefore b=p+e=Pb+(I-P)b

이를 2차원 평면에서 생각해보자.

위 데이터를 정리하면 다음과 같다.

C+D=1C+2D=2C+3D=2C+D=1 \\ C+2D=2 \\ C+3D=2
Ax=[111213][CD]=[122]Ax= \begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 3 \\ \end{bmatrix} \begin{bmatrix} C \\ D \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix}

보다시피 complete solution은 존재하지 않는다.
따라서 위 그림과 같이 error 값이 최소가 되는 y=C+Dty=C+Dt 라인(벡터)을 찾아야 한다.

Best Solution : Minimize Axb2=e2\text{Best Solution : Minimize $||Ax-b||^2=||e||^2$}

위에 ee는 error를 의미한다. 그리고 위 예시에서는 다음과 같다.

e2=e12+e22+e32||e||^2 = e_1^2 + e_2^2 + e_3^2
e12=1(C+D)2e22=2(C+2D)2e32=2(C+3D)2e_1^2=||1-(C+D)||^2 \\ e_2^2=||2-(C+2D)||^2 \\ e_3^2=||2-(C+3D)||^2

그리고 project point는 다음과 같다.

p1=C+Dp2=C+2Dp3=C+3Dp_1=C+D \\ p_2=C+2D \\ p_3=C+3D

그러면 이제 Ax=bAx=b의 최적의 솔루션 x^\hat x을 찾아보자.

Ax=bAx=b
ATAx^=ATb\rightarrow A^TA\hat x = A^Tb
ATA=[111123][111213]=[36614] (invertible, symmetric)A^TA= \begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 3 \end{bmatrix} = \begin{bmatrix} 3 & 6 \\ 6 & 14 \\ \end{bmatrix} \text{ (invertible, symmetric)}
ATb=[111123][122]=[511]A^Tb = \begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 3 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix} = \begin{bmatrix} 5 \\ 11 \\ \end{bmatrix}

즉, 다음과 같이 식을 정리할 수 있다.

3C+6D=56C+14D=113C+6D=5 \\ 6C+14D=11
D=12,C=23D=\frac{1}{2}, C=\frac{2}{3}
x^=[1/22/3]\therefore \hat x = \begin{bmatrix}1/2 \\ 2/3\end{bmatrix}

(물론, 번외로 x^\hat x을 " e2=e12+e22+e32||e||^2 = e_1^2 + e_2^2 + e_3^2 " 식을 활용하여 구할 수도 있다.)

그리고 ee를 계산하면 다음과 같다.

e1=1(C+D)=1(23+12)=16e_1 = 1-(C+D)= 1-(\frac{2}{3}+\frac{1}{2})=-\frac{1}{6}
e2=2(C+2D)=2(23+2×12)=26e_2 = 2-(C+2D)= 2-(\frac{2}{3}+2\times\frac{1}{2})=\frac{2}{6}
e3=2(C+3D)=2(23+3×12)=16e_3 = 2-(C+3D)= 2-(\frac{2}{3}+3\times\frac{1}{2})=-\frac{1}{6}

즉, ee는 다음과 같다.

e=[1/62/61/6]e=\begin{bmatrix} -1/6 \\ 2/6 \\ -1/6 \end{bmatrix}

이제 그러면 b=p+eb=p+e로 보자.

[122]b=[7/610/613/6]p+[1/62/61/6]e\underbrace{\begin{bmatrix}1 \\ 2 \\ 2\end{bmatrix}}_b = \underbrace{\begin{bmatrix}7/6 \\ 10/6 \\ 13/6\end{bmatrix}}_p + \underbrace{\begin{bmatrix}-1/6 \\ 2/6 \\ -1/6\end{bmatrix}}_e

잘 만족한다.
그리고 다음과 같은 점을 알 수가 있다.

pTe=0p and e are perpendicular(orthgornal).p^Te=0 \rightarrow \text{$p$ and $e$ are perpendicular(orthgornal).}
[111]Te=0col1([111]) in C(A) and perpendicular.\begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}^T e = 0 \rightarrow \text{$col_1(\begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix})$ in $C(A)$ and perpendicular.}
[123]Te=0col2([123]) in C(A) and perpendicular.\begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}^T e = 0 \rightarrow \text{$col_2(\begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix})$ in $C(A)$ and perpendicular.}

결과적으로 모든 위 과정들을 통해 ATAx^=ATbA^TA\hat x=A^Tbp=Ax^p=A\hat x를 구할 수가 있다.


그리고 다음과 같은 법칙이 존재한다.

If A has independent columnsthen ATA is invertible.\text{If $A$ has independent columns} \\ \text{then $A^TA$ is invertible.}

다음과 같이 증명을 해보자.

Suppose ATAx=0x must be 0 (when ATA is invertible).\text{Suppose $A^TAx=0$} \rightarrow \text{$x$ must be 0 (when $A^TA$ is invertible).}
xTATAx=0=(Ax)TAxAx=0x^TA^TAx=0=(Ax)^TAx \rightarrow Ax=0
A has independent columnsx=0\text{$A$ has independent columns} \rightarrow \therefore x=0

그리고 다음 강의에 대한 질문을 던진다.

Columns are definitely idependent if they are perpendicular unit vectors=orthonormal vectors.\text{Columns are definitely idependent if they are $\underbrace{\text{perpendicular unit vectors}}_{\text{=orthonormal vectors}}$.}
unit vectors’s ex.:[100],[010],[001]\text{unit vectors's ex.} : \begin{bmatrix}1 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 1\end{bmatrix}
profile
천천히, 그리고 꾸준히.

0개의 댓글