A dynamic production function for cotton is estimated. Optimal irrigation volumes, timing, and qualities are calculated using dynamic programming. Optimal water quantities are sensitive to initial conditions and drainage costs. Demand is price inelastic. Irrigation numbers are very sensitive to application costs. Drain-water reuse is optimal under the conditions considered.