# Finding $G$ in a solved least squares $d = Gm$?

This may be odd, but say someone solved $$d = Gm$$ using the least squares method and calculated the parameters vector $$m$$. I have the vector of data $$d$$, how could I solve for $$G$$ to see the matrix that was used with something like Python?

Nothing stops you from solving the Least Squares problem:

$$\arg \min_{A} \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2}$$

If we set $$f \left( A \right) = \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2}$$ then:

$$\frac{\mathrm{d} f \left( A \right) }{\mathrm{d} A} = \left( A x - b \right) {x}^{T}$$

Solving for the case will give you:

$$\arg \min_{A} \frac{1}{2} {\left\| A x - b \right\|}_{2}^{2} = {\left( x {x}^{T} \right)}^{-1} b {x}^{T}$$

But the issues is that $$\left( x {x}^{T} \right)$$ is a matrix of rank 1. Hence in real world it won't give meaningful results.

What's needed is some kind of regularization.