# Transforming basis functions from Cartesian to speherical

I read the basis set from book

A d-type GTO written in terms of the spherical functions has five components (Y2,2, Y2,1, Y2,0, Y2,1, Y2,2),but there appear to be six components in the Cartesian coordinates (x2, y2, z2, xy, xz, yz). The latter six functions, however, may be transformed to the five spherical d-functions and one additional s-function (x^2 +y^2 +z^2). Similarly, there are 10 Cartesian "f-functions" which may be transformed into seven spherical f-functions and one set of spherical p-functions.

I try to solve this question in other books or lectures. However, they just told me what it is, how to fit GTO to STO (only s). I didn't know the detail how to transfrom 6 Cartesian d-functions to 5 spherical d-functions and one additional s-funcition?

The difference between cartesian and spherical basis functions is that the latter use real spherical harmonics; for instance, $$Y_{20} \propto \frac {-x^2 -y^2 +2z^2} {r^2}$$. Quantum chemistry codes evaluate the basis functions or their integrals in the cartesian basis, and then use the connection between the cartesian functions and spherical functions to obtain the basis functions or the integrals in the spherical basis.