Let's say I have a formula like $ax + by + cz = N$. $a, b, c$, and $N$ are known and cannot be changed. $x, y$, and $z$ are known and can be changed.
The problem is that the equation is not true! My problem (for a program I'm writing) is: how can $x, y$, and $z$ be changed enough that they equal $N$ while differing from their previous values as little as possible?
The solution space of the equation $ax+by+cz=N$ is a plane in three dimensions, thus for any given point, say, $(x_0,y_0,z_0)$, you may easily calculate the distance between this point and the plane of actual solutions (this is equivalent to the possibly-familiar "least-squares method", which I think is the answer you're after?)