The homotopy analysis method (HAM) is applied to study the behavior of a hyperbolic rods of quadrupole mass filter and a sinusoidal potential form V(ac) cos(Ωt). Numerical computation method of a 20th-order HAM is employed to compare the physical properties of the confined ions with fifth-order Runge-Kutta method. Also, comparison is made for the first stability region, the ion trajectories in real time, the polar plots, and the ion trajectory in x - y plan. The results show that the two methods are fairly similar; therefore, the HAM method has potential application to solve linear and nonlinear equations of the charge particle confinement in quadrupole field.