A telescope that must hold a galaxy on the same pixel for hours, an antenna pointing at Earth from Mars, or a capsule turning its heat shield forward before entry all solve the same problem: knowing and controlling their attitude, that is, the orientation of the spacecraft relative to a reference frame. This lesson lays the mathematical foundations of the whole subject: how a rotation is represented (matrix, Euler angles, quaternions), how it evolves with angular velocity and how torques govern it through Euler's equations. By the end you will be able to multiply quaternions by hand, and you will know why Apollo feared gimbal lock and why the first American satellite ended up tumbling.
Reference frames
Talking about attitude always requires two sets of axes: the spacecraft's and another one against which it is measured. The usual ones:
| Frame | Origin and axes | What it is used for |
|---|---|---|
| Inertial (ECI, J2000 or GCRF) | Center of the Earth; z toward the mean north pole, x toward the vernal equinox of the J2000 epoch | Star catalogs, astronomical pointing, ephemerides |
| Local orbital (LVLH) | Spacecraft center of mass; z toward nadir, y opposite the orbit normal, x completes the triad (≈ velocity direction) | Earth pointing, observation, communications |
| Body | Fixed to the structure, often aligned with the principal axes of inertia | Mounting of sensors, actuators and instruments |
| Sensor | Fixed to each sensor (for example, z along the boresight of a star tracker) | Reading measurements before transforming them to the body frame |
The ISS, for example, almost always flies in a fixed attitude relative to LVLH (rotating once per orbit relative to inertial space), whereas Hubble and Webb point at inertial coordinates. The orbits that define LVLH are covered in orbital elements and, more generally, in gravity and orbits.
The attitude matrix, or direction cosine matrix
The most direct description is the direction cosine matrix (DCM) A: its elements are the cosines of the angles between the axes of the two frames. If r is a vector expressed in the reference frame and b is the same vector expressed in body axes:
b = A · r A⁻¹ = Aᵀ det A = +1
A_CA = A_CB · A_BA (composition: first from A to B, then from B to C)
A belongs to the rotation group SO(3): it is orthogonal and proper. It has nine numbers but only three degrees of freedom, because orthonormality imposes six constraints. It is the natural representation for transforming vectors (every sensor measurement is brought to body axes with a mounting matrix) and has no singularities, but it is redundant: after many floating-point multiplications it drifts away from orthogonality and has to be re-orthonormalized.
Euler angles and gimbal lock
Any rotation can be written as three successive rotations about coordinate axes. In aeronautics and Earth pointing the 3-2-1 sequence is used: yaw ψ about z, pitch θ about the new y, roll φ about the new x. There are twelve valid sequences (six "symmetric", such as 3-1-3, and six "asymmetric", such as 3-2-1).
Their appeal is that they can be interpreted at a glance. Their problem is the kinematics. For 3-2-1, the angle rates as functions of the body-frame angular velocity ω = (ω₁, ω₂, ω₃) are:
φ̇ = ω₁ + (ω₂ sin φ + ω₃ cos φ) · tan θ
θ̇ = ω₂ cos φ − ω₃ sin φ
ψ̇ = (ω₂ sin φ + ω₃ cos φ) / cos θ
At θ = ±90° the denominator vanishes: the first and third rotation axes line up, one degree of freedom is lost and yaw and roll can no longer be told apart. This is gimbal lock, and it is not a mathematical curiosity. The Apollo inertial platform had three gimbals; if the middle gimbal approached 90°, the platform lost its reference and had to be realigned with the sextant. The computer lit a warning as it got close, and crews planned their maneuvers to avoid it. A four-gimbal platform would have avoided the problem at the cost of more mass and complexity. Modern systems are strapdown (gyroscopes fixed to the structure) and propagate attitude in software, where the problem is solved by changing representation.

Euler axis and angle
Euler's rotation theorem states that any rotation of a rigid body with one fixed point is equivalent to a single rotation through an angle φ about a unit axis e. In terms of those four numbers (three independent):
A(e, φ) = cos φ · I + (1 − cos φ) · e eᵀ − sin φ · [e×]
where [e×] is the skew-symmetric cross-product matrix. The angle is recovered from the trace: cos φ = (tr A − 1)/2. This representation underlies eigenaxis maneuvers, which rotate the spacecraft along the shortest angular path, as you will see in attitude control laws. Its weak point: for φ = 0 the axis is undefined, and near 180° its numerical computation is ill-conditioned.
Quaternions
Grouping the axis and the angle in a clever way gives the attitude quaternion (also called the Euler–Rodrigues parameters):
q = [ q_v ; q₄ ] = [ e · sin(φ/2) ; cos(φ/2) ] with |q|² = q₁² + q₂² + q₃² + q₄² = 1
Four parameters and a single constraint, against the nine and six of the matrix. Key properties:
- No singularities: every rotation has a well-defined quaternion.
- Double cover: q and −q represent the same rotation (φ and φ + 360°). Software must choose the sign with q₄ ≥ 0 when it wants the shortest rotation.
- Composition by quaternion multiplication, cheaper than matrix multiplication: 16 multiplications and 12 additions against 27 and 18.
- Trivial inverse: the conjugate q* = [−q_v ; q₄].
With the Hamilton convention (scalar = real part, i² = j² = k² = ijk = −1) and writing q = (w, v):
p ⊗ q = ( p_w q_w − p_v · q_v ; p_w q_v + q_w p_v + p_v × q_v )
v' = q ⊗ (0, v) ⊗ q* (active rotation of the vector v)
The corresponding matrix, in the passive convention and with the scalar in fourth position (that of Shuster and most NASA software):
A(q) = (q₄² − |q_v|²) · I + 2 q_v q_vᵀ − 2 q₄ [q_v×]
Other three-parameter sets, such as the modified Rodrigues parameters (MRP, p = q_v/(1 + q₄)), are used in control and filtering because they are minimal; they have a singularity at 360° that is avoided by switching to the "shadow" set −p/|p|².
Kinematics: how attitude changes with angular velocity
If ω is the angular velocity of the spacecraft relative to the reference frame, expressed in body axes:
Ȧ = −[ω×] · A (matrix, passive convention)
q̇ = ½ · q ⊗ (0, ω) (quaternion, Hamilton, ω in body axes)
q̇₄ = −½ q_v · ω ; q̇_v = ½ (q₄ ω + q_v × ω)
The quaternion equation is linear in q and contains no trigonometric functions: that is why it is the one the flight computer integrates from the gyroscope data. If ω is constant over the step Δt, the exact solution is a rotation through the angle |ω|·Δt about ω/|ω|:
q(t + Δt) = q(t) ⊗ ( cos(|ω|Δt/2) ; (ω/|ω|) · sin(|ω|Δt/2) )
After each step the quaternion is renormalized (q ← q/|q|), which costs four multiplications and a square root. When ω changes direction within the step, coning error appears: modern strapdown gyroscope packages compensate for it with algorithms that use several samples of the integrated angle per step.
Dynamics: angular momentum and Euler's equations
For a rigid body, the angular momentum about the center of mass is h = J · ω, with J the inertia tensor (symmetric and positive definite). Newton's second law for rotation states that, in an inertial frame, dh/dt = τ. Differentiating in body axes, which rotate with ω, brings in the transport term:
J · ω̇ + ω × (J · ω) = τ Euler's equations
In principal axes (J diagonal, J₁, J₂, J₃) they become three scalar equations:
J₁ ω̇₁ = (J₂ − J₃) ω₂ ω₃ + τ₁
J₂ ω̇₂ = (J₃ − J₁) ω₃ ω₁ + τ₂
J₃ ω̇₃ = (J₁ − J₂) ω₁ ω₂ + τ₃
The gyroscopic term ω × Jω couples the axes: with a fast spin about one axis, a torque about another produces a motion perpendicular to it, the principle of the spinning top. If the spacecraft carries reaction wheels with angular momentum h_w, the total momentum is h = Jω + h_w and the equations become J ω̇ + ω × (Jω + h_w) = τ_ext − ḣ_w: the torque applied to the wheels appears, with its sign reversed, on the spacecraft. This is the basis of actuators.
There are two integrals of the motion in the absence of external torques: the magnitude of the angular momentum |h| (together with its direction in inertial space) and the rotational kinetic energy T = ½ ωᵀ J ω.

Torque-free motion: nutation and the major-axis rule
For an axisymmetric body (J₁ = J₂ = J_t, J₃ = J_s) with no torques, the third equation gives constant ω₃ and the other two describe a rotation of the transverse component of ω about the symmetry axis, at a body-frame frequency of:
λ = (J_s − J_t) / J_t · ω₃
In space, the symmetry axis sweeps out a cone about the fixed vector h: this is nutation, with half-angle tan θ = J_t ω_t / (J_s ω₃).
And if the body is not rigid? Sloshing propellant, flexible antennas or cables dissipate energy while h is preserved. Since T = h²/(2J) for pure spin, the minimum energy compatible with a given h corresponds to the maximum moment of inertia. A quasi-rigid body spinning about its minor axis is therefore in unstable equilibrium: nutation grows until it ends up spinning about its major axis (flat spin). This is the major-axis rule, and Explorer 1 (1958) discovered it the hard way: elongated, it spun about its long axis (the axis of minimum inertia), and its four whip antennas dissipated energy until it ended up spinning end over end. Since then, spin-stabilized spacecraft have been designed with J_s/J_t > 1 (typically at least 1.05-1.1) or as dual-spin spacecraft: a fast-spinning rotor and a nearly stationary platform, with dampers on the despun part, like the Galileo probe.
Between the two stable axes lies the intermediate axis, unstable even for a rigid body: this is the Dzhanibekov effect, which cosmonaut Vladimir Dzhanibekov observed in 1985 aboard Salyut 7 with a wing nut that flipped over periodically. It can be seen by linearizing Euler's equations about a pure spin ω₂: perturbations obey δω̈₁ = [(J₂ − J₃)(J₁ − J₂) / (J₁ J₃)] · ω₂² · δω₁, and the coefficient is positive (exponential growth) precisely when J₂ lies between J₁ and J₃.
Disturbance torques: gravity gradient
No spacecraft is free of torques. The dominant one in low Earth orbit for large spacecraft is the gravity gradient: the part of the spacecraft closest to Earth is pulled slightly harder than the part farthest away. For a circular orbit of radius r and n² = μ/r³:
τ_gg = (3μ / r³) · ( r̂ × J · r̂ )
|τ_gg| ≈ (3n² / 2) · |J_z − J_y| · sin(2θ) (rotation θ in a principal plane)
It vanishes when a principal axis points at nadir: the axis of minimum inertia tends to align with the local vertical. This is the basis of gravity-gradient stabilization with a boom (LDEF used it for almost six years), but for a telescope pointing at a fixed spot in the sky it is a cyclic disturbance that the wheels absorb.
The other torques (solar radiation pressure, aerodynamic drag, residual magnetic dipole, leaks and outgassing) are tabulated and budgeted in that lesson.
Which representation to choose
| Representation | Parameters | Singularities | Typical use |
|---|---|---|---|
| Direction cosine matrix | 9 (6 constraints) | None | Transforming vectors, sensor mounting |
| Euler angles | 3 | Yes (θ = ±90° in 3-2-1) | Human interface, telemetry, Earth pointing with small rotations |
| Axis and angle | 4 (1 constraint) | Axis undefined at φ = 0 | Planning eigenaxis maneuvers |
| Quaternion | 4 (1 constraint) | None; double cover | Onboard propagation, filters, control |
| MRP | 3 | At 360° (avoided with the shadow set) | Filters and nonlinear control laws |
The almost universal pattern today: the flight computer propagates and controls with quaternions, estimates small errors with a three-component vector (error angles or MRPs, see attitude sensors) and displays Euler angles to the operators.

Key points
- Attitude is a rotation between two sets of axes; you must always say which ones and in which convention (active or passive, Hamilton or JPL).
- Three parameters are not enough without singularities: Euler angles hit gimbal lock at θ = ±90° (3-2-1 sequence).
- The quaternion
[e sin(φ/2); cos(φ/2)]has no singularities, composes cheaply and is propagated withq̇ = ½ q ⊗ (0, ω). - Euler's equations:
J ω̇ + ω × Jω = τ; the gyroscopic term couples the axes. - A body that dissipates energy ends up spinning about its axis of maximum inertia (Explorer 1).
- The gravity-gradient torque,
τ ≈ (3n²/2)·ΔJ·sin 2θ, is of the order of tenths of a N·m for a telescope like Hubble.
Further reading
- F. L. Markley and J. L. Crassidis, Fundamentals of Spacecraft Attitude Determination and Control, Springer (2014).
- M. D. Shuster, "A Survey of Attitude Representations", The Journal of the Astronautical Sciences 41(4), 439-517 (1993).
- B. Wie, Space Vehicle Dynamics and Control, AIAA Education Series (2nd ed., 2008).
- P. C. Hughes, Spacecraft Attitude Dynamics, Wiley (1986; Dover reprint, 2004).
- H. Schaub and J. L. Junkins, Analytical Mechanics of Space Systems, AIAA Education Series (4th ed., 2018).
- J. R. Wertz (ed.), Spacecraft Attitude Determination and Control, D. Reidel (1978).
Test yourself
Why do flight computers propagate attitude with quaternions rather than Euler angles?
A quaternion represents a 120° rotation about the axis (1, 1, 1)/√3. What is its scalar part?
In a 3-2-1 Euler angle sequence (yaw, pitch, roll), where does the singularity, or gimbal lock, occur?
A quasi-rigid body that dissipates energy spins freely in space. About which axis does it end up spinning?
A satellite with J₃ = 1,000 kg·m² and J₁ = J₂ = 800 kg·m² spins at ω₃ = 1 rad/s. What is the body-frame nutation frequency?