[SOLVED] help with derivation

I have spent hours on this and cant see where Im going wrong. First before I explain my problem here is the formula that I am working with...

where

and are known values

I want to know how to change to a set value by adding another and w, which I will denote and . I appreciate this is a 2-dimensional problem so I would like to know the value of which would make = a given value if I also set to be a given value. To do this I have tried to derive an equation in the form where f is some function.

Given the 'extra values' and , the formula for now becomes...

where

and are known values

To simplify things, let

which can all be evaluated given we have values for and . So, now for the derivation...

Everything seems right but when I test it by finding and substituting back into the formula I am not getting the right result for . Where am I going wrong???

Any help much appreciated.