Skip to content

Guide · Finite element method

Finite element stiffness matrix calculator

Where an element stiffness matrix comes from, how elements are assembled into a global system, and a two-element bar worked by hand and confirmed against the exact solution. The same steps drive every structural analysis program.

Quick answer. The finite element stiffness matrix of an element is \(\mathbf{k}=\int \mathbf{B}^{T}\mathbf{D}\,\mathbf{B}\,dV\), where \(\mathbf{B}\) turns nodal displacements into strains (it is built from the derivatives of the shape functions) and \(\mathbf{D}\) is the material stiffness. For a 1D bar with linear shape functions this gives \(\mathbf{k}=\frac{EA}{L}\begin{bmatrix}1&-1\\-1&1\end{bmatrix}\). Add the element matrices into a global matrix, apply the boundary conditions, solve \(\mathbf{K}\mathbf{u}=\mathbf{F}\), and recover strains and stresses element by element.

1. From shape functions to the element matrix

Inside a bar element of length \(L\) the axial displacement is interpolated between the two nodal values \(u_1\) and \(u_2\) with linear shape functions:

$$u(x)=N_1u_1+N_2u_2,\qquad N_1=1-\frac{x}{L},\qquad N_2=\frac{x}{L}.$$

The axial strain is the derivative, \(\varepsilon=du/dx=\mathbf{B}\mathbf{u}\) with \(\mathbf{B}=\begin{bmatrix}-1/L & 1/L\end{bmatrix}\), which is constant over the element. Because the material law is \(\sigma=E\varepsilon\), the stiffness matrix from the energy expression is

$$\mathbf{k}=\int_0^L \mathbf{B}^{T}\,EA\,\mathbf{B}\,dx=EA\,L\begin{bmatrix}-1/L\\ 1/L\end{bmatrix}\begin{bmatrix}-1/L & 1/L\end{bmatrix}=\frac{EA}{L}\begin{bmatrix}1 & -1\\ -1 & 1\end{bmatrix}.$$

This is exactly the axial member of a truss. The 2D and 3D truss matrices are this one rotated by the direction cosines, and the beam and frame matrices come from the same recipe with cubic (Hermite) shape functions for bending.

A bar made of two finite elements A bar fixed at the left end, divided into two elements by three nodes, with an axial load P at the right end. The nodal displacements u1, u2 and u3 are marked. P element 1element 2 node 1node 2node 3 u1 = 0u2u3 L1L2
A bar modelled with two elements and three nodes: fixed at node 1 and loaded axially at node 3.

2. Assembly and boundary conditions

Element 1 acts on nodes 1–2 and element 2 on nodes 2–3. Writing \(k_1=EA/L_1\) and \(k_2=EA/L_2\), the element matrices overlap at the shared node 2 and simply add:

$$\mathbf{K}=\begin{bmatrix}k_1 & -k_1 & 0\\ -k_1 & k_1+k_2 & -k_2\\ 0 & -k_2 & k_2\end{bmatrix},\qquad \mathbf{K}\mathbf{u}=\mathbf{F}.$$

Every node with a known displacement removes its row and column from the system (the boundary conditions), and the reduced system is solved for the rest. The removed rows are then used to compute the reactions.

3. Worked example: a two-element bar

A steel bar (\(E=200\) GPa, \(A=1000\ \mathrm{mm^2}\)) is divided into two elements of \(L=1\) m each. It is fixed at node 1 and loaded by \(P=10\) kN at node 3. Each element has \(EA/L=200\ \mathrm{MN/m}=2\times10^{5}\) kN/m, so

$$\mathbf{K}=2\times10^{5}\begin{bmatrix}1 & -1 & 0\\ -1 & 2 & -1\\ 0 & -1 & 1\end{bmatrix}\ \text{kN/m}.$$

With \(u_1=0\), delete the first row and column. The reduced system for the two free nodes is

$$2\times10^{5}\begin{bmatrix}2 & -1\\ -1 & 1\end{bmatrix}\begin{bmatrix}u_2\\ u_3\end{bmatrix}=\begin{bmatrix}0\\ 10\end{bmatrix}\ \Rightarrow\ u_2=5\times10^{-5}\ \text{m}=0.05\ \text{mm},\quad u_3=1\times10^{-4}\ \text{m}=0.10\ \text{mm}.$$

The reaction comes from the deleted first row: \(R_1=2\times10^{5}(u_1-u_2)=-10\) kN (the support pushes back against the load). Each element then gives its stress from \(\sigma=E\,\mathbf{B}\mathbf{u}=E\,(u_j-u_i)/L\).

Results for the two-element bar
QuantityFinite element resultExact solution
Displacement at node 20.05 mm\(u=Px/(EA)=0.05\) mm at \(x=1\) m
Displacement at node 30.10 mm\(0.10\) mm at \(x=2\) m
Reaction at node 1−10 kNequilibrium: \(R_1=-P\)
Axial force and stress, both elements10 kN, 10 MPa\(P/A=10\) kN / 1000 mm2

The finite element answer equals the exact one here because the true displacement field of a uniform bar is linear, which is exactly what the linear shape functions can represent. When the field is not linear (a varying section, a distributed load, or a beam), more or higher-order elements are needed, and the error shrinks as the mesh is refined. StiffStruct’s solver reproduces these numbers for this bar (0.05 mm, 0.10 mm, −10 kN) as a 2D truss with the bars along x and the vertical movement restrained.

4. Bigger structures are the same procedure

The Pratt bridge truss below has 12 nodes and 21 elements. It is assembled and solved with exactly the steps above: one element matrix per bar, added into a global matrix with two rows per node, with the support conditions removed. Only the bookkeeping grows.

Live result: a 21-element truss solved in your browser

Solving the example in your browser…

A Pratt bridge truss assembled from 21 bar elements, with its axial forces, deformed shape and reactions.

5. Common mistakes

See the stiffness matrices of a real structure

Open the Pratt truss with its element and global matrices, or build a small model of your own and compare it with the hand solution above.

Frequently asked questions

What is a stiffness matrix in the finite element method?

It is the matrix that relates the nodal displacements of an element (or of the whole structure) to the nodal forces: \(\mathbf{F}=\mathbf{K}\mathbf{u}\). Its entries are the forces needed to give one displacement of one degree of freedom while holding all the others at zero.

Why is the element stiffness matrix symmetric?

Because it comes from the strain energy, \(\tfrac12\mathbf{u}^{T}\mathbf{k}\mathbf{u}\), and the energy does not depend on the order in which the displacements are applied (Maxwell–Betti reciprocity).

How do you assemble the global stiffness matrix?

For each element, add its matrix entries into the global rows and columns that correspond to its nodes’ degrees of freedom. Entries that land on the same global position simply add, which is how neighbouring elements share a node.

Is the structural stiffness method the same as the finite element method?

For trusses, beams and frames, yes: the member matrices are exact element matrices, so the direct stiffness method is the finite element method applied to line elements. Continuum problems (plates, solids) use the same assembly with 2D and 3D elements.

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.