The data is put in matrix form: \[ \tiny\begin{bmatrix} y_{1}\\ y_{2}\\ y_{3} \end{bmatrix}_{Y}=\begin{bmatrix} 1 & x_{1} \\ 1 & x_{2} \\ 1 & x_{3} \end{bmatrix}_{X}\begin{bmatrix} \beta_{0} \\ \beta_{1} \end{bmatrix}_{\beta}+\begin{bmatrix} e_{1} \\ e_{2} \\ e_{3} \end{bmatrix}_{e} \] Where \(\beta\) contains the coefficients and \(e\) contains the error between actual points and the model. The coefficients that minimize \(e\) can be found by: \[ \small\beta=(X^{T}X)^{-1}X^{T}Y \] The equation for the fit is given by: \[ \small y=\beta_{0}+\beta_{1}x \]