The debate of Yajnavalkya with Gargi and his teacher Uddalaka is in Brihadaranyaka Upanishad.
III-vii-1: Then Uddalaka, the son of Aruna, asked him. ‘Yajnavalkya’,
said, ‘in Madra we lived in the house of Patanchala Kapya (descendant
of Kapi), studying the scriptures on sacrifices. His wife was possessed
by a Gandharva. We asked him who he was. He said, "Kabandha, the
son of Atharvan". He said to Patanchala Kapya and those who studied
the scriptures on sacrifices, "Kapya, do you know that Sutra by which
this life, the next life and all beings are held together ?" Patanchala
Kapya said, "I do not know it, sir". The Gandharva said to him and the
students, "Kapya, do you know that Internal Ruler who controls this and
the next life and all beings from within ?" Patanchala Kapya said, "I do
not know Him, sir". The Gandharva said to him and the students, "He
who knows that Sutra and that Internal Ruler as above indeed knows
Brahman, knows the worlds, knows the gods, knows the Vedas, knows
beings, knows the self, and knows everything". He explained it all to
them. I know it. If you, Yajnavalkya, do not know that Sutra and that
Internal Ruler, and still take away the cows that belong only to the
knowers of Brahman, your head shall fall off’. ‘I know, O Gautama, that
Sutra and that Internal Ruler’. ‘Any one can say, "I know, I know". Tell
us what you know.’
III-vii-2: He said, ‘Vayu, O Gautama, is that Sutra. Through this Sutra or
Vayu this and the next life and all beings are held together. Therefore,
O Gautama, when a man dies, they say that his limbs have been
loosened, for they are held together, O Gautama, by the Sutra or
Vayu.’ ‘Quite so, Yajnavalkya. Now describe the Internal Ruler.’
III-vii-3: He who inhabits the earth, but is within it, whom the earth
does not know, whose body is the earth, and who controls the earth from within, is the Internal Ruler, your own immortal self.
III-vii-4: He who inhabits water, but is within it, whom water does not
know, whose body is water, and who controls water from within, is the
Internal Ruler, your own immortal self.
III-vii-5: He who inhabits fire, but is within it, whom fire does not know,
whose body is fire, and who controls fire from within, is the Internal
Ruler, your own immortal self.
III-vii-6: He who inhabits the sky, but is within it, whom the sky does
not know, whose body is the sky, and who controls the sky from within,
is the Internal Ruler, your own immortal self.
III-vii-7: He who inhabits air, but is within it, whom air does not know,
whose body is air, and who controls air from within, is the Internal
Ruler, your own immortal self.
III-vii-8: He who inhabits heaven, but is within it, whom heaven does
not know, whose body is heaven, and who controls heaven from within,
is the Internal Ruler, your own immortal self.
III-vii-9: He who inhabits the sun, but is within it, whom the sun does
not know, whose body is the sun, and who controls the sun from within,
is the Internal Ruler, your own immortal self.
III-vii-10: He who inhabits the quarters, but is within it, whom the
quarters does not know, whose body is the quarters, and who controls
the quarters from within, is the Internal Ruler, your own immortal self.
III-vii-11: He who inhabits the moon and stars, but is within it, whom
the moon and stars does not know, whose body is the moon and stars,
and who controls the moon and stars from within, is the Internal Ruler,
your own immortal self.
III-vii-12: He who inhabits the ether, but is within it, whom the ether
does not know, whose body is the ether, and who controls the ether
from within, is the Internal Ruler, your own immortal self.
III-vii-13: He who inhabits darkness, but is within it, whom darkness
does not know, whose body is darkness, and who controls darkness
from within, is the Internal Ruler, your own immortal self.
III-vii-14: He who inhabits light, but is within it, whom light does not
know, whose body is light, and who controls light from within, is the
Internal Ruler, your own immortal self. This much with reference to the
gods. Now with reference to the beings.
III-vii-15: He who inhabits all beings, but is within it, whom no being
knows, whose body is all beings, and who controls all beings from
within, is the Internal Ruler, your own immortal self. This much with
reference to the beings. Now with reference to the body.
III-vii-16: He who inhabits the nose, but is within it, whom the nose
does not know, whose body is the nose, and who controls the nose
from within, is the Internal Ruler, your own immortal self.
III-vii-17: He who inhabits the organ of speech, but is within it, whom
the organ of speech does not know, whose body is the organ of
speech, and who controls the organ of speech from within, is the Internal Ruler, your own immortal self.
III-vii-18: He who inhabits the eye, but is within it, whom the eye does
not know, whose body is the eye, and who controls the eye from
within, is the Internal Ruler, your own immortal self.
III-vii-19: He who inhabits the ear, but is within it, whom the ear does
not know, whose body is the ear, and who controls the ear from within,
is the Internal Ruler, your own immortal self.
III-vii-20: He who inhabits the mind (Manas), but is within it, whom the
mind does not know, whose body is the mind, and who controls the
mind from within, is the Internal Ruler, your own immortal self.
III-vii-21: He who inhabits the skin, but is within it, whom the skin does
not know, whose body is the skin, and who controls the skin from
within, is the Internal Ruler, your own immortal self.
III-vii-22: He who inhabits the intellect, but is within it, whom the
intellect does not know, whose body is the intellect, and who controls
the intellect from within, is the Internal Ruler, your own immortal self.
III-vii-23: He who inhabits the organ of generation, but is within it,
whom the organ of generation does not know, whose body is the organ
of generation, and who controls the organ of generation from within, is
the Internal Ruler, your own immortal self. He is never seen, but is the
Witness; He is never heard, but is the Hearer; He is never thought, but
is the Thinker; He is never known, but is the Knower. There is no other
witness but Him, no other hearer but Him, no other thinker but Him, no
other knower but Him. He is the Internal Ruler, your own immortal self.
Everything else but Him is mortal.’ Thereupon Uddalaka, the son of
Aruna, kept silent.
After brief Question Answer session between Gargi and Shree Yajnavalkya Rushi , Shree Uddalaka Aruni , Yajnavalkya's own teacher came forward to question him.
Uddalaka Aruni begins by asking Yajnavalkya about the Inner controller (Anteryamin ,अंतरयामी ).He made it quite clear to Yajnavalkya that he knows the answer to his
question.Thereupon Yajnavalkya gives a grand speech about Atman as the inner controller , and Uddalka Aruni eventually is silent.