the ray is line that is orthogonal to the derivation(tangent) of the curve in the point it crosses the curve. so function of your curve f(x) has a derivation f'(x) . the derivation function value at any x is tan(alfa) where alfa is angle of tangent to the curve in the x,f(x) point with the x axis. now, if you travel from a point [x,f(x)] in the direction that is orthogonal to that tangenting line, you should reach your point.
To rewrite the whole problem, your point is P ([d,0] in your case).
Following is defined:
P - [x,f(x)] is a vector orthogonal to derivation at point x for all x.
thus dot product of P-[x,f(x)] vector and [x,f'(x)*x] vector is always 1.0, if those vectors are normalized (length is one)
this yealds parametric equation
1.0= (d-x)*x + (0-f(x))*f'(x)*x for all x
pick your function f, find its derivation f', and from there, if possible, create a system of linear equations for 2 or 3 random x values, to compute d.