Set y1=x+30 and y2=x^2, plugged those into the distance formula assuming x=a,
d=rad((y2−y1)^2)
d(x)=x^2−x−30
All you have to do is to maximize the given quadratic function. I hope that this is the answer that you were looking for and it has helped you.