Lord Brahmā was born out of the transcendental body of Lord Viṣṇu, and Lord Śiva was born out of the body of Brahmā. Lord Viṣṇu, therefore, is the supreme cause. In the Vedas also it is stated that in the beginning there was only Viṣṇu, Nārāyaṇa; there was no Brahmā or Śiva. Similarly, Śaṅkarācārya confirmed this: nārāyaṇaḥ paraḥ. Nārāyaṇa, or Lord Viṣṇu, is the origin, and Brahmā and Śiva are manifested after creation. Lord Viṣṇu is also ātmeśvara, the Supersoul in everyone. Under His direction, everything is prompted from within. For example, in the beginning of the Śrīmad-Bhāgavatam it is stated, tene brahma hṛdā: He first educated Lord Brahmā from within.
In Bhagavad-gītā (BG 10.2) Lord Kṛṣṇa states, aham ādir hi devānām: Lord Viṣṇu, or Kṛṣṇa, is the origin of all demigods, including Lord Brahmā and Lord Śiva. In another place in Bhagavad-gītā (BG 10.8) Kṛṣṇa states, ahaṁ sarvasya prabhavaḥ: "Everything is generated from Me." This includes all the demigods. Similarly, in the Vedānta-sūtra: janmādy asya yataḥ (SB 1.1.1). And in the Upaniṣads is the statement yato vā imāni bhūtāni jāyante. Everything is generated from Lord Viṣṇu, everything is maintained by Him, and everything is annihilated by His energy. Therefore, by their actions and reactions, the energies which come from Him create the cosmic manifestations and also dissolve the whole creation. Thus the Lord is the cause and also the effect. Whatever effect we see is the interaction of His energy, and because the energy is generated from Him, He is both cause and effect. Simultaneously, everything is different and the same. It is said that everything is Brahman: sarvaṁ khalv idaṁ brahma. In the highest vision, nothing is beyond Brahman, and therefore Lord Brahmā and Lord Śiva are certainly nondifferent from Him.