Skip to content

Guide · 2D trusses

2D truss stiffness matrix solver

How the direct stiffness method turns a pin-jointed truss into one matrix equation, with every matrix of a three-bar truss written out and checked against a closed-form answer.

Quick answer. To solve a 2D truss by the stiffness method: (1) number the nodes and members, (2) build each member’s 4×4 stiffness matrix in global axes from its length and direction cosines, (3) add the member matrices into the global matrix K, (4) delete the rows and columns of supported degrees of freedom, (5) solve Kff uf = Ff for the joint displacements, and (6) get member forces from the displacements and the reactions from the remaining rows. StiffStruct does all six steps and shows you the matrices.

1. The element stiffness matrix

A truss member carries only axial force. For a member from node i to node j with Young’s modulus \(E\), cross-section area \(A\) and length \(L\), the axial stiffness is \(EA/L\). Written for the four joint displacements \((u_i, v_i, u_j, v_j)\) in global axes it is

$$\mathbf{k}=\frac{EA}{L}\begin{bmatrix} c^2 & cs & -c^2 & -cs\\ cs & s^2 & -cs & -s^2\\ -c^2 & -cs & c^2 & cs\\ -cs & -s^2 & cs & s^2 \end{bmatrix},\qquad c=\cos\theta=\frac{x_j-x_i}{L},\quad s=\sin\theta=\frac{y_j-y_i}{L}.$$
A truss member in global axes A member from node i to node j, inclined at angle theta to the global x axis, with length L and axial stiffness EA over L. xy ij θ L, EA c = cosθ, s = sinθ
A member in global axes: its direction cosines \(c\) and \(s\) are all the matrix needs besides \(EA/L\).

Every entry is a product of the direction cosines, so a member parallel to an axis has a very simple matrix: a horizontal member (\(c=1,\ s=0\)) stiffens only the horizontal degrees of freedom, and a vertical one only the vertical ones.

2. Assemble, apply supports, solve

Each member matrix is added into the global matrix at the rows and columns of its two nodes (two degrees of freedom per node), which enforces compatibility and joint equilibrium at once. With free (f) and supported (s) degrees of freedom the system is

$$\begin{bmatrix}\mathbf{K}_{ff} & \mathbf{K}_{fs}\\ \mathbf{K}_{sf} & \mathbf{K}_{ss}\end{bmatrix}\begin{bmatrix}\mathbf{u}_f\\ \mathbf{u}_s\end{bmatrix}=\begin{bmatrix}\mathbf{F}_f\\ \mathbf{F}_s+\mathbf{R}\end{bmatrix}.$$

For fixed supports \(\mathbf{u}_s=\mathbf{0}\), so the unknown displacements follow from \(\mathbf{K}_{ff}\mathbf{u}_f=\mathbf{F}_f\), the reactions from \(\mathbf{R}=\mathbf{K}_{sf}\mathbf{u}_f-\mathbf{F}_s\), and the axial force in each member from its own end displacements \(\mathbf{u}_e\) (tension positive):

$$N=\frac{EA}{L}\begin{bmatrix}-c & -s & c & s\end{bmatrix}\mathbf{u}_e .$$

3. Worked example: the three-bar truss

Three steel bars (\(E=200\) GPa, \(A=1000\ \mathrm{mm^2}=1.0\times10^{-3}\ \mathrm{m^2}\)) are pinned to a ceiling at A, B and C and meet at joint D, 3 m below the ceiling. The outer bars are inclined at \(\theta=30^\circ\) to the vertical and D carries a downward load \(P=100\) kN. The structure is statically indeterminate: equilibrium alone cannot share the load between the three bars.

Member data for the three-bar truss (direction from the support to joint D)
MemberL (m)csEA/L (kN/m)
A–D3.4640.500−0.86657 735
B–D3.0000.000−1.00066 667
C–D3.464−0.500−0.86657 735

The three supports are fixed, so the only free degrees of freedom are the two displacements of D. Only the lower-right 2×2 block of each member matrix reaches \(\mathbf{K}_{ff}\), and adding the three blocks (in kN/m) gives

$$\mathbf{K}_{ff}=\begin{bmatrix}14\,434 & -25\,000\\ -25\,000 & 43\,301\end{bmatrix}+\begin{bmatrix}0 & 0\\ 0 & 66\,667\end{bmatrix}+\begin{bmatrix}14\,434 & 25\,000\\ 25\,000 & 43\,301\end{bmatrix}=\begin{bmatrix}28\,868 & 0\\ 0 & 153\,269\end{bmatrix}.$$

The shear terms cancel because the truss is symmetric. With \(\mathbf{F}_f=(0,\,-100)\) kN the equations decouple:

$$u_D=0,\qquad v_D=\frac{-100}{153\,269}=-6.5245\times10^{-4}\ \text{m}=-0.652\ \text{mm}.$$

Substituting into \(N=\frac{EA}{L}(c\,u+s\,v)\) at joint D gives the member forces:

Results for the three-bar truss
QuantityValueCheck
Vertical displacement of D0.652 mm down\(\delta=F_{BD}\,h/(EA)\)
Force in B–D (tension)43.50 kN\(F_{BD}=P/(1+2\cos^3\theta)\)
Force in A–D and C–D (tension)32.62 kN\(F_{AD}=F_{BD}\cos^2\theta\)
Reactions at A and C (horizontal, vertical)A: −16.31, +28.25 kN
C: +16.31, +28.25 kN
vertical sum = 100.00 kN
Reaction at B (up)43.50 kNequals the bar force

The closed-form check comes from compatibility: all three bars must move D by the same vertical amount, which gives \(F_{BD}=P/(1+2\cos^3\theta)=100/(1+2\times0.6495)=43.50\) kN. The matrix method reaches the same numbers without ever being told about compatibility, which is why it is the method used in structural analysis software.

Live result: the three-bar truss solved in your browser

Solving the example in your browser…

The same truss, solved by the same solver as the calculator. Open it to see every matrix step by step.

4. Common mistakes

Solve this truss, or your own, in StiffStruct

Open the three-bar truss with its stiffness matrices, or draw a truss of your own and get the same step-by-step solution in your browser.

Frequently asked questions

What is the stiffness matrix of a truss element?

It is the 4×4 matrix \(\frac{EA}{L}\) times the matrix of direction-cosine products shown above. It relates the four joint displacements of one bar to the four joint forces it exerts, and it contains only the axial stiffness because a truss bar carries no bending.

Why is the global stiffness matrix singular?

Before supports are applied the matrix is always singular, because the truss can move as a rigid body. If it is still singular after the supports are applied, the structure is a mechanism: add a support or a bar until every joint is held in both directions.

How do I find member forces after solving?

Take each bar’s own end displacements from the solution, project them on the bar direction (\(c\) and \(s\)) to get the elongation, and multiply by \(EA/L\). A positive result is tension and a negative one is compression.

Can this method handle statically indeterminate trusses?

Yes, and that is its main advantage: the three-bar truss above is indeterminate and needs no extra compatibility equations, because compatibility is built into the displacement unknowns.

An educational tool: verify results independently before using them for design. All values on this page come from the same solver that powers the calculator.