Intuition The one core idea
The LQR takes a machine whose behaviour is described by a linear rule of motion and finds the single feedback recipe u = − K x that steers it back to rest while wasting the least combined "error" and "effort". Everything on the parent page — the matrices, the cost integral, the Riccati equation — is just bookkeeping needed to write down that one recipe and prove it is the best possible.
Before you can read one line of the parent note, you must own every symbol it throws at you. This page builds each from absolute zero, in the order that lets each rest on the one before it.
Everything in LQR happens to a single moving point . That point is the machine's situation right now .
x — the machine's situation as a point
The state x is a list of numbers that fully describes where the system is at this instant . For a satellite sliding along one axis, that list is (position, velocity). Stack those numbers into a column and you get one arrow from the origin to a point.
Plain words: x answers "what is the machine doing right now?"
The picture: a dot in a flat plane (for 2 numbers). The origin is "perfect — at target, not moving". Being away from the origin is bad .
Why the topic needs it: LQR's whole job is to drive this dot to the origin. If you don't picture the state as a movable point, nothing else makes sense.
R n — "a list of n real numbers"
R means "the real numbers" (every ordinary number: − 3 , 0 , 2.7 , 2 ). The little superscript n means "n of them, stacked". So x ∈ R n reads "x is a point living in n -dimensional space" . The ∈ symbol just means belongs to .
Two dimensions we can draw (n = 2 ); higher n we picture by analogy — still "a point that can be near or far from the origin".
Definition Vector — a stacked column of numbers = an arrow
A vector is a column of numbers. Geometrically it is an arrow from the origin to a point.
x = [ x 1 x 2 ] e.g. [ position velocity ]
Definition Matrix — a grid that transforms arrows
A matrix A is a rectangular grid of numbers. Its job is to eat one arrow and spit out another arrow — it stretches, rotates, or shears space. When you see A x , picture "the arrow x after the machine A acts on it".
Definition Matrix shape "rows × columns"
Every matrix has a shape written rows × columns . A matrix that is r × c has r horizontal rows and c vertical columns. A column vector in R n is just an n × 1 matrix (n rows, 1 column).
Definition Matrix–vector multiplication and the "shapes must match" rule
To compute A x you take each row of A , pair it up number-by-number with the column x , multiply the pairs, and add — that sum becomes one entry of the answer.
[ a c b d ] [ x 1 x 2 ] = [ a x 1 + b x 2 c x 1 + d x 2 ]
The one rule you must obey: the number of columns on the left must equal the number of rows on the right — otherwise the pairing has leftovers and the product is undefined. An r × c matrix can only eat a c × 1 vector, and returns an r × 1 vector.
Definition The dimensions of every matrix in LQR
With x ∈ R n (state, n numbers) and u ∈ R m (control, m numbers), the "shapes must match" rule forces every matrix's size:
Matrix
Shape
Why that shape
A
n × n
A x must return an n -vector to add to x ˙ ; so A eats n , returns n .
B
n × m
B u eats the m -vector u and must return an n -vector to join x ˙ .
Q
n × n
sits between x ⊤ and x in x ⊤ Q x ; must eat an n -vector.
R
m × m
sits between u ⊤ and u in u ⊤ R u ; must eat an m -vector.
K
m × n
K x eats the n -vector x and must return an m -vector (a control).
Nothing here is arbitrary — every shape is the only one that makes the multiplication legal.
A ⊤ — flip across the diagonal
A ⊤ (read "A transpose") is the matrix you get by turning rows into columns: an r × c matrix becomes c × r . A row vector [ a b ] becomes a column [ a b ] and vice-versa. We need it because to multiply a row by a column (as in x ⊤ Q x ) the shapes must line up: x is n × 1 , so x ⊤ is 1 × n and x ⊤ Q is a legal 1 × n row.
Definition Symmetric matrix
M = M ⊤
A matrix is symmetric if flipping it across its diagonal changes nothing: the number in row i , column j equals the one in row j , column i . (A symmetric matrix is automatically square.) The cost matrices Q and R are always chosen symmetric — this is what makes the cost a clean "bowl" shape (next).
This single expression appears three times on the parent page (x ⊤ Q x , u ⊤ R u , x ⊤ P x ). Own it once and all three are free.
Definition Quadratic form — squared distance, weighted
x ⊤ M x chains the multiplications of section 1: x ⊤ (1 × n ) times M (n × n ) gives a 1 × n row, times x (n × 1 ) gives a 1 × 1 block — i.e. one single number . When M is the identity it is exactly x 1 2 + x 2 2 — the squared length of the arrow. A general symmetric M just weights some directions more than others.
Why squared (why not ∣ x ∣ )? A square is smooth at the bottom (a rounded bowl), so calculus can find its minimum cleanly. An absolute value has a sharp corner — the optimizer chokes on it. This smoothness is the whole reason LQR has a tidy closed-form answer.
The picture: x ⊤ M x is a bowl sitting over the plane. The origin is the bottom (value 0 ); the further out you go, the higher you climb. M decides how steep the bowl is in each direction.
Definition Positive (semi)definite:
M ≻ 0 and M ⪰ 0
M ⪰ 0 (read "M is positive semi definite") means x ⊤ M x ≥ 0 for every arrow x — the bowl never dips below zero. M ≻ 0 ("positive definite") is stricter: x ⊤ M x > 0 for every non-zero x — a genuine bowl with no flat valley floor.
Symbol
Bowl shape
Used for
⪰ 0
may have a flat floor
Q (state cost) — okay to not penalize some directions
≻ 0
strictly curved everywhere
R (control cost) — must curve so a unique cheapest control exists, and so R − 1 exists
This table is exactly why the parent insists "R ≻ 0 strictly": a flat floor in the control cost would mean "some control is free", the minimum would not be unique, and R − 1 (defined next) would not exist.
Definition Matrix inverse
R − 1 — "the undo matrix"
For a plain number, dividing by r means multiplying by r − 1 = 1/ r — and that only works when r = 0 . The matrix inverse is the exact analogue. R − 1 is the matrix that undoes R : applying R then R − 1 (or the reverse) leaves every vector unchanged,
R − 1 R = R R − 1 = I ,
where I is the identity matrix (1's on the diagonal, 0's elsewhere — the "do-nothing" matrix, the matrix version of the number 1 ).
When does it exist? Only for a square matrix that does not squash any non-zero arrow to zero. A positive-definite R ≻ 0 never sends a non-zero u to zero (because u ⊤ R u > 0 ), so R − 1 is guaranteed to exist — which is exactly why the gain K = R − 1 B ⊤ P is always well-defined.
Definition The time variable
t and the increment d t
t is the time parameter — a single real number counting seconds from a chosen start, t = 0 . As t increases the state point slides along a path, so x is really x ( t ) , "the state at time t ". The symbol d t means an infinitesimally small step of time — an instant so short it is "the next moment". You will see it as the multiplier inside the cost integral, tagging how long each instant's badness is paid for.
x ˙ — the velocity of the state
A dot over a symbol means "how fast it is changing right now" — its rate of change with time (its derivative ), x ˙ = d t d x . x ˙ is the instantaneous velocity of the state point : which way, and how fast, the dot is sliding through the plane.
Why a derivative and not a difference? Physics happens continuously — the machine doesn't jump in discrete steps, it flows. The derivative is the tool that measures flow at an instant.
The picture: at each point, x ˙ is a little arrow attached to the dot showing where it will move next. A whole field of these arrows is the machine's "wind map".
x ˙ = A x + B u — the rule of motion
This equation is the machine. It says the state's velocity x ˙ (an n -vector) is built from two pushes:
A x = the machine's own tendency (A is n × n , so A x is an n -vector): an unstable satellite drifts; a pendulum swings.
B u = the push we add through the control u , routed into the state by the matrix B (n × m , turning the m -vector u into an n -vector).
Both terms are n -vectors, so they add legally to give x ˙ . "Linear" means x ˙ is just a straight combination of x and u — no squares, no products. "Time-invariant" means A , B don't change with time.
u ∈ R m — the knobs we can turn
u is the list of m things we get to choose each instant: thrust, torque, steering. It is the only freedom we have; A and B are fixed by physics.
K and the law u = − K x
K is the recipe : a fixed m × n grid of numbers. The rule u = − K x says "look at how far off you are (x ), multiply by K (turning the n -vector x into an m -vector control), and push back the opposite way (the minus)" . Bigger error ⇒ bigger corrective push, automatically, everywhere.
Why the minus sign? Feedback must oppose the error, like a spring pulling a stretched mass back. A plus sign would push you further off — the opposite of control.
Why proportional to x (why linear)? The parent's punchline: linear plant + quadratic (bowl) cost forces the best recipe to be exactly this linear one. See Pole Placement and PID Controllers for the same − K x shape reached by other roads.
∫ 0 ∞ ( … ) d t — the running total
The tall stretched-S symbol ∫ means "add up continuously". ∫ 0 ∞ f d t means "sum the value f over every instant of time t from now (t = 0 ) until forever (∞ )", where each instant's value is weighted by its tiny duration d t . It is the smooth version of adding tiny slivers of area under a curve.
The picture: two bowls at every instant; J is the shaded area swept out as time flows. A twitchy, wasteful controller has a big shaded area; the LQR controller has the smallest possible one.
V ( x ) = x ⊤ P x — "cost still to come"
V ( x ) is the best remaining total cost if you start at state x and control optimally forever after. Because our cost is quadratic, V is itself a bowl x ⊤ P x , and the symmetric n × n matrix P ⪰ 0 is what shapes it. This idea — "solve by tracking cost-to-go" — comes straight from the HJB equation .
Definition The Riccati equation — the puzzle that finds
P
A ⊤ P + P A − P B R − 1 B ⊤ P + Q = 0
This is one matrix equation you solve once for P ; then the gain drops out as K = R − 1 B ⊤ P . It is "nonlinear" only because of the − P B R − 1 B ⊤ P term, where P multiplies itself. You don't need to solve it yet — just know it's the last gate, and that picking the right (⪰ 0 , stabilizing) solution ties to Controllability and Observability and Lyapunov Stability .
Real numbers R and lists R to the n
Matrix shapes and multiplication rule
Transpose and symmetric matrices
Quadratic form x-top M x = a bowl
Positive definite Q and R
Derivative x-dot = velocity
Control u and feedback law u = -K x
Value function V = x-top P x
Read each cue, answer aloud, then reveal. If any stumps you, re-read that section.
What does x ∈ R n mean in plain words? x is a point (arrow) made of n real numbers — the machine's full situation right now.
What is a matrix's job geometrically? It eats an arrow and returns a transformed arrow (stretch/rotate/shear); A x is "x after A acts".
State the "shapes must match" rule for multiplying A by a vector. The number of columns of A must equal the number of rows of the vector; an r × c matrix eats a c × 1 vector and returns r × 1 .
What are the shapes of A , B , Q , R , K ? A is n × n , B is n × m , Q is n × n , R is m × m , K is m × n .
What does A ⊤ do and why do we need it? Flips rows into columns (r × c → c × r ); needed so shapes line up when multiplying a row by a column, e.g. in x ⊤ Q x .
What single number does x ⊤ M x produce, and what shape is it? One scalar measuring weighted squared distance from the origin — a bowl over the plane.
Why square the error instead of using ∣ x ∣ ? A square is smooth at the bottom, so calculus finds a clean unique minimum; ∣ x ∣ has a sharp corner.
Difference between M ⪰ 0 and M ≻ 0 ? ⪰ 0 allows a flat valley floor (x ⊤ M x ≥ 0 ); ≻ 0 is strictly curved everywhere (> 0 for x = 0 ).
What is R − 1 and when does it exist? The "undo" matrix with R − 1 R = I ; it exists for a square matrix that squashes no non-zero arrow to zero — guaranteed when R ≻ 0 .
Why must R ≻ 0 strictly (not just ⪰ 0 )? So a unique cheapest control exists and R − 1 exists in K = R − 1 B ⊤ P .
What is t and what does d t mean? t is the time parameter (seconds from t = 0 ); d t is an infinitesimally small step of time weighting each instant in the integral.
What does x ˙ represent? The instantaneous velocity of the state point — its rate of change with time, d x / d t .
Read out x ˙ = A x + B u in words. The state's velocity is its own natural drift A x plus the push B u we inject through control.
Why the minus sign in u = − K x ? Feedback must oppose the error and pull the state back toward the origin, like a spring.
What does ∫ 0 ∞ ( ⋯ ) d t compute for the cost? The running total badness (error + effort) summed continuously over all future time.
What is V ( x ) = x ⊤ P x ? The best possible remaining total cost from state x ; a bowl shaped by the symmetric P ⪰ 0 .
What does the Riccati equation deliver? The matrix P , from which the optimal gain K = R − 1 B ⊤ P is read off.