In this paper, the optimal velocity model of traffic is extended to take into account the relative velocity. Thestability and density waves for traffic flow are investigated analytically with the perturbation method. The stabilitycriterion is derived by the linear stability analysis. It is shown that the triangular shock wave, soliton wave and kinkwave appear respectively in our model for density waves in the three regions: stable, metastable and unstable regions.These correspond to the solutions of the Burgers equation, Kortewegg-de Vries equation and modified Korteweg-de Vriesequation.The analytical results are confirmed to be in good agreement with those of numerical simulation. All theresults indicate that the interaction of a car with relative velocity can affect the stability of the traffic flow and raisecritical density.