Discrete Algebraic Riccati Equation (DARE)
March 21, 2026 · View on GitHub
Overview & Motivation
The Discrete Algebraic Riccati Equation arises whenever you need to find an optimal trade-off between state regulation and control effort in a discrete-time linear system. It is the mathematical core of two fundamental algorithms:
- LQR control — computing the optimal state-feedback gain.
- Steady-state Kalman filtering — computing the optimal estimator gain.
The DARE finds a symmetric positive semi-definite matrix that encodes the cost-to-go from any state. Once is known, the optimal gain is a simple closed-form expression. This library solves the DARE via fixed-point iteration — simple to implement, numerically transparent, and well-suited to the small state dimensions typical in embedded control.
Mathematical Theory
The Equation
where:
- — state transition matrix
- — input matrix
- — state weighting matrix ()
- — input weighting matrix ()
- — the unknown ()
Iterative Solution
Starting from :
- Solve (via Gaussian Elimination)
- If , converged.
Existence and Convergence
A unique stabilizing solution exists when:
- is stabilizable (unstable modes are controllable).
- is detectable (where ).
Under these conditions, the iteration converges monotonically: .
Optimal Gain
Complexity Analysis
| Phase | Time | Space | Notes |
|---|---|---|---|
| Per iteration | Matrix multiplications + one linear solve | ||
| Total solver | iterations (typically 10–30) |
Why : Each iteration involves matrix products () and an linear solve (for ). When , the matrix products dominate.
Step-by-Step Walkthrough
System: , , , , , .
Iteration 0:
- Correction term
Iterations 1–20: grows monotonically until convergence. For this ratio, stabilizes in ~15 iterations.
Pitfalls & Edge Cases
- Non-stabilizable system. The iteration diverges if is not stabilizable. Check the controllability matrix rank before calling the solver.
- must be positive definite. The linear solve fails if is singular, which happens when has zero eigenvalues.
- Slow convergence. Systems with eigenvalues near the unit circle converge slowly. Increase the maximum iteration bound if needed.
- Fixed-point overflow. The matrix products can easily exceed Q15/Q31 ranges. Use floating-point for the solve; deploy the resulting as a fixed-point constant.
- Tolerance type-awareness. The convergence test uses
math::Tolerance<T>(), which adapts to bothfloatand fixed-point types.
Variants & Generalizations
| Variant | Key Difference |
|---|---|
| Continuous ARE (CARE) | For continuous-time systems; different matrix equation |
| Newton's method for DARE | Quadratic convergence but requires solving a Sylvester equation per iteration |
| Schur method | Eigendecomposition-based; finds the solution in one pass but requires eigenvalue computation |
| Doubling algorithm | convergence via matrix sign function; useful for large systems |
Applications
- LQR control — The LQR controller derives its gain from the DARE solution.
- Kalman filter steady-state gain — The dual DARE (swapping , , , ) gives the steady-state Kalman gain.
- control — Robust controller design involves coupled Riccati equations.
- Model predictive control — The terminal cost matrix in MPC is often the DARE solution.
Connections to Other Algorithms
graph LR
DARE["DARE Solver"]
GE["Gaussian Elimination"]
LQR["LQR Controller"]
KF["Kalman Filter"]
GE --> DARE
DARE --> LQR
DARE --> KF
| Algorithm | Relationship |
|---|---|
| Gaussian Elimination | Used at each iteration to solve the linear sub-system |
| LQR Controller | Direct consumer — extracts optimal gain from the DARE solution matrix |
| Kalman Filter | Dual problem — the steady-state Kalman gain is computed by a transposed DARE |
References & Further Reading
- Lancaster, P. and Rodman, L., Algebraic Riccati Equations, Oxford University Press, 1995.
- Anderson, B.D.O. and Moore, J.B., Optimal Control: Linear Quadratic Methods, Prentice Hall, 1990 — Chapter 4.
- Laub, A.J., "A Schur method for solving algebraic Riccati equations", IEEE Transactions on Automatic Control, 24(6), 1979.