Since this is not from a problem set but just something I've been thinking, please forgive me for possible (wording) errors.
Consider a set of data points $(x_n,b_n)$. We would like to know the function of the regression line for these points.
To obtain the function of the regression line, we can substitute $(x_n,b_n)$ into $Ax=b$.
For example, for (1,2) (3,5), we know $1\cdot\beta+t=2$ and $3\cdot\beta+t=5$, which can be expressed as $$ \left[ \begin{array}{cc|c} 1&1&2\\ 3&1&5 \end{array} \right] $$
From here, we may obtain the beta value through solve the $AA^T x^*=A^T b$.
The question has now become, does the computer adopt this method to compute beta?
Consider every multiplication as an operation, this method seems to take a lot of operations (in $A A^T$ and $A^T b$ for example). How would this method be efficient at all?
What I am looking for is either a justification that justifies the efficiency of this method (implying that the computer is using this method to compute beta), or an alternative method that the computer employs and provide a justification that why that alternative method is more efficient than this illustrated one.
The calculation "using matrices" ends up exactly the same as what user1892304 obtained. If the data points are $(x_i, y_i)$, the matrix equations are $$ A^T A \pmatrix{\beta_1 \cr \beta_2} = A^T B $$ where $$ A = \pmatrix{x_1 & 1\cr x_2 & 1\cr \ldots & \ldots\cr x_n & 1\cr},\ B = \pmatrix{y_1\cr y_2\cr \ldots\cr y_n\cr}$$ so that $$ A^T A = \pmatrix{ \sum_i x_i^2 & \sum_i x_i\cr \sum_i x_i & n\cr},\ A^T B = \pmatrix{\sum_i x_i y_i\cr \sum_i y_i\cr} $$
Completely blind matrix calculation, not taking advantage of the facts that $A^T A$ is symmetric (so the $(2,1)$ entry is the same as the $(1,2)$ entry) and that the second column of $A$ is all $1$'s, will do some unnecessary arithmetic, but it's still $O(n)$, and many modern linear algebra codes are highly optimized for today's processors, so these computations will be blindingly fast. Then the final solution of a $2 \times 2$ system is very easy.