Mathematically you can solve an equation, a x equals b. And yet, its u ti basely one line. Most of the code is just getting the matrix set up and the b set up. That's one of many ways you can do it. Least squares is actually an approximate solution to theiner inartbreak equation.