D = real(pr) / sqrt( real(pr)^2 + imag(pr)^2)

Multiply both sides by the denominator of the right side:

d (sqrt( real(pr)^2 + imag(pr)^2) = real(pr)

Square both sides:

d^2 * (real(pr)^2 + imag(pr)^2) = real(pr)^2

Distribute:

d^2 * real(pr)^2 + d^2 * imag(pr)^2 = real(pr)^2

Regroup:

d^2 * real(pr)^2 - real(pr)^2 = -d^2 * imag(pr)^2

Factor:

real(pr)^2 (d^2 - 1) = -d^2 * imag(pr)^2

Divide by (d^2 - 1):

real(pr)^2 = (-d^2 * imag(pr)^2) / (d^2 - 1)

Sqrt both sides:

real(pr) = +/- sqrt[ (-d^2 * imag(pr)^2) / (d^2 - 1) ]

Algebra 1 really.