The most comprehensive and particularly reliable method for non-destructively measuring the residual stress of the surface layer of metals is the sin method. When X-rays were used the relationship of sin measured on the surface layer of the processing metal did not show linearity when the sin method was used. In this case, since the effective penetration depth changes according to the changing direction of the incident X-ray, becomes a sin function. Since cannot be used as a constant, the relationship in sin cannot be linear. Therefore, in this paper, the orthogonal function method according to Warren’s diffraction theory and the basic profile of normal distribution were synthesized, and the X-ray diffraction profile was calculated and reviewed when there was a linear strain (stress) gradient on the surface. When there is a strain gradient, the X-ray diffraction profile becomes asymmetric, and as a result, the peak position, the position of half-maximum, and the centroid position show different values. The difference between the peak position and the centroid position appeared more clearly as the strain (stress) gradient became larger, and the basic profile width was smaller. The weighted average strain enables stress analysis when there is a strain (stress) gradient, based on the strain value corresponding to the centroid position of the diffracted X-rays. At the 1/5 max height of X-ray diffraction, the position where the diffracted X-ray is divided into two by drawing a straight line parallel to the background, corresponds approximately to the centroid position.