Four bars and four pins
Take four rigid bars and pin them end to end into a closed loop. Fix one of them to the bench. What is left is a four-bar linkage, and it is the smallest thing in this subject that does anything interesting.
Three bars pinned into a triangle cannot move at all. Five bars give a mechanism with two degrees of freedom, which needs two inputs and is a different kind of object. Four is where one input produces one determinate output, which is what a machine is.
Almost everything on this site is a four-bar, a four-bar with a joint changed, or a chain of them.
What “solving” means here
The four joints are two fixed pivots — O₂ and O₄, bolted to the frame — and two moving pins, A and B. The moving pins have four coordinates between them, so a configuration is four numbers.
Those four numbers are not free. They satisfy:
- the crank’s pin A is at a fixed distance from O₂, in the direction the input angle specifies
- the coupler holds A and B a fixed distance apart
- the rocker holds B a fixed distance from O₄
Written out, that is four equations in four unknowns. The equations are not linear — a distance involves a square root — so there is no formula that solves them in one step, and the method is Newton–Raphson: guess, compute how badly the constraints are violated, compute the derivative of that violation with respect to each coordinate, take a step, repeat.
The violation is called the residual, and it is the number this whole site turns on. At a valid configuration it is zero. Measured across 360 positions of the linkage above, the worst residual is 2.4 × 10⁻¹⁴ — arithmetic noise, twelve orders of magnitude below the tolerance of 10⁻⁹ that decides whether a position counts as solved.
Why not just draw it
Because a drawn linkage does not satisfy its constraints, and nothing about the drawing says so.
The natural way to sketch a four-bar in motion is to put the crank pin where the input angle says — that part is easy, it is a point on a circle — and then put the rocker where it looks right, sweeping smoothly between the two extremes of its travel. That is exactly what the motion looks like.
This is the failure the solver makes impossible rather than merely unlikely. There is no way to draw a configuration that does not satisfy the constraints, because there is nothing to draw it from: the coordinates come out of the solve or they do not exist.
The solve has two answers
Newton’s method finds a solution, and a four-bar has two for almost every crank angle.
Given where A is, B must lie at a fixed distance from A and a fixed distance from O₄ — the intersection of two circles, which is two points. Reflecting B across the line AO₄ gives the other one, and it satisfies every equation exactly as well.
These are the assembly branches, and the distinction is physical rather than numerical. A built linkage is in one branch permanently: getting to the other requires taking a pin out and putting it back the other way. There is no motion that connects them.
That has a consequence for how every sweep on this site is computed. Each step carries the previous solution forward as its initial guess, so the solver stays in the branch it started in — which is what a physical mechanism does, since it cannot jump either. Starting each position from a fresh guess would produce an animation that flickers between two mechanisms, and the flicker would look like a rendering artefact rather than the modelling error it is.
What the four lengths decide
Everything, and the mapping is not obvious.
Whether the crank can turn all the way round. This is Grashof’s condition, and it depends on the four lengths in a way that has nothing to do with which one is driven. It gets its own essay, and the short version is that the shortest and longest links together must not exceed the other two.
How much of a full turn is available if it cannot. A non-Grashof linkage rocks: there are crank angles at which the bars would have to change length, and the solver simply refuses them. For one such linkage, 273 of 360 positions assemble and 87 do not, and finding that took no inspection of the lengths at all — the solver was asked, and declined.
How well force gets from input to output. The transmission angle, at B, between the coupler and the rocker. Near 90° the coupler pushes the rocker usefully; near 0° or 180° almost everything goes into the bearings. For the linkage above it runs from 54.3° to 100.3°, which is comfortable, and the design rule it satisfies is about geometry alone.
Where the mechanism has enormous mechanical advantage, and where it nearly jams. These are different configurations, which is not what the phrasing suggests.
What curve a point on the coupler traces. A sextic — degree six — and choosing the linkage that draws a wanted curve is the oldest hard problem in the subject.
Reading a mechanism figure
A four-bar has four parts and a reader who loses track of which is which has lost the argument, so the palette on this site gives them four fixed roles rather than four labels.
Orange is the input — the link being driven, the one the slider moves. Blue is the coupler, which carries the motion across and is attached to nothing fixed, so it both rotates and translates. Green is the output. Grey and hatched is the frame, and the dashed grey line between the two ground pivots is a link like any other: the ground is the fourth bar, which is why a four-bar has four bars and only three of them appear to be there.
That last point causes more confusion than it should. Counting the ground as a link is not a bookkeeping convention — it is what makes the mobility arithmetic come out right, and a chain of four bars that is not attached to a frame has three degrees of freedom rather than one, because it can also translate and rotate as a whole.
What happens at the ends of the travel
The rocker of a crank-rocker does not swing forever. It reaches a limit, stops, and comes back — and the position where it stops is worth understanding, because it is where several other things happen at once.
At the extreme, the crank and the coupler are momentarily in line: from O₂ the two of them form a single straight segment reaching to B. The rocker’s velocity passes through zero there, because the distance from O₂ to B is at a maximum or minimum and its derivative vanishes. That is a dead centre or toggle.
Two consequences follow and only one of them is usually mentioned. The output momentarily stops, so the ratio of output speed to input speed is zero — and its reciprocal, which is the mechanical advantage, diverges. A toggle is where a four-bar can exert enormous force, which is why a knee-joint clamp holds with almost no effort at exactly that position. It is also where the mechanism cannot be driven backwards: pushing on the output at a toggle does nothing at all, which is why over-centre latches stay latched.
The four inversions
Fix a different bar to the bench and the same chain becomes a different mechanism. There are four choices and they are called the inversions.
Fix the ground link of the linkage above and it is a crank-rocker: continuous rotation in, oscillation out. Fix the link opposite and a different oscillation results. Fix one of the others and, for these lengths, both attached links rock rather than turning.
The chain is the same object in all four cases and the machine is not. This is worth stating because the classification of four-bars is usually presented as a property of the lengths, and it is a property of the lengths plus the choice of frame — Grashof’s condition names which link can rotate fully relative to which, and what that is worth depends on which one is bolted down.
The one with a slide
Replace one pin joint with a sliding one and the four-bar becomes a slider-crank, which is the mechanism in every reciprocating engine ever built.
The stroke being exactly twice the crank radius is worth pausing on, because it is the reason engine capacity is quoted from the crank throw and nothing else. The connecting rod’s length changes the shape of the motion completely and its extent not at all — and the shape it changes is not the sine wave everybody says it is.
What the model does not include
Everything on this page is geometry. There is no mass anywhere, no friction in the pins, no clearance, no elasticity in the bars.
That is a serious restriction and it is worth being exact about what survives it. Positions, velocities and accelerations are all fully determined by the geometry, so those numbers are as good as the model of an ideal pin joint. The transmission angle is a geometric quantity and it is exactly right. But whether a linkage will actually work — whether the pins will survive, whether it will rattle, whether it will hold position under load — depends on quantities this site does not compute, and no figure here is a strength calculation.
The other restriction is that everything is planar. A spatial four-bar exists, obeys the same principles, and counts its degrees of freedom differently; none is here yet.
Why this one and not another
A four-bar is not the only mechanism, and it is the one to understand first for a reason that goes beyond it being small.
Every planar mechanism with one degree of freedom is built from chains whose mobility is one, and the four-bar is the simplest such chain. A six-bar is two four-bars sharing links; a slider-crank is a four-bar with a joint changed; a Peaucellier cell is eight links arranged so that a four-bar-like relation holds exactly. Learning what the four lengths do is learning the vocabulary the rest of the subject is written in.
And it is the mechanism where the difference between drawing and solving is most visible, because the constraint that a drawing violates — the coupler’s length — is a single number that anybody can check.
Why the constraint is written as a squared length
A small implementation choice with consequences worth spelling out.
The obvious way to say that a link has constant length is to write the distance between its two pins and set it equal to that length. The way it is written here is the square of the distance minus the square of the length.
The two are equivalent as conditions and not as functions to hand to a solver. The square root has an infinite derivative at zero and is undefined for negative arguments, which a Newton step can easily reach. The squared form is a polynomial: smooth everywhere, defined everywhere, with a Jacobian entry that is a difference of coordinates rather than a quotient by a distance that might be nearly zero.
The Jacobian is where the benefit is largest. The derivative of the squared constraint with respect to a coordinate is twice a coordinate difference — four short expressions per bar, exact, with no division. Nothing cancels badly, nothing blows up when a link happens to be short, and the analytic Jacobian is straightforward enough to be trusted, which matters because everything downstream depends on it.
The cost is that the residual is in units of length squared, so a tolerance on it is a tolerance on an area. That is dealt with by choosing the tolerance with the scale in mind and solving to twelve orders of magnitude below it, which makes the exact units of the tolerance a question that never has to be answered precisely.
The initial guess, and why it is not a detail
Newton’s method converges to a solution near where it starts, and a four-bar has two solutions. The starting point is therefore not a numerical convenience — it selects the branch, and the branch is a physical fact about how the mechanism was assembled.
That has a practical consequence for sweeping. Solving each configuration from the previous solved one keeps the mechanism on the branch it started on, which is what a real mechanism does; solving each from a fixed guess would let it jump branches mid-sweep, which produces a plot with a discontinuity in it and no mechanism that behaves that way.
It also produced one of this site’s more instructive bugs. A helper that finds a mechanism’s working range left the mechanism in a failed solve state when it returned, so the next sweep inherited nonsense as its starting point and assembled nowhere. The fix was to save a known-good configuration and restore it, which is obvious afterwards and was invisible beforehand: the failure appeared in a different function from the one that caused it.
Near a change point the branch selection stops being reliable at all, because the two solutions coincide and the previous configuration is equally close to both. That is not something a better initial guess fixes — it is the mechanism genuinely having two futures, and the honest response is for the figure to say so.
What a four-bar is doing in a modern machine
The four-bar has a reputation as the mechanism of the steam age, and it is in more current products than almost any other.
Vehicle suspensions are four-bars in section: the double-wishbone layout is a four-bar whose coupler carries the wheel, and the camber curve through the travel is a coupler curve chosen deliberately. Bicycle rear suspensions are four-bars, tuned so that the instantaneous centre sits where the designer wants the pedalling forces to act.
Aircraft landing gear retraction is a four-bar arranged to be near its toggle position when extended, so that the gear cannot be folded by the landing load no matter how large it is. Toggle clamps work the same way. So do folding chairs, pop-up bins, and every mechanism where the requirement is that a modest input force produces a lock rather than a motion.
What changed is not the mechanism but the design method. The atlases of coupler curves have been replaced by optimisation, so the proportions are now chosen against a numerical objective rather than by finding a printed curve that looks close. The mechanism being optimised is the same one Watt was proportioning by eye.