Matter distribution in the Universe can cause the gravitational lensing effect, which would contaminate the cosmic microwave background (CMB) pattern we have observed today. So we did the N-body simulation as the matter distribution in the Universe, combined with the ray-tracing method to simulate the gravitational lensing effect. From observation we have found the anisotropy of temperature distribution, which means that there could be anisotropy of energy distribution on the last scattering surface. This implies that there are opportunities to find polarization in cosmic microwave background. Thus we also simulate the temperature, and polarization distribution pattern of cosmic microwave background with the help of the simulation code of my advisor. Add the gravitational lensing effect into the cosmic microwave background pattern, we found from the results that the CMB temperature and polarization are affected mainly in small scale.