0
$\begingroup$

Given two column-vectors, A = [0; 1.6818; 2.8284; 3.8337; 4.7568; 5.6234] and B = [0; 984.7; 1590.7; 2029.1; 2251.9; 2254.45], I need to find a scalar x, such that it satisfies the following condition:

$Ax = B$

Using Matrix calculation, it can be easily solved as follows:

$ \boldsymbol{A}x = \boldsymbol{B}\\ \implies x = \boldsymbol{A}^{-1}\boldsymbol{B} \\ \implies x = {(\boldsymbol{A^T}\boldsymbol{A})}^{-1}\boldsymbol{A^T}\boldsymbol{B} \\ \textrm{(Taking pseudo-inverse of A)} $

Solving this gives x = 467.8599.

Which is correct, since I verified it in MATLAB using:

x = A\B
x = linsolve(A, B)

Now my question is, can I obtain the same result if I approach this problem as finding a least square solution of the regression Ax = B. That is, can I obtain x = 467.8599 by minimizing for E where,

$E = \frac{1}{2}\sum_{n=1}^{6}{{\{A_nx - B_n\}}^2}$

If yes, can you please explain how.

Also let me know if there is some mistake in my understanding. Thanks in advance.

$\endgroup$
3
  • 3
    $\begingroup$ read the Matlab documentation, the implementations you mention perform least squares on non-square matrices $\endgroup$
    – ReneBt
    Commented Apr 6, 2018 at 8:11
  • $\begingroup$ Thanks for the pointer. Yeah, it performs QR decomposition on non-square matrices (LU Factorization if square matrices). $\endgroup$
    – Koustav
    Commented Apr 6, 2018 at 9:24
  • $\begingroup$ Yes, you just did, tow different ways. Here's another: x = pinv(A)*B $\endgroup$ Commented Apr 6, 2018 at 11:48

1 Answer 1

0
$\begingroup$

You are looking for a minimum of $E$.

Therefore, just have to choose the value of $x$ such as the derivative of $E$ wrt $x$ is 0.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.