In MN 62 the Buddha instructs his son on how to practice meditation on the breath. He begins with subsidiary themes including the brahmaviharas which are intended to bring the mind to balance from either over-activity or lack of energy. This is in line with the instructions under the third foundation of mindfulness, to “steady” the mind, or “gladden” it, whichever is necessary.
SN 42.8 and AN 10.208 describe how deeds done resulting in a constricted mind state cannot remain in a mind permeated by the boundless spatial quality of the brahmaviharas:
"That disciple of the noble ones, headman — thus devoid of covetousness, devoid of ill will, unbewildered, alert, mindful — keeps pervading the first direction [the east] with an awareness imbued with good will, likewise the second, likewise the third, likewise the fourth. Thus above, below, & all around, everywhere, in its entirety, he keeps pervading the all-encompassing cosmos with an awareness imbued with good will — abundant, expansive, immeasurable, without hostility, without ill will. Just as a strong conch-trumpet blower can notify the four directions without any difficulty, in the same way, when the awareness-release through good will is thus developed, thus pursued, any deed done to a limited extent no longer remains there, no longer stays there.—-SN 42.8
In SN 47.10 the Buddha outlines the process of applying the subsidiary theme, then returning to the main subject of meditation. Here and elsewhere investigation is described as an energetic activity and concentration as a relaxed one:
“As he remains thus focused on (body, feelings, mind, or mental qualities) in & of themselves, a fever based on (body, feelings, mind or mental qualities) arises within his body, or there is sluggishness in his awareness, or his mind becomes scattered externally. He should then direct his mind to any inspiring theme. As his mind is directed to any inspiring theme, gladness is born within him. In one who is gladdened, rapture is born. In one whose heart is enraptured, the body grows calm. His body calm, he feels pleasure. Feeling pleasure, his mind grows concentrated. He reflects, ‘I have attained the aim to which my mind was directed. Let me withdraw.’ He withdraws & engages neither in directed thought nor in evaluation. He discerns that ‘I am not thinking or evaluating. I am inwardly mindful & at ease.”—-SN 47.10
In MN 62, the five elements (including space) also constitute a subsidiary theme, and the meditations on ‘air’ and ‘space’ immediately precede the brahmaviharas, indicating the development from the elements to the boundless quality of the brahmaviharas, then to the breath as a vehicle of the element air, a platform for later meditation on space, remembering Rahula is a beginner. That is how this procedure results in “much fruit, much benefit,”