Advanced maths

Continuous algebraic Riccati equation calculator for infinite horizon LQR

The continuous algebraic Riccati equation describes a stationary quadratic value function for a continuous linear system.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The continuous algebraic Riccati equation describes a stationary quadratic value function for a continuous linear system. The state follows x prime equals Ax plus Bu, while the infinite-horizon objective integrates a quadratic state penalty and a quadratic control penalty. The requested solution supplies a constant feedback gain rather than a finite-horizon trajectory.

THE FORMULAAᵀP+PA−PBR⁻¹BᵀP+Q=0;K=R⁻¹BᵀP;u=−Kx.

A worked example

The default gain is[0.2360679775,0.2360679775]. Closed-loop eigenvalues are approximately−1 and−2.2360679775.

Good to know

One or two states,one control;entries within±100,Q positive definite,R positive. Bounded RK4 Riccati flow with100,000-step cap,relative residual and strict-stability checks;failure does not prove nonexistence.

Solve the stationary continuous-time control problem

The continuous algebraic Riccati equation describes a stationary quadratic value function for a continuous linear system. The state follows x prime equals Ax plus Bu, while the infinite-horizon objective integrates a quadratic state penalty and a quadratic control penalty. The requested solution supplies a constant feedback gain rather than a finite-horizon trajectory.

This calculator supports one or two states and one scalar control. The state-cost matrix must be symmetric positive definite, and the scalar control cost must be positive. These deliberately narrow conditions make the returned value matrix and strict stability checks concrete rather than suggesting support for every generalized Riccati problem.

Continuous CARE for one control and two statesu = −Kxλ ≈ −1, −2.236Stable closed loop
Scroll across to see the full diagram.
The default gain is[0.2360679775,0.2360679775]. Closed-loop eigenvalues are approximately−1 and−2.2360679775.

Compare this with the Discrete algebraic Riccati equation calculator. Find a stabilizing stationary continuous-time feedback gain; this differs from discrete-time CARE analogues and finite-horizon control.

Match the matrices to the system

Enter A as a square state matrix, B as one control column and Q as a square state-cost matrix of the same order. The scalar R penalizes squared control effort. The numerical dimensions describe a single-control system even when the state has two components with different physical units.

Matrix order and state ordering must agree throughout. Rescaling a state without transforming A, B and Q consistently changes the optimization problem. The supported entries are bounded for a small numerical demonstration; very different units or large magnitudes can slow the integration even when a mathematical solution exists.

Understand the Riccati equation and gain

The stationary equation is A transpose P plus PA minus PBR inverse B transpose P plus Q equals zero. Once a symmetric stabilizing P is available, the feedback gain is R inverse B transpose P, and the implemented control convention is u equals minus Kx.

The closed-loop state matrix is therefore A minus BK. A gain printed without its sign convention can be applied incorrectly, so the page reports that matrix and its eigenvalues as well as the gain. Negative real parts for all closed-loop eigenvalues establish strict linear asymptotic stability for the entered model.

Follow the numerical method honestly

The implementation integrates the finite-horizon Riccati flow forward from the zero matrix until its relative equation residual is sufficiently small. This is a bounded small-system method, not the Hamiltonian-pencil algorithm used by many specialist linear algebra libraries. The returned result must also pass symmetry, positivity and strict closed-loop stability checks.

A resource limit stops the integration if a stationary point is not resolved within one hundred thousand steps. Such a failure does not prove that the CARE has no mathematical solution. It means this particular bounded flow calculation did not establish the requested finite stabilizing answer for the submitted system.

Check the two-state example independently

The default A has rows zero, one and minus two, minus three; B applies control to the second state. Both state costs and the control cost are one on their relevant diagonal entries. The fitted gain components are approximately 0.236068 and 0.236068.

The resulting closed-loop eigenvalues are approximately minus one and minus 2.236068. Substitution of the displayed P into the algebraic equation gives a very small residual. This example can be checked with an independent continuous CARE solver, provided the same continuous-time equation and negative-feedback convention are used.

A residual is necessary but not sufficient

The algebraic equation can have more than one symmetric solution, including branches that do not stabilize the system. That is why equation satisfaction alone is not enough. This page explicitly rejects a result whose closed-loop spectral abscissa is not strictly negative by its numerical margin.

Positive definiteness of the fitted P is also checked within the supported Q assumptions. The numerical residual is relative to the magnitude of P, so it should be read with the input scaling. A small residual does not establish robustness to parameter uncertainty, actuator saturation, delays or unmodeled nonlinear effects.

Apply the result within its stated model

Infinite-horizon LQR assumes the linear system and quadratic objective remain appropriate over the intended operating range. A state estimate may be needed when the full state is not measured, but observer design is a separate problem. The calculator does not include constraints, integral action or output-feedback synthesis.

No claim is made for semidefinite Q, descriptor systems, multiple controls or discrete-time equations. Preserve A, B, Q, R and the gain convention when exporting the result. Those details define the problem more precisely than the phrase optimal controller on its own.

A few questions, answered

Which feedback sign is used?

u=−Kx,so the closed-loop state matrix is A−BK.

Is this the discrete-time equation?

No. This page solves the continuous-time stationary algebraic Riccati equation.

Does a small equation residual prove stability?

No. The page separately checks the closed-loop eigenvalues and rejects nonstabilizing branches.

What does an iteration-limit error mean?

The bounded flow did not resolve a valid solution;it is not a mathematical proof that no stabilizing CARE solution exists.

Find your calculator

Start typing to explore the library.