The gain ripple characteristics in traveling wave semiconductor optical amplifiers (TW SOAs) are studied in detail. A uniform carrier distribution along the cavity length in a TW SOA is usually assumed in many previous papers. However the theoretical model proposed in this paper accounts for the spatial dependence of the carrier density. Gain ripple value changes with the residual facet reflectivity, spontaneous emission factor, and incident optical power, etc. Good agreement was obtained between the calculated data and the experimental results.