  Sylvester, Lyapunov, and algebraic Riccati equations are the bread and butter
of control theorists. They are used to compute infinite-horizon Gramians, solve
optimal control problems in continuous or discrete time, and design observers.
While popular numerical computing frameworks (e.g., scipy) provide efficient
solvers for these equations, these solvers are still largely missing from most
automatic differentiation libraries. Here, we derive the forward and
reverse-mode derivatives of the solutions to all three types of equations, and
showcase their application on an inverse control problem.
