For convenience of exposition I use spherical harmonics here, but there are no essential differences if other basis sets are used.