Simplest answer, squares are positive. After that we can ignore signs and add all the terms. Once we divide by N and take the square root, it still comes out positive.

Algorithmically, well, that’s a little more involved, obviously. Keep in mind that the line is not data, it is meta data, that’s why M and B are what’s important, not X. M is the rate, and B is the median range when X is zero.