LaAlO$_3$ is larger than the band gap of SrTiO$_3$, so that the Ti-$d$ states in the SrTiO$_3$ substrate and O-$p$ states in the capping SrTiO$_3$ layer overlap. Then the system becomes metallic.

Further evidence of the insulating-to-metallic transition is shown by the local density of states (LDOS) at the Fermi level of the $n$-type interface in Fig. \[fig:ldosf\]a. From the character of these states, we can see that we have Ti-$d$ states in the SrTiO$_3$ substrate and O-$p$ states on the surface. Fig. \[fig:chargespatial\] shows the spatial distributions of the conducting electrons and the holes integrated over $xy$-plane at the $n$-type and $p$-type interfaces, respectively. The details of how to extract out these transferred charge densities are provided in Appendix \[appendix-density\]. From Fig. \[fig:chargespatial\], it is clear that the conducting electrons and holes behave very differently in the SrTiO$_3$ substrate. The conducting electrons, which occupy Ti-$d$ states, decay away from the $n$-type interface over a length scale of $\simeq$ 10 unit cells, indicating that the conducting electron gas is several nm thick. This result is in qualitative agreement with experimental measurements of the superconducting electron gas [@Mannhart-Science-2007] and other theoretical calculations [@Tsymbal-PRL-2009; @Son-PRB-2009]. Unlike the conducting electrons, the spatial distribution 