• Detailed description of the stabilization of an inverted pendulum. • Approximated analysis of the effective potential by considering also numerical simulations. • Parametric excitation with one, two and large number of cosines are considered. • A method to obtain the optimal number of cosines that maximizes the survival probability is presented. In this paper, we explore the stability of an inverted pendulum under a generalized parametric excitation described by a superposition of N cosines with different amplitudes and frequencies, based on a simple stability condition that does not require any use of Lyapunov exponent, for example. Our analysis is separated in 3 different cases: N = 1 , N = 2 , and N very large. Our results were obtained via numerical simulations by fourth-order Runge–Kutta integration of the non-linear equations. We also calculate the effective potential also for N > 2. We show then that numerical integrations recover a wider region of stability that are not captured by the (approximated) analytical method of the effective potential. We also analyze stochastic stabilization here: firstly, we look the effects of external noise in the stability diagram by enlarging the variance, and secondly, when N is large, we rescale the amplitude by showing that the diagrams for survival time of the inverted pendulum resembles the exact case for N = 1 . Finally, we find numerically the optimal number of cosines corresponding to the maximal survival probability of the pendulum.