  Two-dimensional electron gas (2DEG) in interfaces and surfaces based on
perovskite SrTiO$_3$ (STO) has exhibited various interesting phenomena and is
used to develop oxide electronics. Recently, KTaO$_3$ (KTO) shows great
potential and is believed to host more exciting effects and phenomena toward
novel devices. Here, through first-principles investigation and analysis, we
find two types of coexisting 2DEG and 2D hole gas (2DHG) highly confined at the
interfaces in undoped STO/KTO/BaTiO$_3$ heterostructures, when the KTO
thickness $m$ reaches a crititcal value. The two interfaces are made by
(SrO)$^0$/(TaO$_2$)$^+$ and (KO)$^-$/(TiO$_2$)$^0$ for the A-type, and by
(TiO$_2$)$^0$/(KO)$^-$ and (TaO$_2$)$^+$/(BO)$^0$ for the B-type. The 2D
electron carriers originate from Ta-$5 d_{xy}$ states at the interface
including TaO$_2$ atomic layer, and the hole carriers from O-$2 p_x/p_y$
orbitals at the other interface. The electron and hole effective masses are
0.3$m_0$ and $1.06\sim 1.12 m_0$, respectively, where $m_0$ is mass of free
electron, and the 2D carrier concentrations are in the order of $10 ^{13}$
cm$^{-2}$. Our analysis indicates that the interfacial 2DEG and 2DHG are
simultaneously formed because of the band bending due to the polar
discontinuity at the interfaces and the stress-induced polarization within the
KTO layer. These could stimulate more exploration for new phenomena and novel
devices.
