# What prevents Factor from Working also on Arguments of Sqrt in Expressions?

Consider this example (intersection of a line and a sphere):

 x=px+d*rx;
y=py+d*ry;
z=pz+d*rz;
e1=Expand[r^2-(x-kx)^2-(y-ky)^2-(z-kz)^2];
Factor /@ Solve[e1==0,d] // InputForm


Why does Factor not find its way under the arguments of Sqrt? The result is

 {{d -> (kx*rx - px*rx + ky*ry - py*ry + kz*rz - pz*rz +
Sqrt[(2*kx*rx - 2*px*rx + 2*ky*ry - 2*py*ry + 2*kz*rz - 2*pz*rz)^2 -
4*(-kx^2 - ky^2 - kz^2 + 2*kx*px - px^2 + 2*ky*py - py^2 + 2*kz*pz - pz^2 + r^2)*
(-rx^2 - ry^2 - rz^2)]/2)/(rx^2 + ry^2 + rz^2)},
{d -> (kx*rx - px*rx + ky*ry - py*ry + kz*rz - pz*rz -
Sqrt[(2*kx*rx - 2*px*rx + 2*ky*ry - 2*py*ry + 2*kz*rz - 2*pz*rz)^2 -
4*(-kx^2 - ky^2 - kz^2 + 2*kx*px - px^2 + 2*ky*py - py^2 + 2*kz*pz - pz^2 + r^2)*
(-rx^2 - ry^2 - rz^2)]/2)/(rx^2 + ry^2 + rz^2)}}


and obviously there is a factor of 4 in the arguments of Sqrt (ok, after squaring out the first product in the sum, but even before, a factor of 2² is present there!)

In this situation, the Sqrt could even been factored before Sqrt. If the argument of Sqrt is non-numerical, one can't always simplify Sqrt[x²] to x, -x might as well be a solution. But why does it not apply such a rule for numerical factors? How would one implement that?

• How about Solve[e1 == 0, d] /. Sqrt[x_] :> Sqrt[Factor[x]] ? – vsht Jul 18 '17 at 20:48