You just tried making that way too difficult.
first off:
x=d*cos(r)
y=d*sin(r)
you can get this merely by looking at the triangle. R is the angle and d is the hypotenuse(sp). Simple trig tells you that
cos(r)=x/d
sin(r)=y/d
so those two equations are easy to derive.
then, using pythagorean theorem
d^2=x^2+y^2
Also simple.
and then
tan(r)=y/x
simple again.
