In my book an equation is stated for the gravitational potential $V(r,\theta$$V(r,\theta)$ of a nearly spherical body, such as the Earth. It says that the equation is derived using Laplace's equation though the derivation is not given and it contains the terms $J_0$, $J_2$, $J_3$, as well as the terms $P_0$, $P_1$, $P_2$: $$V(r,\theta)=-\frac{GM}{r}\Big(J_0P_0-J_1\frac{a}{r}P_1(\cos{\theta})-J_2\frac{a^2}{r^2}P_2(\cos{\theta}) ...\Big)$$ As the derivation is not given, it is not clear to me at all what the $J_i$ and $P_i$ terms stand for. It says that the $J_i$ terms represent the distribution of mass, but what does that mean? And what do the $P_i$ terms mean?
Any help is welcome!