The electric field within the cavity or outside is the
superposition of the electric field due to the original
uncut sphere, plus the electric field due to a sphere of
the size of the cavity but with a uniform negative charge
density. The effective charge distribution is composed
of a uniformly charged sphere of radius R, charge
density `rho`, superposed on it is a charge density - `rho` filling
the cavity. An electric field `vecE_1` is caused by the charge
distribution `+rho` at a point `vecr` inside the spherical cavity.

`vecE_1 = (rhor)/(3epsilon_0) r^2 = (rhovecr)/(3epsilon_0)`
where `hatr` is a unit vector in radial direction. Similarly, the electric field `vecE_2` formed by the charge density `-rho`
inside the cavity is
`vecE_2 = (rho(-vecs))/(3epsilon_0)`
Here, `vecs` is the radius vector from the cavity centre to
the point P. From vector triangle
`vecr = veca + vecs or vecs = vecr - veca`
`:. vecE_2 = (-rho(vecr-veca))/(3epsilon_0)`
The resultant electric field inside the cavity is, therefore,
given by the superposition of `vecE_1 and vecE_2`. So
`vecE= vecE_1 + vecE_2 = (rhovecr)/(3epsilon_0) + [(-rho(vecr-veca))/(3epsilon_0)] = + (rhoveca)/(3epsilon_0)` = constant.
`:. vecE = (rhoveca)/(3epsilon_0)`
ii. (a) Electric field at points inside the large sphere but
outside the cavity :
`vecE_1 = (rhovecr)/(3epsilon_0)`
and `vecE_2 = 1/(4piepsilon_0) (q(-vecs))/(s^3) = -((4/3pirhob^3)(vecr - veca))/(4epsilon_0|(vecr -veca)|)`
The resultant electric field is
`vecE = vecE_1 + vecE_2 = rho/(3epsilon_0)[vecr - (b/(vecr -veca))^3 (vecr-veca)]`
(b) Electric field at points outside the large sphere,
`vecE_1 = Q_t otal)/(4piepsilon_0r^3) vecr = (4/3piR^3rho)/(4piepsilon_0r^3) vecr = (R^3rho)/(3epsilon_0r^3) vecr `
`vecE_2 = Q_(t otal)/(4piepsilon_0s^3) vecs = (-(4/3pib^3rho))/(4piepsilon_0(|vecr -veca|)^3) (vecr - veca)`
`= (-rhob^3)/(3epsilon_0(|vecr-veca|)^3 (vecr-veca)`
The resultant electric field is
`vecE = vecE_1 + vecE_2 = (rho)/(3epsilon_0) [(R/r)^3 vecr - (b/(vecr-veca))^3 (vecr-veca)]`
`:. E (vecr) = {((rhoveca)/(3epsilon_0)), (rho/(3epsilon_0)[vecr-(b/|vecr-veca|)^3 (vecr-veca)]), (rho/(3epsilon_0)[(R/r)^3vecr - (b/|vecr-veca|)^3 (vecr-veca)]`:}`
Electric field inside the cavity
Electric field outside the cavity but inside the large cavity
electric field outside the large sphere .