Skip to main content

Chapter 1: A Primer on Linear Algebra

Vectors, spectra, singular values and mechanical duality: distinguish instantaneous motion, energy, numerical sensitivity and control over time.

A Primer on Linear Algebra

Linear algebra helps us ask a precise question about a complicated swing: at this configuration, which combinations of joint velocities produce a particular hand velocity? The answer is a linear map. Predicting the swing that follows requires more: changing geometry, coupled inertia, applied loads, constraints and a control policy.

Those distinctions organize this chapter. A Jacobian describes instantaneous velocity transmission; an inertia matrix defines kinetic energy and momentum; a dynamics matrix propagates perturbations; a measurement matrix describes what is sensed. They are all matrices, but their physical meanings are determined by the equations in which they appear.

Vectors, Coordinates and Matrices

A vector belongs to a space closed under addition and scalar multiplication. After choosing a finite basis, we represent it by coordinates, for example

\[ \mathbf v=\begin{bmatrix}1\\2\\3\end{bmatrix}\in\mathbb R^3. \]

Velocity and displacement are vectors. Position is an affine point: subtracting two positions gives a displacement, while adding positions requires an origin convention. An array of joint angles or sensor readings is useful data, but does not automatically transform like a three-dimensional spatial vector. Bounded, nonnegative muscle activations are not a real vector space, because arbitrary negatives and sums are inadmissible.

A matrix represents a linear map between specified coordinate spaces. It preserves sums and scalar multiples:

\[ M(a\mathbf v+b\mathbf w)=aM\mathbf v+bM\mathbf w. \]

The map sends zero to zero. A translation requires an affine offset, or a homogeneous-coordinate representation; an ordinary matrix acting on position coordinates alone cannot translate every point by the same nonzero amount.

For a joint configuration \(\mathbf q\) and hand position \(\mathbf p=h(\mathbf q)\), forward kinematics is generally nonlinear. Its differential at a fixed configuration is linear:

\[ \mathbf v_{\mathrm{hand}}=J(\mathbf q)\dot{\mathbf q}, \qquad J=Dh. \]

This maps between different tangent spaces and can be rectangular. It is not generally a change of basis for one vector space. Finite joint rotations compose, usually do not commute, and do not establish independent additive joint trajectories. Angular-velocity contributions can be added only after expressing them in compatible frames and using the correct kinematic map.

The Dot Product and Cross Product

Dot Products, Projections and Power

In an orthonormal Euclidean basis,

\[ \mathbf a\cdot\mathbf b=\mathbf a^T\mathbf b =\|\mathbf a\|\,\|\mathbf b\|\cos\theta. \]

For \(\mathbf a\ne0\), the scalar and vector projections are different:

\[ \operatorname{comp}_{\mathbf a}\mathbf b =\frac{\mathbf a^T\mathbf b}{\|\mathbf a\|}, \qquad \operatorname{proj}_{\mathbf a}\mathbf b =\frac{\mathbf a^T\mathbf b}{\mathbf a^T\mathbf a}\mathbf a. \]

The residual is orthogonal to \(\mathbf a\). In a nonorthonormal basis, a metric matrix is needed to compute the same physical length and angle.

Mechanical power pairs force with velocity, \(P=\mathbf F^T\mathbf v\), or generalized force with generalized velocity, \(P=\boldsymbol\tau^T\dot{\mathbf q}\). Kinetic energy is a quadratic form,

\[ T=\tfrac12\dot{\mathbf q}^T M(\mathbf q)\dot{\mathbf q}. \]

Here the inertia matrix is essential; an unweighted joint-speed norm is not energy. An optimal-control running cost such as \(\ell=\mathbf x^TQ\mathbf x+\mathbf u^TR\mathbf u\) is a chosen penalty with declared units and weights. Its time integral is a cost functional. Neither expression is automatically muscle effort or metabolic expenditure.

Cross Products and Moment Reference Points

In a right-handed orthonormal three-dimensional frame,

\[ \mathbf a\times\mathbf b= \begin{bmatrix} a_yb_z-a_zb_y\\a_zb_x-a_xb_z\\a_xb_y-a_yb_x \end{bmatrix}. \]

Its magnitude is \(\|\mathbf a\|\|\mathbf b\|\sin\theta\). A nonzero result is perpendicular to both inputs; the zero result has no direction. The moment of a force about a chosen reference point is \(\boldsymbol\tau=\mathbf r\times\mathbf F\), where \(\mathbf r\) runs from that reference point to the force application point.

For \(\mathbf r=(0.5,0,0)\) m and \(\mathbf F=(0,-10,0)\) N,

\[ \boldsymbol\tau=(0,0,-5)\ \mathrm{N\,m}. \]

The moment about a joint’s declared unit axis \(\mathbf s\) is \(\mathbf s^T\boldsymbol\tau\). Calling this anatomical wrist flexion requires an anatomical axis convention; the Cartesian calculation alone does not identify it.

Linear Independence and Span

Vectors are independent when

\[ \sum_{i=1}^k c_i\mathbf v_i=0 \quad\Longrightarrow\quad c_1=\cdots=c_k=0. \]

Their span consists of all real linear combinations. A basis is an independent spanning set. Two nonzero vectors in \(\mathbb R^2\) are independent if neither is a multiple of the other; three vectors in \(\mathbb R^3\) are independent if they do not lie in one plane through the origin.

For a square matrix, \(|\det M|\) is the volume scale factor; the sign of a nonzero determinant records orientation. The matrix \(\operatorname{diag}(-2,3)\) reverses orientation and multiplies area by six. A negative determinant does not imply preservation of volume.

Matrix Rank and the Four Fundamental Subspaces

For \(M\in\mathbb R^{m\times n}\) with rank \(r\), the four subspaces are:

Subspace Mathematical Meaning Dim.
Image \(\operatorname{im}M\) Outputs \(M\mathbf v\), in \(\mathbb R^m\) \(r\)
Kernel \(\ker M\) Inputs mapped to zero, in \(\mathbb R^n\) \(n-r\)
Row space \(\operatorname{im}M^T\) Euclidean orthogonal complement of \(\ker M\) \(r\)
Left kernel \(\ker M^T\) Euclidean orthogonal complement of \(\operatorname{im}M\) \(m-r\)

Thus rank plus nullity equals the number of columns. The left kernel contains directions orthogonal to every attainable output; it is not the set of all vectors outside the image.

If \(M=J(\mathbf q)\), its image describes instantaneous task velocities and its kernel describes task-null joint velocities. If \(M=C\) is a measurement matrix, its kernel contains states invisible at that instant. Dynamical unobservability additionally requires that the evolving state remain invisible.

Instantaneous Rank and Finite-Time Control

A \(3\times7\) hand-position Jacobian can have full task rank three and a four-dimensional kernel. This is kinematic redundancy, not proof of singularity or underactuation. A kinematic singularity is a drop below the maximum rank attainable by the specified mechanism and task. An inherently lower-dimensional task image need not be a singular configuration. Underactuation concerns independent force or torque inputs relative to the system’s mechanical degrees of freedom.

Even instantaneous task-null motion needs care. For two unit-length planar links,

\[ h(q_1,q_2)= \begin{bmatrix} \cos q_1+\cos(q_1+q_2)\\ \sin q_1+\sin(q_1+q_2) \end{bmatrix}. \]

At \(\mathbf q=0\), \(J=\begin{bmatrix}0&0\\2&1\end{bmatrix}\), and \((1,-2)^T\) is in its kernel. Following the straight joint path \(\mathbf q(t)=t(1,-2)^T\) gives

\[ h(\mathbf q(t))=(2\cos t,0)^T. \]

The hand is stationary to first order at \(t=0\), but it does move afterward. Finite self-motion requires a path that satisfies the changing task constraint, and a singular kernel direction need not integrate into such a path.

Control over time is another question. The double integrator has

\[ \dot{\mathbf x}=A\mathbf x+Bu,\quad A=\begin{bmatrix}0&1\\0&0\end{bmatrix},\quad B=\begin{bmatrix}0\\1\end{bmatrix}. \]

Although \(B\) has rank one, \([B,AB]\) has rank two. Its finite-time controllability Gramian is

\[ W(T)=\int_0^T e^{As}BB^Te^{A^Ts}\,ds =\begin{bmatrix}T^3/3&T^2/2\\T^2/2&T\end{bmatrix}, \qquad \det W(T)=T^4/12>0. \]

With unrestricted inputs, both states can be reached over any positive interval. Finite actuator limits restrict the reachable set and required time. Similarly, measuring position with \(C=[1,0]\) leaves velocity instantaneously hidden, but \([C^T,(CA)^T]^T=I_2\) makes this model observable over time. These are properties of \((A,B)\) and \((A,C)\), not of a generic matrix kernel.

Eigenvalues, Modes and Stability

An eigenvector is a nonzero vector satisfying

\[ A\mathbf v=\lambda\mathbf v. \]

For a real matrix, eigenvalues and eigenvectors may be complex. A planar quarter-turn has eigenvalues \(\pm i\) and no real invariant line. A real negative eigenvalue reverses direction along its invariant line; zero annihilates that eigenvector.

For a symmetric rigid-body inertia tensor about the centre of mass, eigenvectors give principal axes and eigenvalues give principal moments. Angular momentum is a vector, not a matrix with eigenvectors. The relation \(\mathbf L=I\boldsymbol\omega\) makes momentum parallel to angular velocity along principal axes, but torque, inertia and initial conditions govern precession. For a torque-free rigid body with three distinct principal moments, rotation about the intermediate principal axis is unstable; identifying an inertia eigenvector alone does not prove stable rotation.

Constant Linear Dynamics and Their Limits

For a constant continuous-time system \(\dot{\mathbf x}=A\mathbf x\):

  • All eigenvalues with negative real parts give exponential asymptotic stability.
  • Any eigenvalue with positive real part gives instability.
  • If all real parts are nonpositive, stability on the imaginary-axis boundary requires every imaginary-axis eigenvalue to be semisimple: no Jordan block larger than one. Such a system is not asymptotically stable if an imaginary-axis eigenvalue is present.

For example, \(A=0\) has constant bounded solutions. The double-integrator \(A\) above has the same two zero eigenvalues, but \(\mathbf x(0)=(0,1)^T\) gives \(\mathbf x(t)=(t,1)^T\), which is unbounded.

For a continuously differentiable nonlinear system near an equilibrium, a Hurwitz linearization proves local asymptotic stability; a positive-real-part eigenvalue proves instability. Imaginary-axis eigenvalues leave the nonlinear conclusion undecided: \(\dot x=-x^3\) and \(\dot x=x^3\) have the same zero linearization and opposite stability. Eigenvalues of instantaneous matrices along a time-varying swing are not, by themselves, a finite-time stability certificate.

Stable Systems Can Amplify Perturbations

For

\[ A=\begin{bmatrix}-1&10\\0&-1\end{bmatrix}, \qquad e^{At}=e^{-t}\begin{bmatrix}1&10t\\0&1\end{bmatrix}, \]

both eigenvalues are \(-1\), yet an initial perturbation \((0,1)^T\) has norm \(\sqrt{101}/e\approx3.697\) at one second. It eventually decays. This nonnormal transient amplification can matter greatly when impact occurs before the transient subsides.

A quadratic Lyapunov function \(V=\mathbf x^TP\mathbf x\), \(P\succ0\), satisfies

\[ \dot V=\mathbf x^T(A^TP+PA)\mathbf x. \]

Negative definiteness of \(A^TP+PA\) proves decay in that metric. Nonpositive \(\dot V\) alone does not prove convergence: an undamped oscillator keeps its positive energy constant. A mathematical Lyapunov metric need not equal physical kinetic energy.

Singular Value Decomposition

Every real \(m\times n\) matrix has an SVD

\[ M=U\Sigma V^T, \]

where \(U\) and \(V\) are orthogonal and can include reflections. The rectangular diagonal \(\Sigma\) contains \(\min(m,n)\) nonnegative singular values. The columns of \(V\) are input directions; the columns of \(U\) are output directions:

\[ M\mathbf v_i=\sigma_i\mathbf u_i. \]

The image of a unit ball is a possibly degenerate ellipsoid. A wide full-row-rank matrix has a nontrivial kernel even when every listed singular value is positive; the remaining columns of a full \(V\) also matter.

Eigenvalues and singular values answer different questions. The shear

\[ M=\begin{bmatrix}1&1\\0&1\end{bmatrix} \]

has eigenvalues \(1,1\) but singular values \((1+\sqrt5)/2\) and \((\sqrt5-1)/2\). Its ellipse axes are singular directions. For a symmetric matrix the singular values are the absolute eigenvalues; only in the positive-semidefinite case can the sorted values agree without taking absolute values.

Manipulability Requires a Declared Budget

With a Euclidean unit joint-speed ball, \(J\) maps that ball to a velocity ellipsoid with semiaxes \(\sigma_i\) along \(\mathbf u_i\). Changing units or mixing rotational and translational coordinates changes raw singular values.

More generally, declare positive-definite joint and task metrics \(H,W\):

\[ \dot{\mathbf q}^TH\dot{\mathbf q}\le1, \qquad \|\mathbf v\|_W^2=\mathbf v^TW\mathbf v. \]

The relevant normalized map is \(\bar J=W^{1/2}JH^{-1/2}\). Use its SVD to compare directions under those particular budgets. Metrics can normalize units, represent selected speed scales, or encode a physical energy model; those choices are not interchangeable.

Virtual work gives the force dual \(\boldsymbol\tau=J^T\mathbf F\), hence \(\boldsymbol\tau^T\dot{\mathbf q}=\mathbf F^T\mathbf v\). Under a unit Euclidean joint-torque budget, full-row-rank \(J\) gives a static force ellipsoid with semiaxes \(1/\sigma_i\). This says nothing about unlimited structural strength or actual dynamic force production. Joint limits, contact, material loads and the torque needed for acceleration can dominate the usable force.

What the Pseudoinverse Does Not Guarantee

The Moore–Penrose pseudoinverse is \(J^+=V\Sigma^+U^T\). It produces the minimum-Euclidean-norm least-squares solution. It exactly realizes a requested task velocity only when that velocity lies in \(\operatorname{im}J\).

Small nonzero singular values still produce large inverse gains. For \(J=\operatorname{diag}(1,10^{-3})\), requesting \((1,1)^T\) gives joint velocity \((1,1000)^T\). A backward-stable numerical algorithm cannot remove the underlying sensitivity.

The condition number \(\kappa_2(J)=\sigma_{\max}/\sigma_{\min}\) describes relative sensitivity under the specified full-rank interpretation. It does not measure absolute inverse gain: \(J=\epsilon I\) has condition number one and inverse norm \(1/\epsilon\).

Damped least squares instead minimizes

\[ \|J\dot{\mathbf q}-\mathbf v\|_2^2 +\lambda^2\|\dot{\mathbf q}\|_2^2,\qquad\lambda>0. \]

Its singular-direction gain obeys

\[ \frac{\sigma_i}{\sigma_i^2+\lambda^2}\le\frac1{2\lambda}. \]

It bounds inverse gain by accepting a task residual. It does not itself enforce joint-speed limits or prove closed-loop stability. Truncating small singular values likewise requires a declared numerical tolerance; numerical rank need not equal exact physical rank.

Mechanical Matrices and Their Transformations

For a nonzero velocity to have positive kinetic energy, the mass matrix in independent generalized-velocity coordinates must be SPD. Redundant coordinates, massless idealizations or singular coordinate charts can violate this premise. Constrained dynamics may instead use a reduced matrix or an indefinite augmented system.

An inertia bilinear form and a dynamics endomorphism transform differently. If \(\mathbf v=S\widetilde{\mathbf v}\),

\[ \widetilde M=S^TMS,\qquad \widetilde{\boldsymbol\tau}=S^T\boldsymbol\tau, \qquad \widetilde A=S^{-1}AS. \]

The first two preserve energy and power; the last preserves the linear operator under a constant basis change. Congruence preserves definiteness but generally changes raw eigenvalues. Using a corresponding metric is essential when interpreting a rescaled inertia matrix.

A dyad \(\mathbf a\mathbf b^T\) maps an input to \(\mathbf a\) times its component measured along \(\mathbf b\). A stable, linear conservative spring has a symmetric PSD stiffness, such as \(k\mathbf n\mathbf n^T\) with \(k\ge0\). A general nonsymmetric dyad is not such a spring: the field \(\mathbf F(x,y)=(0,x)\) does one unit of work around a counterclockwise unit square, so it cannot be the gradient of a single-valued potential.

For an unprestressed truss, assembly must retain connectivity:

\[ K=\sum_e k_eB_e^TB_e,\qquad B_e=[-\mathbf n_e^T,\mathbf n_e^T] \]

for one member’s two incident nodes. This member contributes a \(6\times6\) nodal stiffness with rigid-translation null modes. A \(3\times3\) sum of member direction dyads describes only a special anchored-node reduction.

Spatial inertia similarly needs a declared origin and velocity convention. It maps twist to spatial momentum, not directly to wrench; momentum rate and frame transport determine the wrench. These distinctions connect the chapter’s algebra to the later full-body equations.

Worked Examples

Example 1.1: Rotation Matrix as Linear Map

\[ R(\theta)=\begin{bmatrix}\cos\theta&-\sin\theta\\ \sin\theta&\cos\theta\end{bmatrix}. \]

Since \(R^TR=I\), \(\|R\mathbf v\|^2=\mathbf v^TR^TR\mathbf v=\|\mathbf v\|^2\). This preserves lengths and pairwise distances. Eigenvalues are \(e^{\pm i\theta}\); there are no real eigenvectors unless \(\theta\) is an integer multiple of \(\pi\).

Example 1.2: Joint Torque Projection

The earlier force example gives \((0,0,-5)\) N m. A revolute joint with positive axis \((0,0,1)\) therefore receives generalized moment \(-5\) N m from that force. With joint rate \(2\) rad/s, its power contribution is \(-10\) W. A different rate changes power without changing the instantaneous moment.

Example 1.3: Upright Pendulum Stability

For a point mass on a massless rigid link, linearized about upright,

\[ A=\begin{bmatrix}0&1\\g/L&0\end{bmatrix}, \qquad \lambda=\pm\sqrt{g/L}. \]

With \(g=9.81\) m/s² and \(L=1\) m, the growing mode has rate \(3.1321\) s\(^{-1}\) and doubling time \(\ln2/\sqrt{g/L}\approx0.2213\) s. Perturbations with a component in that mode grow while the local approximation applies. This is not a complete fall trajectory, and an initial state exactly in the linear stable eigenspace is an exception to the claim that every perturbation grows.

Python Implementations

The following blocks run in order. They report numerical properties of the declared examples rather than infer a golfer’s performance.

import numpy as np

v = np.array([1.0, 2.0, 3.0])
w = np.array([4.0, 5.0, 6.0])
print("Dot product:", v @ w)                 # 32
print("Cross product:", np.cross(v, w))      # [-3, 6, -3]
print("Norm:", np.linalg.norm(v))           # sqrt(14)

GRAVITY_M_S2 = 9.81
LENGTH_M = 1.0
A = np.array([[0.0, 1.0], [GRAVITY_M_S2 / LENGTH_M, 0.0]])
values = np.linalg.eigvals(A)
spectral_abscissa = np.max(values.real)
# This example's tolerance is in reciprocal seconds, not a universal rule.
TOLERANCE_PER_S = 1e-10
if spectral_abscissa < -TOLERANCE_PER_S:
    print("Constant linear model: asymptotically stable")
elif spectral_abscissa > TOLERANCE_PER_S:
    print("Constant linear model: unstable")
else:
    print("Boundary or unresolved numerically: inspect Jordan structure and model")
print("Eigenvalues:", values)
# Dimensionless, normalized example: three task coordinates, four joints.
J = np.array([[1.0, 0.5, 0.2, 0.0],
              [0.0, 1.0, 0.8, 0.3],
              [0.0, 0.0, 1.0, 0.9]])
U, sigma, Vt = np.linalg.svd(J, full_matrices=True)
print("Singular values:", sigma)
print("Condition number:", sigma[0] / sigma[-1])
print("Kernel residual:", np.linalg.norm(J @ Vt[-1]))
assert np.linalg.matrix_rank(J) == 3
assert np.allclose(J @ np.linalg.pinv(J), np.eye(3))
# Full task rank and a nontrivial kernel coexist; no near-singularity is implied.

weak = np.diag([1.0, 1e-3])
desired = np.ones(2)
DAMPING = 0.1
regularized = np.linalg.solve(
    weak.T @ weak + DAMPING**2 * np.eye(2), weak.T @ desired
)
print("Undamped command:", np.linalg.pinv(weak) @ desired)
print("Damped command:", regularized)
print("Damped task residual:", weak @ regularized - desired)
def rotation_2d(theta_deg: float) -> np.ndarray:
    theta = np.radians(theta_deg)
    return np.array([[np.cos(theta), -np.sin(theta)],
                     [np.sin(theta), np.cos(theta)]])

R45 = rotation_2d(45.0)
rotated = R45 @ np.array([1.0, 0.0])
print("Rotated vector:", rotated)
assert np.allclose(R45.T @ R45, np.eye(2))
assert np.isclose(np.linalg.norm(rotated), 1.0)

Exercises

1.1 A wrist force sensor reads \((3,-4,0)\) N and a joint’s unit axis is \((0,0,1)\). Find the force components parallel and perpendicular to that axis. Explain why a moment arm is still needed to compute the joint moment.

1.2 A constant continuous-time dynamics matrix has eigenvalues \(-2\pm3i\). Determine its asymptotic stability and modal angular frequency. Explain why these eigenvalues alone do not bound the largest finite-time Euclidean amplification.

1.3 Compute the rank and a kernel basis for

\[ M=\begin{bmatrix}1&2&3\\2&4&6\\1&1&1\end{bmatrix}. \]

1.4 A uniform thin rectangular plate has dimensions \(a=0.4\) m, \(b=0.3\) m and mass \(m=2\) kg. About its centre of mass, with axes parallel to its edges and normal,

\[ I=\frac m{12}\operatorname{diag}(b^2,a^2,a^2+b^2). \]

Compute the principal moments and identify the smallest. State what is held fixed when calling an axis “easiest to spin about.”

1.5 Consider two point masses joined by massless links, with no damping. Let \(q_1,q_2\) be absolute link angles from vertically downward. Linearization at rest gives \(M_0\ddot{\mathbf q}+K_0\mathbf q=0\), with

\[ M_0=\begin{bmatrix} (m_1+m_2)L_1^2&m_2L_1L_2\\ m_2L_1L_2&m_2L_2^2 \end{bmatrix}, \quad K_0=g\operatorname{diag}((m_1+m_2)L_1,m_2L_2). \]

Construct \(A=\begin{bmatrix}0&I\\-M_0^{-1}K_0&0\end{bmatrix}\). For equal masses and lengths \(L=0.5\) m, show that the two natural angular frequencies are \(\sqrt{(2\pm\sqrt2)g/L}\). These are undamped normal modes, not a prescribed sequence for a golf swing.

1.6 Verify the shear SVD, transient-growth, task-null path and double-integrator Gramian examples independently. Which statements are coordinate dependent, and which retain a physical interpretation after the corresponding metric is transformed?

Summary

Each matrix answers a question fixed by its domain, codomain, metric and model. A task Jacobian describes instantaneous motion; its transpose transmits force through virtual work. Inertia relates velocity to momentum and kinetic energy. A dynamics matrix describes the evolution of a state perturbation, and control or observability over time depends on the dynamics together with inputs or measurements.

For the golf investigation, this gives a sequence of questions to carry into later chapters: which motion is kinematically available, what force and energy budget produces it, how do perturbations evolve before contact, and which measurements can distinguish competing explanations? A favorable singular value, stable eigenvalue or small numerical residual answers only its own part of that chain.

Citation

BibTeX citation: Download .bib
@online{untitled,
  author = {},
  title = {Chapter 1: {A} {Primer} on {Linear} {Algebra}},
  url = {https://affinedrift.com/articles/The_Geometry_of_Motion/quarto/vol0_ch01_linear_algebra.html},
  langid = {en}
}
For attribution, please cite this work as:
“Chapter 1: A Primer on Linear Algebra.” n.d. https://affinedrift.com/articles/The_Geometry_of_Motion/quarto/vol0_ch01_linear_algebra.html.