Please, tell me, did your diagram look anything like this:
Attachment 22201
If so, then you are on the right track.
You are trying to solve in terms of x only. You know that as the value of X changes, the value of Y changes three fold. You should also know that, since point P is not stationary, you cannot always solve for D using the pythagoreum theorum.
Try finding another way to solve for the distance between two points!
Chances are, you didn't think of it because you've always gotten a numerical answer, and aren't used to getting a variable answer.