How can I transform the following equation into matrix form and differenciate?

33 Views Asked by At

How can I put the follwing equation into matrix form and differenciate with reapect to a and b?

$f(a,b) = \sum_{i=1}^4\{(a+bx_i) -y_i\}^2$

1

There are 1 best solutions below

0
On

Let vector $v$ be $$v=\begin{pmatrix} a+bx_1-y_1, & a+bx_2-y_2, & a+bx_3-y_3, &a+bx_4-y_4,\end{pmatrix}$$ Now, doing matrix multiplication, your equation can be written as $$f(a,b)=vv'$$ where $v'$ is the transpose of vector $v$. Basically, if you have sums of products like in this case, you can write it with matrix multiplication.

I will leave the differentiation to you.