Neat little problem, I've not seen that one before - cheers :).
Draw a simple diagram of it, recall the geometric definition of a gradient, construct two right-angled triangles with hypotenuses being the two distances of interest, take the squares of them, and I think you want to solve:
f(x)^2 + (f(x)/f'(x))^2 = x^2 + f(x)^2 .
Don't forget the - as well as the +