This paper explores the retailer's optimal lot sizing and quantity backordering for a deteriorating production system with a two-state Markov production process in which quantity discounts are provided by the supplier. The products are sold with the policy of free reasonable repair warranty employing the fraction of nonconforming items in a lot size. Unlike the traditional economic production quantity (EPQ) model with warranty policy based on the elapsed time of the system in the control state follows an exponential distribution, this paper not only constructs an alternative mathematical model for EPQ model based on the fraction of nonconforming items in a lot size for an imperfect production system but also extends the topics of optimal quantity and shortage to a wider scope of academic research and further finds that some results are different from the traditional EPQ models. We seek to minimize the expected total relevant cost through optimal lot sizing and quantity backordering. We also demonstrate that the optimal lot size is bounded in a finite interval. An efficient algorithm is developed to determine the optimal solution. Moreover, a numerical example is given and sensitivity analysis is conducted to highlight management insights.