🔬
🔬 Science & engineering

Stiffness Matrix Calculator (2-D truss bar element, global 4×4 matrix)

Results update as you type.

Your numbers

Understanding the truss element stiffness matrix calculator — concept and principle

This calculator builds the 4×4 global stiffness matrix of a two-dimensional truss (bar) element from its Young's modulus, cross-section area and the coordinates of its two nodes. It is the basic building block of the direct stiffness method used in structural analysis courses and finite-element programs.

Truss element stiffness matrixA 3-4-5 bar as a springnode 1 (0,0)(3,4)L = 5 mEA/L = 40 kN/mmc = 0.6 · s = 0.814.419.2-14.4-19.219.225.6-19.2-25.6-14.4-19.214.419.2-19.2-25.619.225.6kN/mm · symmetric
The bar stiffness 40 kN/mm times c², cs and s² fills the 4×4 matrix.

How it is calculated

L = √((x₂ − x₁)² + (y₂ − y₁)²)

k = E × A ÷ L

c = (x₂ − x₁) ÷ L, s = (y₂ − y₁) ÷ L

K = k × [c², cs, −c², −cs; cs, s², −cs, −s²; −c², −cs, c², cs; −cs, −s², cs, s²]

The principle

A pin-jointed bar carries only axial force, so along its own axis it behaves like a spring with stiffness EA/L: stretch it by δ and it pulls back with EA·δ/L. The global matrix expresses that same spring in x–y coordinates. A node displacement in x or y stretches the bar only by its component along the bar, which is why the direction cosines c and s appear, and the resulting axial force is again split into x and y components. Multiplying these two projections gives the c², cs and s² terms. The matrix is symmetric, and each row sums to zero because moving the whole bar without stretching it creates no force.

Worked example

Default inputs: E = 200 GPa, A = 1,000 mm², node 1 at (0, 0), node 2 at (3, 4) m.

  1. L = √(3² + 4²) = 5 m; angle = atan2(4, 3) = 53.13°.
  2. c = 3 ÷ 5 = 0.6, s = 4 ÷ 5 = 0.8.
  3. k = 200×10⁹ Pa × 1×10⁻³ m² ÷ 5 m = 4×10⁷ N/m = 40 kN/mm.
  4. c²k = 0.36 × 40 = 14.4; csk = 0.48 × 40 = 19.2; s²k = 0.64 × 40 = 25.6.
  5. Row 1 = 14.4 19.2 −14.4 −19.2; Row 2 = 19.2 25.6 −19.2 −25.6; Row 3 = −14.4 −19.2 14.4 19.2; Row 4 = −19.2 −25.6 19.2 25.6.
How Axial stiffness EA/L (kN/mm) changes with Young's modulus E (GPa)How Axial stiffness EA/L changes with Yo…02040608050100150200250300400Example: 40Young's modulus E (GPa)
Each point is the calculator re-run with only “Young's modulus E (GPa)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Young's modulus E (GPa)Axial stiffness EA/L (kN/mm)
5010
10020
15030
20040
25050
30060
40080

How to read the result

Each entry Kij is the force at degree of freedom i caused by a unit displacement at degree of freedom j with all others held fixed. A horizontal bar has only c² terms; a vertical bar only s² terms. To analyse a whole truss, add each element's entries into a global matrix at the matching node degrees of freedom, apply supports, then solve K·u = F for the displacements.

Common mistakes

Keep in mind: This element assumes pinned joints, axial load only and linear elastic material. Real structural designs need checks for buckling and connections under local codes and review by a qualified engineer.

Frequently asked questions

Why is the stiffness matrix singular?

Without supports the bar can move or rotate as a rigid body with no force, so the system has no unique solution.

Does the node order change the matrix?

Reversing the nodes flips the signs of c and s, which leaves every product in the matrix unchanged.

How do I get the member force after solving?

Axial force = k × [c, s] · (u₂ − u₁), the stretch along the bar times EA/L.

Sources: Standard direct-stiffness method for a 2-D truss element, as presented in finite-element and structural-analysis textbooks

Checked 9 Nov 2026. Standard direct-stiffness method for a two-dimensional truss (bar) element: local stiffness EA/L transformed with the direction cosines c and s (as in finite-element and structural-analysis texts).

🔬 All science & engineering tools →🌍 Calculators by country →