It was taught: The House of Hillel said to the House of Shammai, According to your words a person builds an upper story and only afterward builds the house, as it says (Amos 9:6), He who builds His upper chambers in the heavens and has founded His vault upon the earth. The House of Shammai said to the House of Hillel, According to your words a person makes a footstool and only afterward a throne, as it says (Isaiah 66:1), The heaven is My throne and the earth is My footstool. And the Sages say, This one and that one were created as one, as it says (Isaiah 48:13), My own hand founded the earth and My right hand spread out the heavens; I call to them, they stand together. And the other one [explains], This word together means that they do not separate from one another. Rav Yehudah said in the name of Rav: Ten things were created on the first day: heaven, and earth, formlessness [tohu], and void [bohu], wind, water, light, darkness, the measure of day, and the measure of night. Heaven and earth, as it is written, In the beginning created, and so on. Formlessness and void, as it is written, And the earth was formlessness and void, and so on. Light, as it is written (verse 5), And there was evening and there was morning, one day. Formlessness [tohu] is the green line that surrounds the whole world, from which darkness comes forth. Void [bohu] is the slimy stones sunk in the deep, from which water comes forth. And light was created on the first day but set in place on the fourth day, as it says, And God placed them in the firmament of the heaven, and it is written (verse 19), And there was evening and there was morning, the fourth day. Rabbi Elazar said: The light that the Holy One, blessed be He, created on the first day, Adam would gaze and look by it from one end of the world to the other. But when He looked upon the wicked whose deeds are corrupt, He arose and hid it away, as it says (Job 38:15), And from the wicked their light is withheld. And for whom did He hide it? For the righteous in the time to come, as it says, And God saw the light, that it was good, and good means only the righteous one, as it says, Say of the righteous one that it is good, and it is written (Psalms 97:11), Light is sown for the righteous (Proverbs 13:9), and the light of the righteous rejoices.
Which Came First, Heaven or Earth, and the Hidden Light
Yalkut Shimoni on Torah 4:4
תַּנְיָא, אָמְרוּ לָהֶם בֵּית הִלֵּל לְבֵית שַׁמַּאי, לְדִבְרֵיכֶם אָדָם בּוֹנֶה עֲלִיָּה וְאַחַר כַּךְ בּוֹנֶה בַּיִת, שֶׁנֶּאֱמַר (עמוס ט, ו) "הַבּוֹנֶה בַשָּׁמַיִם מַעֲלוֹתָיו וַאֲגֻדָּתוֹ עַל אֶרֶץ יְסָדָהּ" אָמְרוּ לָהֶם בֵּית שַׁמַּאי לְבֵית הִלֵּל, לְדִבְרֵיכֶם אָדָם עוֹשֶה שְׁרַפְרַף וְאַחַר כַּךְ כִּסֵּא שֶׁנֶּאֱמַר (ישעיה סו, א) "הַשָּׁמַיִם כִּסְאִי וְהָאָרֶץ הֲדֹם רַגְלָי" וַחֲכָמִים אוֹמְרִים, אֶחָד זֶה וְאֶחָד זֶה כְּאֶחָד נִבְרְאוּ, שֶׁנֶּאֱמַר (שם מח, יג) "אַף יָדִי יָסְדָה אֶרֶץ וִימִינִי טִפְּחָה שָׁמָיִם קֹרֵא אֲנִי אֲלֵיהֶם יַעַמְדוּ יַחְדָּו" וְאִידָךְ הַאי "יַחְדָּו" דְּלֹא מִשְׁתַּלְּפֵי מֵהֲדָדֵי. אָמַר רַב יְהוּדָה אָמַר רַב, עֲשָׂרָה דְּבָרִים נִבְרְאוּ בְּיוֹם רִאשׁוֹן, שָׁמַיִם, וָאָרֶץ, תֹהוּ, וָבֹהוּ, רוּחַ, מַיִם, אוֹר, חֹשֶׁךְ, מִדַּת יוֹם, וּמִדַּת לַיְלָה שָׁמַיִם וָאָרֶץ דִּכְתִיב בְּרֵאשִׁית בָּרָא וְגוֹ'. תֹּהוּ וָבֹהוּ דִּכְתִיב וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ וְגוֹ'. אוֹר דִּכְתִיב (פסוק ה) וַיְהִי עֶרֶב וַיְהִי בֹקֶר יוֹם אֶחָד תֹהוּ זֶהוּ קַו יָרֹק הַמַּקִּיף אֶת כָּל הָעוֹלָם שֶׁמִּמֶּנּוּ יוֹצֵא חֹשֶׁךְ בֹהוּ אֵלּוּ אֲבָנִים הַמְּפֻלָּמוֹת הַמְּשֻׁקָּעוֹת בַּתְּהוֹם שֶׁמֵּהֶם יוֹצְאִים מַיִם וְאוֹר בְּיוֹם רִאשׁוֹן אִיבְרִי בְּיוֹם רְבִיעִי אִיבְרִי, שֶׁנֶּאֱמַר "וַיִתֵּן אֹתָם אֱלֹהִים בִּרְקִיעַ הַשָּׁמָיִם", וּכְתִיב (שם פסוק יט) "וַיְהִי עֶרֶב וַיְהִי בֹקֶר יוֹם רְבִיעִי" אָמַר רַבִּי אֶלְעָזָר, אוֹר שֶׁבָּרָא הַקָּדוֹשׁ בָּרוּךְ הוּא בְּיוֹם רִאשׁוֹן הָיָה אָדָם צוֹפֶה וּמַבִּיט בּוֹ מִסּוֹף הָעוֹלָם וְעַד סוֹפוֹ, וְכֵיוָן שֶׁנִּסְתַּכֵּל בָּרְשָׁעִים שֶׁמַּעֲשֵׂיהֶן מְקֻלְקָלִים עָמַד וּגְנָזוֹ, שֶׁנֶּאֱמַר (איוב לח, טו) "וְיִמָּנַע מֵרְשָׁעִים אוֹרָם", וּלְמִי גְּנָזוֹ, לַצַּדִּיקִים לֶעָתִיד לָבֹא שֶׁנֶּאֱמַר וַיַּרְא אֱלֹהִים אֶת הָאוֹר כִּי טוֹב, וְאֵין טוֹב אֶלָּא צַדִּיק, שֶׁנֶּאֱמַר "אִמְרוּ צַדִּיק כִּי טוֹב" וְגוֹ', וּכְתִיב (תהלים צז, יא) "אוֹר זָרֻעַ לַצַּדִּיק" (משלי יג, ט) וְאוֹר צַדִּיקִים יִשְׂמָח".