Let ρ be the mass density.
mass of metal sphere M=ρ.43πR3
mass of hollow sphere , m=ρ.43π(R/2)3=M/8
The field at that point = field due to metal sphere − field due to hollow sphere.
f=GMa2−Gm(a−R2)2=GMa2−GM8(a−R2)2=GMa2−GM8a2(1−R2a)2=GMa2⎛⎝1−18(a−R2a)2⎞⎠