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}.$$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 | L (m) | c | s | EA/L (kN/m) |
|---|---|---|---|---|
| A–D | 3.464 | 0.500 | −0.866 | 57 735 |
| B–D | 3.000 | 0.000 | −1.000 | 66 667 |
| C–D | 3.464 | −0.500 | −0.866 | 57 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:
| Quantity | Value | Check |
|---|---|---|
| Vertical displacement of D | 0.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 kN | equals 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.
Solving the example in your browser…
4. Common mistakes
- A singular matrix. The truss is a mechanism or is not supported enough: a 2D truss needs at least three independent support reactions that prevent rigid-body motion, and every joint must be braced.
- Mixed units. Keep \(E\), \(A\) and \(L\) in one consistent system (here kN and m) before forming \(EA/L\).
- Wrong direction cosines. Always measure \(c\) and \(s\) from the first node to the second node of the same member, and use them in both the matrix and the force formula.
- Forgetting that members carry no bending. Truss members are pin-jointed, so loads must be applied at the joints; a load along a member needs a frame model instead.
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.