If light passes near a massive object, the gravitational interaction causes of bending of the ray. This can be thought of as happening due to a change in the effective refractive index of the medium given by,
                           n(r)=1+2 GM/rc2
where r is the distance of the point of consideration from the centre of the mass of the massive body, G is the universal gravitational constant, M the mass of the body and c the speed of light in the vacuum. Considering a spherical object find the deviation of the ray from the original path as it grazes the object.