最小二乘法矩阵推导

已知方程组
(1) A x = b Ax=b \tag{1} Ax=b(1)
定义能量函数
(2) E = ∑ ( A x − b ) 2 = ∥ A X − b ∥ 2 2 E=\sum {{\left({Ax-b} \right)}^2} =\Vert {AX-b} \Vert_{2}^{2} \tag{2} E=(Axb)2=AXb22(2)
要使能量函数E最小,即
(3) m i n x ∈ R n E \underset {x \in R^n}{min}{E} \tag{3} xRnminE(3)
对能量函数E求偏导
(4) ∂ E ∂ x = ∂ ∥ A x − b ∥ 2 2 ∂ x                         = ∂ ( A x − b ) T ( A x − b ) ∂ x                                                = ∂ ( x T A T A x − x T A T b − b T A x + b T b ) ∂ x \frac {\partial {E}}{\partial {x}} =\frac {\partial {\Vert {Ax-b} \Vert_{2}^{2}}}{\partial x}\newline \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space=\frac {\partial \left(Ax-b\right)^{T}\left(Ax-b\right)}{\partial x} \newline \space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\quad\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space=\frac {\partial \left(x^TA^TAx-x^TA^Tb-b^TAx+b^Tb\right)}{\partial x} \tag{4} xE=xAxb22                       =x(Axb)T(Axb)                                             =x(xTATAxxTATbbTAx+bTb)(4)
因为
(5) ∂ x T A ∂ x = ∂ A T x ∂ x = A \frac {\partial x^TA}{\partial x}=\frac {\partial A^Tx}{\partial x}=A \tag{5} xxTA=xATx=A(5)

(6) ∂ x T A x ∂ x = A x + A T x \frac {\partial x^TAx}{\partial x}=Ax+A^Tx \tag{6} xxTAx=Ax+ATx(6)

所以
(7) ∂ E ∂ x = 2 A T A x − 2 A T b \frac {\partial {E}}{\partial {x}}=2A^TAx-2A^Tb \tag{7} xE=2ATAx2ATb(7)

(8) ∂ E ∂ x = 0 \frac {\partial {E}}{\partial {x}}=0 \tag{8} xE=0(8)

(9) 2 A T A x − 2 A T b = 0 2A^TAx-2A^Tb=0 \tag{9} 2ATAx2ATb=0(9)
因此
x = ( A T A ) − 1 A T b x={\left(A^TA\right)^{-1}}A^Tb x=(ATA)1ATb

你可能感兴趣的:(最小二乘法矩阵推导)