The Projected Gauss-Seidel (PGS) solver is an iterative numerical algorithm used in physics engines to solve Linear Complementarity Problems (LCPs) arising from contact, joint, and friction constraints by sequentially projecting the solution for each variable onto a feasible set. It is a specialized variant of the classic Gauss-Seidel method that incorporates projection operations to enforce physical limits like non-penetration and force non-negativity, making it highly effective for real-time simulations where approximate solutions are acceptable.
Glossary
Projected Gauss-Seidel (PGS) Solver

What is Projected Gauss-Seidel (PGS) Solver?
A core iterative numerical method for resolving physical constraints in real-time physics engines.
PGS operates by solving constraints one at a time in a loop, using the most recent solution values, which promotes fast convergence for contact resolution. Its sequential nature and low memory footprint make it suitable for parallel processing on modern hardware. While less mathematically rigorous than a direct LCP solver, PGS's speed and stability have cemented its role as the standard solver in many game physics engines and robotic simulators for rigid body dynamics.
Key Characteristics of the PGS Solver
The Projected Gauss-Seidel (PGS) solver is an iterative numerical method central to real-time physics engines. It efficiently resolves constraints like contact and joints by sequentially projecting solutions onto physically feasible sets.
Sequential Iterative Method
PGS operates by sequentially processing constraints one at a time. Unlike batch methods that solve all constraints simultaneously, it updates the solution for a single constraint and immediately uses that result for the next. This local propagation often converges faster for contact-dominated problems. The core update for a constraint i is:
delta_lambda = (b_i - sum(a_ij * lambda_j)) / a_iilambda_i_new = clamp(lambda_i_old + delta_lambda, lower_bound, upper_bound)wherelambdais the constraint impulse (e.g., contact force) and clamping enforces bounds like non-penetration.
Projection Onto Feasible Sets
The "Projected" in PGS refers to the operation that enforces physical bounds on the solution. After each local Gauss-Seidel update, the computed value is projected (clamped) onto a feasible interval. For contact constraints, this typically means:
- Normal forces are projected onto
[0, +inf)to prevent adhesive forces (no pulling). - Friction forces are projected onto a Coulomb friction cone
[-mu * lambda_normal, +mu * lambda_normal]. This projection is what guarantees a physically plausible solution, ensuring objects push apart but do not stick together.
Solving Linear Complementarity Problems (LCP)
PGS is specifically designed to solve Linear Complementarity Problems (LCPs), the mathematical formulation of rigid body contact with friction. An LCP states that for contact i:
lambda_i >= 0(force must be non-negative)v_i >= 0(relative velocity at contact must be non-penetrating)lambda_i * v_i = 0(complementarity: either force is zero or velocity is zero) PGS finds an approximate solution to this hard problem through iterative projection, making it more robust and faster than direct LCP solvers for real-time applications.
Warm Starting
A key performance optimization in PGS is warm starting. The solver reuses the impulse (lambda) values from the previous simulation time step as the initial guess for the current step. Since object positions and contacts change relatively slowly between frames (typically 60Hz or 120Hz), the previous solution is often very close to the new one. This drastically reduces the number of iterations required for convergence, which is critical for maintaining real-time performance in games and interactive simulations.
Comparison to Alternative Solvers
PGS is favored in real-time engines for its speed and stability, but trades off some accuracy.
- Vs. Direct Methods (e.g., Pivoting LCP Solvers): Direct methods are more accurate but have unpredictable O(n³) worst-case time, unsuitable for real-time. PGS offers predictable O(n) per iteration.
- Vs. Jacobi Methods: A Jacobi solver updates all constraints in parallel using values from the previous iteration. It's more parallelizable but converges slower per iteration than Gauss-Seidel's sequential updates.
- Vs. Newton Methods: Newton-based solvers (like Sequential Impulse, which is similar to PGS with a full Jacobian) can have faster convergence but may require more complex matrix setups.
Application in Constraint Types
PGS is versatile and used to solve various physics constraints:
- Contact Constraints: Preventing inter-penetration and modeling friction.
- Joint Constraints: Restricting degrees of freedom between bodies (e.g., hinges, sliders, ball joints).
- Ragdoll Constraints: Keeping bones within anatomical limits.
- Soft Constraints: Such as springs or motors, where bounds may be elastic limits or torque limits.
The same iterative, bounded solving loop applies, with the Jacobian matrix
Jdefining how each constraint affects body velocities and the effective mass matrixJM⁻¹Jᵀforming thea_iiterm in the update rule.
PGS vs. Other Constraint Solvers
A technical comparison of the Projected Gauss-Seidel (PGS) solver against other common numerical methods for resolving constraints in physics-based simulations.
| Feature / Metric | Projected Gauss-Seidel (PGS) | Sequential Impulse (SI) | Linear Complementarity Problem (LCP) Solver |
|---|---|---|---|
Core Algorithm | Iterative relaxation with projection | Iterative impulse application | Batched matrix formulation |
Primary Use Case | Real-time simulation, contact & joints | Real-time simulation, stable stacking | Offline/High-accuracy simulation, tight constraints |
Solution Guarantee | Approximate, converges to a solution | Approximate, converges to a solution | Exact, mathematically optimal (for convex problems) |
Computational Complexity | O(n) per iteration, low constant factor | O(n) per iteration, low constant factor | O(n³) for direct methods, high constant factor |
Parallelization Potential | Low (sequential updates) | Low (sequential updates) | High (matrix operations) |
Warm Starting Support | |||
Handling of Friction | Approximate, often coupled | Approximate, often staggered | Exact, can be incorporated into matrix |
Deterministic Execution | |||
Memory Footprint | Low (stores per-constraint data) | Low (stores per-constraint impulses) | High (stores system Jacobian matrix) |
Typical Iteration Count | 5-20 for real-time | 5-20 for real-time | 1 (direct) or variable (iterative) |
Where is PGS Used?
The Projected Gauss-Seidel (PGS) solver is a workhorse algorithm in interactive and real-time physics simulation, prized for its stability and efficiency in handling complex constraint systems.
Real-Time Game Physics
PGS is the foundational solver in many real-time game physics engines, such as NVIDIA PhysX and Bullet Physics. Its sequential, iterative nature provides predictable performance and robust handling of stacked objects and persistent contacts, which are common in gameplay scenarios. Key advantages include:
- Stability with large time steps: Tolerates the variable frame rates common in games.
- Warm starting: Uses solutions from previous frames to converge faster.
- Handling of inequality constraints: Efficiently manages non-penetration and friction without solving a full global system matrix.
Robotic Simulation & Training
In sim-to-real transfer learning, physics engines like Isaac Sim and MuJoCo utilize PGS and its variants to simulate contact-rich environments for training robotic policies. It is critical for modeling:
- Grasping and manipulation: Solving contact forces between grippers and objects.
- Legged locomotion: Resolving foot-ground interactions for walking and running robots.
- Articulated systems with joints: PGS efficiently handles the mixed constraints of joint limits and contact forces simultaneously, which is essential for simulating complex robotic mechanisms before real-world deployment.
Interactive Rigid Body Dynamics
For applications requiring direct user interaction with simulated objects—such as virtual prototyping, digital twins, and interactive design tools—PGS provides the necessary stability. Its projection step ensures constraints like non-penetration are strictly enforced, preventing objects from sinking into each other even under persistent user-applied forces. This makes it ideal for simulating:
- Particle systems and granular materials (when combined with constraint-based formulations).
- Complex assemblies of rigid parts connected by joints.
- Puzzle-like interactions where stability is more critical than absolute physical accuracy.
Cloth and Soft Body Simulation
While Position-Based Dynamics (PBD) is often used for real-time deformables, PGS is employed in constraint-based approaches to simulate cloth, ropes, and soft bodies. In this context, distance constraints (to maintain edge lengths) and bending constraints are solved iteratively. The projection in PGS directly corrects vertex positions to satisfy these constraints, making it effective for:
- Real-time garment simulation on characters.
- Flag and cable dynamics.
- Interactive soft object manipulation where two-way coupling with rigid bodies is required.
Complementarity Problem Formulation
PGS is a specific iterative method for solving the Linear Complementarity Problem (LCP) formulation of contact physics. It addresses problems of the form Ax + b = w, where x ≥ 0, w ≥ 0, and x⋅w = 0 (the complementarity condition). This mathematically captures the "non-penetration and non-adhesion" nature of contact. PGS solves this by:
- Sequentially processing each constraint (contact point).
- Projecting the solution for that constraint onto its feasible set (e.g., force must be non-negative).
- Updating the system's velocity/force estimates, which influences subsequent constraint solves in the same iteration.
Comparison to Alternative Solvers
PGS is chosen over other numerical solvers based on the requirements of the application:
- vs. Direct Solvers (e.g., Pivoting Methods): PGS is iterative and approximate but offers O(n) complexity per iteration and better stability for ill-conditioned systems (e.g., large mass ratios). Direct solvers are exact but can be O(n³) and fail on indefinite systems.
- vs. Gradient-Based Methods: PGS is a specialized successive over-relaxation (SOR) method for LCPs, often more robust for contact problems than generic gradient descent.
- vs. Its Variants: Sequential Impulse (SI) is a nearly identical method often used synonymously. Extended PGS (XPGS) and PGS with Shock Propagation are enhancements that improve convergence for challenging stacks and loops of constraints.
Frequently Asked Questions
The Projected Gauss-Seidel (PGS) solver is a core iterative algorithm in physics engines for resolving constraints like contact and joints. These questions address its mechanics, applications, and role in modern simulation.
The Projected Gauss-Seidel (PGS) solver is an iterative numerical method used in physics engines to resolve systems of inequality constraints, such as contact non-penetration and joint limits, by sequentially projecting solutions onto feasible sets.
It works by processing constraints one at a time in a loop. For each constraint (e.g., a contact point preventing two bodies from overlapping), the solver calculates an impulse or positional correction needed to satisfy that single constraint in isolation, ignoring others temporarily. This correction is "projected" to ensure it adheres to physical limits (e.g., contact forces must be non-adhesive, or friction must obey the Coulomb model). After updating the system state for that constraint, it moves to the next. This loop repeats for many iterations, allowing corrections to propagate through the system until all constraints are approximately satisfied within a tolerance.
Its sequential, local nature makes it highly efficient for parallel processing on GPUs, a key reason for its adoption in real-time engines like NVIDIA PhysX.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The Projected Gauss-Seidel (PGS) solver is a core component within the constraint-solving stage of a modern physics engine. Understanding its related concepts is essential for engineers working on contact resolution, articulated systems, and real-time simulation.
Constraint Solver
A constraint solver is the algorithmic core of a physics engine responsible for calculating forces and impulses to satisfy physical constraints. These constraints define relationships between bodies, such as:
- Contact constraints preventing interpenetration.
- Joint constraints like hinges or sliders that limit relative motion.
- Stability constraints for numerical integration. The solver's objective is to find a set of forces that satisfy all constraints simultaneously, often formulated as a large system of equations or inequalities. PGS is one specific iterative method used to solve this problem efficiently.
Linear Complementarity Problem (LCP)
A Linear Complementarity Problem (LCP) is the formal mathematical framework underlying many rigid body contact and friction models. It is expressed as finding vectors w and z such that:
w = Mz + q, w ≥ 0, z ≥ 0, and wᵀz = 0.
- M is a matrix capturing system inertia and constraint geometry.
- q is a vector of relative velocities and biases.
- The complementarity condition
wᵀz = 0enforces that forces (z) are only applied when there is no separation (w). PGS is a robust, iterative algorithm for approximating solutions to the LCP, especially suited for large systems with many contact points where direct solvers are too slow.
Sequential Impulse
Sequential Impulse is a closely related iterative solver technique popularized by Erin Catto for real-time physics. It operates by:
- Processing constraints one at a time.
- Calculating an impulse that partially satisfies the current constraint.
- Immediately applying that impulse to the involved bodies' velocities.
- Cycling through all constraints repeatedly until convergence. PGS can be viewed as a specific implementation of the sequential impulse idea with a formal projection step that ensures solutions stay within feasible bounds (e.g., non-negative normal forces). This method is prized for its simplicity, stability, and ease of warm-starting from a previous frame's solution.
Contact and Friction Model
The contact model defines the physical laws governing collisions. A PGS solver typically implements a velocity-level model with Signorini's condition and Coulomb friction. Key components are:
- Non-penetration: Relative normal velocity must be non-negative (objects separate or rest).
- Newton's restitution: A coefficient models energy loss during collision.
- Coulomb friction: Tangential force magnitude is bounded by the normal force times a friction coefficient. PGS solves for normal and frictional impulses concurrently, projecting solutions onto a friction cone approximation (often a pyramidal or linearized cone) to satisfy these coupled constraints.
Jacobian Matrix
In the context of constraint solving, the Jacobian matrix is a fundamental mathematical object. For each constraint, the Jacobian J is a matrix that:
- Maps the applied constraint force (a scalar or small vector) into the force/torque space of each affected body.
- Relates body velocities to the constraint's relative velocity:
v_rel = J * v. Within the PGS formulation, the system matrix M in the LCP is built from the mass-inertia matrices of the bodies and the Jacobians of all active constraints. Constructing and using these Jacobians efficiently is critical for solver performance.
Iterative vs. Direct Solvers
PGS is an iterative solver, contrasting with direct solvers like those based on matrix factorization (e.g., LDLT). Their trade-offs are significant for simulation:
Iterative (PGS):
- Pros: Lower per-iteration cost, memory efficient, naturally handles indefinite systems, easy to warm-start.
- Cons: Provides an approximate solution; convergence can be slow for ill-conditioned systems.
Direct Solvers:
- Pros: Provide an exact (to numerical precision) solution in a fixed number of steps.
- Cons: Higher computational and memory cost (O(n³), O(n²)), struggle with changing constraint topology.
PGS is favored in real-time applications (games, robotics sim) where speed and robustness are prioritized over absolute precision.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us