Hey LouisLavery.

You are in effect solving an optimization problem. Since x^2 preserves the topological aspects, you can solve the same problem by optimizing (a-b)^2 is a minimum.

To start off you need to begin with a system of four equations in four unknowns. This will start you off in solving the problem.\

After this, it is a matter of using standard optimization techniques (if you can represent a-b as a separate variable then you can use this variable related to other variables and find a minimum in a multi-variable domain).