For a homework assignment in linear algebra, I have solved the following equation using MATLAB\'s \\
operator (which is the recommended way of doing it):
mldivide, ("\") actually does that too. According to the documentation:
If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B. In other words, X minimizes norm(A*X - B), the length of the vector AX - B. The rank k of A is determined from the QR decomposition with column pivoting (see Algorithm for details). The computed solution X has at most k nonzero elements per column. If k < n, this is usually not the same solution as x = pinv(A)*B, which returns a least squares solution.
So really, what you did in the first assignment was to solve the equation using LSE.