Fundamentals / Numerical mathematics / Numerical linear algebra

Eliminating constraints with Schur complements

Eliminate auxiliary variables, recover constraint forces and account for the sign and conditioning of a reduced system.

From first principles

Eliminate one block of unknowns before solving the rest

A coupled model can have different types of unknowns, such as internal and boundary displacements. Write its linear system in block form with a nonsingular first block \(K\). The first row expresses one group in terms of the other,

\[Ku+Cv=f,\]
\[u=K^{-1}(f-Cv).\]

Substitute into the remaining balance \(Bu+Dv=g\). Collect all terms that still depend on \(v\) to obtain a smaller system and a recovery step,

\[(D-BK^{-1}C)v=g-BK^{-1}f,\]
\[Ku=f-Cv .\]

The new coefficient matrix is the Schur complement of \(K\). The term in the right-hand side is needed even when no external load acts directly on the retained variables. In practice, notation such as \(K^{-1}C\) denotes solves with columns of \(C\) or an operator action; explicit inversion is unnecessary. If the full matrix and \(K\) are both nonsingular, so is the Schur complement. Very small reduced eigenvalues can signal a weakly constrained remaining quantity.

Background · Schur complement
\[S=D-CA^{-1}B\]

Eliminate the first block of a partitioned system by solving with A. Forming an explicit inverse is unnecessary and may discard useful structure.

Derivation and applications

Update a solved system after adding one spring or penalty

Suppose factors of a symmetric positive definite matrix \(A\) already exist and a small model change adds one positive stiffness \(k\) acting on the relative coordinate \(u^Tx\). The added energy is \(\tfrac12k(u^Tx)^2\), whose gradient adds \(ku(u^Tx)\) to the original balance. Introduce its scalar force \(t=ku^Tx\). Solving the old matrix with the new internal force gives

\[(A+kuu^T)x=b,\]
\[x=x_0-zt,\]
\[Ax_0=b,\]
\[Az=u .\]

Use the constitutive equation for \(t\) to eliminate the full state and solve a one-dimensional Schur complement. The scalar \(u^Tz=u^TA^{-1}u\) is positive for nonzero \(u\). Hence the denominator is safely nonzero for a positive added stiffness,

\[(k^{-1}+u^Tz)t=u^Tx_0,\]
\[x=x_0-z\frac{k\,u^Tx_0}{1+k\,u^Tz}.\]

The new relative displacement follows by applying \(u^T\) again,

\[u^Tx=\frac{u^Tx_0}{1+k\,u^TA^{-1}u}.\]

This explicitly shows how the added stiffness reduces extension. If the old extension is zero, adding the spring changes neither the old force balance nor the solution. As \(k\) becomes arbitrarily large the extension tends to zero while the internal force approaches a finite constraint reaction. The original factors can serve many choices of stiffness when the location \(u\) stays fixed.

Worked example

Retrofit a link between two supported nodes

Take \(A=\operatorname{diag}(2,4)\,\mathrm{N/m}\), load \(b=(2,0)^T\,\mathrm N\), and \(u=(1,-1)^T\). Initially \(x_0=(1,0)^T\,\mathrm m\); the unit response \(z=(0.5,-0.25)^T\,\mathrm{m/N}\) gives

\[u^Tz=0.75\,\mathrm{m/N}.\]

Adding \(k=4\,\mathrm{N/m}\) gives \(t=1\,\mathrm N\), \(x=(0.5,0.25)^T\,\mathrm m\) and relative extension \(0.25\,\mathrm m\).

Second application

Determine the stiffness needed for a target extension

A different model gives old relative displacement \(6.00\,\mathrm{mm}\) and relative compliance \(0.0200\,\mathrm{m/N}\). Cutting the extension to \(2.00\,\mathrm{mm}\) requires \(1+k(0.0200)=3\), hence \(k=100\,\mathrm{N/m}\). The new force is \(0.200\,\mathrm N\), producing a compliance displacement \(0.0200(0.200)=4.00\,\mathrm{mm}\), exactly the required reduction.

Two coupled sets of equations

A constrained equilibrium may contain displacements \(u\) and reaction coefficients \(\lambda\). Suppose the energy Hessian \(K\) is symmetric positive definite and the constraint matrix \(B\) has independent rows. With applied force \(f\) and prescribed values \(g\), stationarity of \(u^TKu/2-f^Tu+\lambda^T(Bu-g)\) gives \(Ku+B^T\lambda=f\) and \(Bu=g\). The full symmetric matrix is indefinite. Minimising the quadratic energy under the constraints still gives a unique displacement because the energy curves upward along every permissible direction.

Deriving a reduced operator

Solve the first equation formally for \(u=K^{-1}(f-B^T\lambda)\). Inserting this expression into the constraint gives a smaller positive system,

\[S\lambda=BK^{-1}f-g,\]
\[S=BK^{-1}B^T.\]

The literal lower diagonal block left by elimination is \(-S\). Multiplying both sides by minus one produces the positive form written above. For any nonzero vector \(z\), full row rank implies \(B^Tz\ne0\), hence

\[z^TSz=(B^Tz)^TK^{-1}(B^Tz)>0.\]

This proof explains why redundant constraints create a singular reduced matrix. Even in that case the physical displacement can remain unique while reactions assigned to duplicate equations become ambiguous.

OneSimulation · How stiff must a link be to act like a constraint?

Two grounded springs with stiffnesses 2 and 8 N/mm carry the force vector \((10,0)^T\) N. Before coupling them, the gap between their displacements is 5 mm. A positive link reaction \(\lambda\) reduces that gap according to \(g=g_0-S\lambda\). The scalar Schur complement \(S=B K^{-1}B^T=0.625\) mm/N measures the gap closed by a unit reaction. A real link of stiffness \(k_c\) obeys \(g=\lambda/k_c\). Eliminating the gap gives

\[\lambda=\frac{g_0}{S+1/k_c}.\]

The stiffness of the structure as seen through the link is \(1/S=1.6\) N/mm. Matching this value transfers half the limiting reaction. Reaching 90% requires nine times this stiffness, or 14.4 N/mm. The code checks the reduced force against the full coupled displacement solution over four decades of link stiffness.

"""Find the reaction transmitted by a compliant link between two supports."""
import matplotlib.pyplot as plt
import numpy as np
from onesim.numerics.linear.matrices.dense_linear_algebra import solve_dense

support = np.diag([2.0, 8.0])  # N/mm
load = np.array([10.0, 0.0])  # N
gap = np.array([1.0, -1.0])  # positive when the first support moves farther
free_gap = gap @ solve_dense(support, load)
compliance = gap @ solve_dense(support, gap)  # mm/N
link_stiffness = np.geomspace(0.02, 200, 150)  # N/mm
reaction = free_gap / (compliance + 1 / link_stiffness)
rigid_reaction = free_gap / compliance

# Check the reduced equation against the full two-displacement system.
for stiffness, force in zip(link_stiffness, reaction):
    displacement = solve_dense(support + stiffness * np.outer(gap, gap), load)
    assert np.isclose(stiffness * (gap @ displacement), force)
print(f"Half the rigid reaction at {1/compliance:.2f} N/mm; rigid limit {rigid_reaction:.2f} N")

fig, ax = plt.subplots(figsize=(6.8, 3.8), constrained_layout=True)
ax.semilogx(link_stiffness, reaction, color="#176879", label="Elastic link")
ax.axhline(rigid_reaction, ls="--", color="#a4492b", label="Rigid constraint")
ax.plot(1/compliance, rigid_reaction/2, "o", color="#273d30")
ax.set(xlabel="Link stiffness (N/mm)", ylabel="Link reaction (N)", ylim=(0, 9))
ax.grid(alpha=0.2)
ax.legend()
fig.savefig("linear-algebra.png", dpi=160)
Reaction rises from almost zero to an 8 N plateau as link stiffness increases, reaching 4 N at 1.6 N/mm.
The bend in the curve occurs where the link and the two supports contribute equal compliance. The high-stiffness plateau is the 8 N reaction of the rigid constraint.

Download the Python example

Two springs sharing a displacement

Let \(K=\operatorname{diag}(2,8)\) in N/m and apply \(f=(10,0)^T\) N. A rigid link demands \(u_1-u_2=0\), so \(B=(1,-1)\) and \(g=0\). The uncoupled displacement is \((5,0)^T\) m. The reduced compliance is \(1/2+1/8=5/8\) m/N, giving \(\lambda=5/(5/8)=8\) N. Recovering the displacement gives \(u=(1,1)^T\) m. The first spring carries 2 N and the other carries 8 N. Independently, the common displacement under a total stiffness of 10 N/m is exactly one metre.

Prescribing a gap \(g=0.5\) m changes the reduced right-hand side to 4.5 m. The reaction drops to 7.2 N and the displacements become 1.4 and 0.9 m. Their difference verifies the new constraint. This calculation also identifies the multiplier sensitivity to a gap error as \(-1/S\), here \(-1.6\) N/m.

Solving without an explicit inverse

Applying \(S\) to a trial vector takes a multiplication by \(B^T\), a solve with \(K\), and a multiplication by \(B\). The reduced matrix may be dense even with local springs because the stiffness solve communicates through the structure. Reuse a factorisation when the load changes. With approximate inner solves, control their errors relative to the requested outer accuracy. Check force balance and compatibility independently after reconstructing \(u\). A tiny reduced residual obtained with inaccurate inner solves need not imply that the reconstructed state satisfies the original load equations.

A duplicate constraint as a diagnostic

Append a second row \(2B\) to the rigid-link constraint and prescribe a compatible right-hand side \(2g\). The new reduced matrix is \(S\left(\begin{smallmatrix}1&2\\2&4\end{smallmatrix}\right)\), which has determinant zero. Only the combination \(\lambda_1+2\lambda_2\) affects the applied reaction in the mechanical equations. In the zero-gap example every pair with that combination equal to 8 N gives the same displacement and resultant link force. A solver's complaint about a singular constraint block can thus expose a duplicated physical statement, even when a force measurement or displacement plot looks perfectly reasonable.

Condense internal degrees of freedom while preserving energy

Partition the degrees of freedom of a symmetric positive definite stiffness matrix into interior coordinates \(i\) and retained boundary coordinates \(b\). For a specified boundary displacement, the interior balance is

\[K_{ii}u_i=f_i-K_{ib}u_b.\]

Eliminating it produces the boundary operator \(S=K_{bb}-K_{bi}K_{ii}^{-1}K_{ib}\) and the effective boundary load \(f_b-K_{bi}K_{ii}^{-1}f_i\). This elimination differs physically from setting the interior displacement to zero: the interior has been allowed to respond to the prescribed boundary value and applied load.

With zero load, insert \(u_i=-K_{ii}^{-1}K_{ib}u_b\) into the full strain energy. Completing the square in \(u_i\) shows that the minimum energy at fixed boundary coordinates is \(u_b^TSu_b/2\). Since the full stiffness is positive definite, any nonzero boundary vector yields positive minimum energy. This gives a physical proof that the condensed operator is positive definite. A free-floating component may instead have rigid-body modes; then the same proof establishes only nonnegativity, and some imposed displacement patterns cause no stress.

Reduce a spring chain and preserve the internal load

Two springs connect a fixed left support to an observable endpoint through an internal joint. Their stiffnesses are 6 and 3 N/mm. Let the internal and boundary displacements be \(u_i,u_b\), and apply forces 3 and 6 N at those nodes. The strain energy is \([6u_i^2+3(u_b-u_i)^2]/2\). Differentiating gives

\[K_{ii}=9,\ K_{ib}=K_{bi}=-3,\ K_{bb}=3.\]

Condensing yields \(S=3-9/9=2\) N/mm and effective boundary load \(6-(-3)(3/9)=7\) N. Thus \(u_b=3.5\) mm. Recovering the internal state gives

\[u_i=(3+3u_b)/9=1.5\,\mathrm{mm}.\]

The first spring therefore carries \(6(1.5)=9\) N, and the second carries

\[3(3.5-1.5)=6\,\mathrm{N}.\]

Their difference is the internal force of 3 N and the support reaction balances the total applied load of 9 N. Simply using the well-known series stiffness \(2\) N/mm with the endpoint force 6 N would yield 3 mm, missing the transmitted effect of the interior load. Both condensed stiffness and condensed right-hand side are necessary in a reduced model.

A local finite-element assembly can repeat this calculation for many independent element interiors, retaining only interface coordinates for the global solve. To compute internal stress afterward, keep enough local factor information to reconstruct each eliminated state. The boundary displacement alone does not directly encode the internal load distribution; two differently loaded elements can have the same endpoint displacement and different internal stresses. This distinction matters whenever reduction is justified using one observable but results are later requested for another.

Under a change in the prescribed end condition, the same reduced law can be used in the opposite direction. Hold the endpoint at \(u_b=0\) with the internal 3 N force still present and remove the applied endpoint load. The recovered internal displacement is \(1/3\) mm. The computed endpoint force required to hold it fixed is \(-3u_i=-1\) N. A boundary law containing only the series stiffness would predict zero force for this imposed zero displacement.

Read the coupling introduced by eliminating an interior node

Three terminals join a central node through conductances \(1,2,g\) S. The central potential is their conductance-weighted average. Substitute it into each terminal current. The Schur complement introduces a direct pairwise conductance \(g_i g_j/\sum g_\ell\).

Read the coupling introduced by eliminating an interior node. Horizontal axis: Third branch conductance (S). Vertical axis: Equivalent branch conductance (S). Data follow the figure.
At g = 0 the first two resistors are in series, giving 2/3 S. At g = 3 the first-to-second coupling is only 1/3 S and two previously absent edges have appeared. Eliminating a single degree of freedom can make a sparse matrix locally dense.
Read values from the plot
Equivalent branch conductance (S) at selected values of Third branch conductance (S).
Third branch conductance (S)Between terminals 1 and 2Between terminals 1 and 3Between terminals 2 and 3
00.6666700
1.240.47170.292450.58491
2.50.363640.454550.90909
3.760.295860.556211.1124
50.250.6251.25

Download all 251 plotted samples (CSV)

Change parameters · Read the coupling introduced by eliminating an interior node

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Study the full derivation

When stable eigenvalues allow large transient growth · Matrix computations and spectral accuracy

Two damped states exchange energy in only one direction. Its eigenvalues predict ultimate decay, while a short-time response can grow by a large factor. Compute the matrix exponential, its gain and a resolvent-based sensitivity check.