How was the auxiliary function to be used in proving the theorem below determined? I don't understand why this function was chosen, and how the author arrived at the decision of choosing this function? This is the first time I came across the use of auxiliary functions in proving a theorem, so I am a bit confused whether the function is chosen by pure intuition or is there a method behind this.

Thanks a lot for reading.