A charge distribution has spherical symmetry if the density of charge depends only on the distance from a point in space and not on the direction. In other words, if the system is rotated, it doesn't look different. For instance, if a sphere of radius R is uniformly charged with charge density ρ0, then the distribution has spherical symmetry. On the other hand, if a sphere of radius R is charged so that the top half of the sphere has a uniform charge density ρ1 and the bottom half has a uniform charge density ρ2, then the sphere does not have spherical symmetry as the charge density depends on the direction. Thus, it is not the shape of the object but rather the shape of the charge distribution that determines whether or not a system has spherical symmetry. Suppose a sphere has four different shells, each with uniform charge density. Although the charge density in the entire sphere is not uniform, the function depends only on the distance from the center and not on the direction. Therefore, this charge distribution does have spherical symmetry.
In all spherically symmetrical cases, the electric field at any point must be radially directed because the charge and, hence, the field must be invariant under rotation. Therefore, using spherical coordinates with their origins at the center of the spherical charge distribution, the electric field only becomes the function of distance. To find the electric field, a Gaussian surface, which is a closed spherical surface with the same center as the center of the charge distribution, is constructed to find the electric field. Thus, the direction of the area vector of an area element on the Gaussian surface at any point is parallel to the direction of the electric field at that point. Further, the electric field magnitude over this surface is the same at all points. So, the electric flux over the surface is the product of the electric field magnitude and the surface area. The electric field magnitude can be obtained using this in Gauss's law.
When a spherical charge distribution occupies a volume, two concentric Gaussian spheres are constructed inside and outside the sphere to find the electric field inside and outside the sphere. The charge enclosed depends on the distance r of the field point relative to the radius of the charge distribution R. If point P is located outside the charge distribution, then the Gaussian surface containing P encloses all charges in the sphere. In this case, the enclosed charge equals the sphere's total charge. On the other hand, if point P is within the spherical charge distribution, then the Gaussian surface encloses a smaller sphere than the sphere of charge distribution. In this case, the charge enclosed is less than the total charge present in the sphere. Using the Gauss's law expression, the magnitude of the electric field at a point outside and inside the sphere can be obtained.