Given these values:
$$x_1 = \left\{1, 3, 6, 8\right\}$$ $$x_2 = \left\{2, 8, 5, 10\right\}$$ $$y = \left\{8.6, 30.8, 34.1, 53.8\right\}$$
And this formula
$$y = m_1x_1 + m_2x_2$$
How do I determine $m_1$ and $m_2$?
(In this case I purposely chose that values $m_1=3.6$ and $m_2=2.5$. I know how to do this in Excel using Linest, but I need the formula itself.)
Let ${y_{Est}}_i = m_1{x_1}_i + m_2{x_2}_i$ be the estimated $y$ value.
Then the error $e_i = {y_{Est}}_i - y_i = m_1{x_1}_i + m_2{x_2}_i - y_i$
The sum of the squared errors is $\sum e_i^2 = \sum (m_1{x_1}_i + m_2{x_2}_i - y_i)^2$
We want minimise this with respect to $m_1$ and $m_2$
$\frac {\partial \sum e_i^2}{\partial m_1} = 2\sum {x_1}_i(m_1{x_1}_i + m_2{x_2}_i - y_i)=0$
$m_1 \sum {{x_1}_i}^2 + m_2 \sum {x_1}_i{x_2}_i - \sum {x_1}_i y_i=0$
$\frac {\partial \sum e_i^2}{\partial m_2} = 2\sum {x_2}_i(m_1{x_1}_i + m_2{x_2}_i - y_i)=0$
$m_1 \sum {x_1}_i{x_2}_i + m_2 \sum {{x_2}_i}^2 - \sum {x_2}_i y_i=0$
This gives you a pair of simultaneous equations to solve to find $m_1$ and $m_2$.