How does y=((h/(R-r))(R-r) become x=R-((R-r)/h)y

hard to say, since there is no "x" involved.

However, solving the 2nd equation for y, we get

x=R-((R-r)/h)y
((R-r)/h)y = R-x
y=(R-x)/((R-r)/h) = (R-x)h / (R-r)

so maybe you can figure out what to do the other way.