# Solving for a matrix using least squares

I am trying to understand equation 26 given equation 25.

I know that generally, if we have an overdetermined system of linear equations of the form

$$Ax = b$$

the least squares solution is

$$\hat{x} = (A^TA)^{-1}A^Tb$$

Applying it to the above equation of

$$D [R|t] = C$$

where $$[R|t]$$ is the unknown matrix, we get

$$\hat{[R|t]} = (D^TD)^{-1}D^TC$$

but that's not exactly what's shown in equation 26. How did (26) come from (25) if they are "solving linearly"?

K is a 3x3 “camera matrix”, R is a 3x3 rotation matrix, and t is a 3x1 translation vector

Thanks!

• Can you define what $K$, $R$, and $t$ are? – Wolfy Dec 20 '18 at 6:34
• Yes, sorry. K is a 3x3 “camera matrix”, R is a 3x3 rotation matrix, and t is a 3x1 translation vector – Carpetfizz Dec 20 '18 at 6:35
• Okay, please edit your question, so other people know as well :). – Wolfy Dec 20 '18 at 6:36
• These are two forms of the pseudo inverse matrix. We select one or the other depending on the dimensions of $D$, when $D$ is not square. When $D$ is square and full rank, no difference. An easy demonstration if $D$ is square: consider SVD ... – Damien Dec 20 '18 at 9:12
• A precision: if $D$ is not square, one of the two forms is invalid ... – Damien Dec 20 '18 at 9:15

In fact, equation 25 is $$[R|t] D = C$$ and not $$D [R|t] = C$$ , and indeed $$[R|t] DD^T = CD^T$$ , yielding $$\hat{[R|t]}= CD^T*(DD^T)^{-1}$$
• I start from $[R|t]D=C$ and just right multiply by $D^T$ . The least squares is valid in exactly the same way, just consider $x^T A=b^T$ in your original definition. – user617446 Dec 20 '18 at 9:53
• Thank you, do you mind pointing me to a reference that talks about how to solve $x^TA = b^T$? Does the proof work the same way as the proof for solving $Ax = b$ ? – Carpetfizz Dec 21 '18 at 1:32
• Also, did you mean "consider $x^TA^T = b^T$ ? – Carpetfizz Dec 21 '18 at 2:11
• The proof works the same way, since $x^T A-b^T = (A^T x-b)^T$ and the object to minimize, the norm squared, is the same. – user617446 Dec 23 '18 at 4:16