# Math notes on Linear Algebra

|

##矩阵的伪逆 对于非方阵来讲，求逆也是可能的操作。在Matlab当中就有pinv()这个函数，称为pseudoinverse，即伪逆。这种方法常被用于求解最小二乘法。

$\left\{ {\begin{array}{*{20}{c}} {{a_{11}}{x_1} + {a_{12}}{x_2} + ... + {a_{1q}}{x_q} = {b_1}}\\ {{a_{21}}{x_1} + {a_{22}}{x_2} + ... + {a_{2q}}{x_q} = {b_2}}\\ {...}\\ {{a_{p1}}{x_1} + {a_{p2}}{x_2} + ... + {a_{pq}}{x_q} = {b_p}} \end{array}} \right. \Leftrightarrow Ax = b$

$E(x) = \sum\limits_{i = 1}^p {{{({a_{i1}}{x_1} + {a_{i2}}{x_2} + ... + {a_{iq}}{x_q} - {b_i})}^2}} = {\left| {Ax - b} \right|^2}$

$\begin{array}{l} \frac{{\partial E}}{{\partial {x_i}}} = 0(i = 1,...,q) \Leftrightarrow 2(Ax - b) \cdot \frac{{\partial (Ax - b)}}{{\partial {x_i}}} = 0\\ \Leftrightarrow {(Ax - b)_{p \times 1}} \cdot \left( {\begin{array}{*{20}{c}} {{a_{1i}}}\\ {{a_{2i}}}\\ {...}\\ {{a_{pi}}} \end{array}} \right) = 0\\ \Leftrightarrow {\left( {\begin{array}{*{20}{c}} {{a_{1i}}}&{{a_{2i}}}&{...}&{{a_{pi}}} \end{array}} \right)_{1 \times p}}{(Ax - b)_{p \times 1}} = 0\\ \Leftrightarrow \left( {\begin{array}{*{20}{c}} {{a_{11}}}&{{a_{21}}}&{...}&{{a_{p1}}}\\ {{a_{12}}}&{{a_{22}}}&{...}&{{a_{p2}}}\\ {...}&{}&{}&{}\\ {{a_{1q}}}&{{a_{2q}}}&{...}&{{a_{pq}}} \end{array}} \right){(Ax - b)_{p \times 1}} = {0_{q \times 1}}\\ \Leftrightarrow {A^T}(Ax - b) = 0 \Rightarrow {A^T}Ax = {A^T}b\\ \Rightarrow x = {({A^T}A)^{ - 1}}{A^T}b \end{array}$

Disclaimer: This is a personal weblog. The opinions expressed here represent my own and not those of any entity with which I have been, am now, or will be affiliated.