Recently i spend some time to solve the optimal control problem for linear discrete (in)-finite time systems with quadratic costs in terms of the (algebraic) Ricatti equation. I texed the solution, you can download the pdf here.