Theories are developed to optimize the mask structure of alternating phase-shifting masks (PSMs) to minimize the average image placement error towards aberration under coherent imaging. The constraint of the optimization is a given mean value of RMS aberration, which corresponds to infinitely many sets of random Zernike coefficients. To begin the analysis, the image placement error is expressed as a function of the mask spectrum and the wave aberration. Monte Carlo analysis on the Zernike coefficients is then performed, which assures us that a global minimum of average image placement error is likely to occur at low phase widths. This result is confirmed by analytically considering the expected value of the square of the image placement error. By Golden Section Search, the optimal phase width is found to be 0.3707(λ/NA) at 0.07λ RMS aberration. This methodology of finding the optimal phase width is applicable to the design of all alternating PSMs.