Stiffness Matrix Calculator

Assemble the stiffness matrix of a bar, truss element or two-spring system and solve for the displacements and reactions under load.

🔩 Stiffness Matrix Calculator
Young's modulus (E)
Cross-section area (A)
Length (L)
Angle from +x axis (θ)
deg
Axial force at node 2 (P, optional)
kN
Spring stiffness unit
k1 (wall to node 1)
k2 (node 1 to node 2)
k3 (node 2 to wall)
Load unit
Load F1 on node 1
Load F2 on node 2
Element stiffness k = EA/L
—
Stiffness (N/m)
—
cos θ, sin θ
—
Elongation δ = P/k
—
Stress P/A
—
Strain
—
Strain energy
—
Node 2 shift in x
—
Node 2 shift in y
—

Displacement u1
—
Displacement u2
—
Determinant of K
—
Left wall reaction
—
Right wall reaction
—
Spring forces k1, k2, k3
—
Equilibrium check
—

🔩 What is a Stiffness Matrix?

A stiffness matrix collects the stiffness of a structure or a part of it into one table of numbers that links forces to displacements. For a structure with several degrees of freedom the relation is K u = F, where u lists the node displacements, F lists the forces applied at those nodes, and K is the stiffness matrix. Entry Kij is the force needed at degree of freedom i to cause a unit displacement at degree of freedom j while all other displacements are held at zero. This idea is the foundation of the direct stiffness method, the most common way to implement the finite element method, in which element matrices are assembled into one global matrix and solved with the boundary conditions applied.

The two simplest cases are covered here. A 2-node bar or truss element carries only axial force. Its stiffness is k = EA/L, with E the Young's modulus, A the cross-section area and L the length. In its own axis the matrix is k [[1, -1], [-1, 1]]. Rotated to an angle θ in the plane it becomes a symmetric 4 x 4 matrix with entries k times cos squared, sin squared and sin times cos. A 2-DOF spring system, a wall, two nodes and up to three springs, is the classic first example of assembly, with K = [[k1 + k2, -k2], [-k2, k2 + k3]]. These are the building blocks of larger truss, frame and spring-mass models, and they show every step of the method with numbers small enough to follow by hand.

A few facts are worth remembering. An element matrix on its own is singular: it has zero determinant because the element can translate as a rigid body without storing strain energy, so you must fix at least one node before solving. The matrix is symmetric, which follows from the reciprocity of linear elastic systems, and each row sums to zero. The matrix also depends only on geometry and material, not on the loads, so one matrix serves every load case. Finally, a bar element ignores bending. For beams and frames you need elements with rotational degrees of freedom and a larger matrix.

This calculator has two modes. Bar or truss element builds the local and global matrices from E, A, L and the angle, and with an optional axial force gives the elongation, stress, strain, strain energy and the node shift. Spring system assembles K, solves K u = F, and reports the displacements, wall reactions, spring forces and an equilibrium check. Both modes show their matrices in tables and have a chart.

📐 Formula

k  =  E A ÷ L,    K u  =  F
k = axial stiffness of the bar (N/m). E = Young's modulus, A = cross-section area, L = length
Local matrix: k [ [1, −1], [−1, 1] ] for the end displacements u1, u2 along the axis
Global matrix (DOF order u1, v1, u2, v2): k times [ c², cs, −c², −cs ; cs, s², −cs, −s² ; −c², −cs, c², cs ; −cs, −s², cs, s² ], with c = cos θ and s = sin θ
Bar response: δ = P / k = P L / (E A), stress σ = P / A, strain ε = σ / E, strain energy U = ½ P δ
Spring system: K = [ [k1 + k2, −k2], [−k2, k2 + k3] ], with det K = k1k2 + k1k3 + k2k3
Displacements: u1 = ( F1(k2 + k3) + k2F2 ) / det K and u2 = ( k2F1 + (k1 + k2)F2 ) / det K
Reactions: Rleft = −k1u1 and Rright = −k3u2. Spring forces are k1u1, k2(u2 − u1) and −k3u2 (tension positive)
Example: E = 200 GPa, A = 500 mm², L = 2 m gives k = 5e7 N/m = 50,000 kN/m

📖 How to Use This Calculator

Steps

1
Choose a model. Pick Bar or truss element for one element matrix, or Spring system to assemble and solve a two-degree-of-freedom spring chain.
2
Enter the properties. For a bar, type E, area and length with their units, the angle from the +x axis, and an optional axial force in kN. For springs, choose the stiffness and load units, then type k1, k2, k3 (0 leaves node 2 free) and the loads F1 and F2. The units only describe the number you type.
3
Read the matrices and results. The tables show the local and global matrices or the assembled K and the spring forces. The panel gives the elongation and stress, or the displacements and reactions, and the chart shows how the answer depends on angle or stiffness.

💡 Example Calculations

Example 1 — Horizontal Steel Bar

E = 200 GPa, A = 500 mm², L = 2 m, θ = 0°, P = 50 kN

1
k = E A / L = 200e9 × 5e-4 / 2 = 5e7 N/m = 50,000 kN/m
2
At 0° cos θ = 1 and sin θ = 0, so the global matrix has only K11 = K33 = 50,000 and K13 = K31 = −50,000 kN/m. Every y entry is 0.
3
δ = P / k = 50,000 / 5e7 = 1.000 mm, stress = 50,000 / 5e-4 = 100.0 MPa, strain = 100e6 / 200e9 = 500.0 µε and strain energy = ½ × 50,000 × 0.001 = 25.00 J
k = 50,000 kN/m, elongation = 1.000 mm
Try this example →

Example 2 — Aluminium Diagonal at 45 Degrees

E = 70 GPa, A = 300 mm², L = 1.5 m, θ = 45°, P = 20 kN

1
k = 70e9 × 3e-4 / 1.5 = 1.4e7 N/m = 14,000 kN/m
2
cos 45° = sin 45° = 0.7071, so c² = s² = cs = 0.5 and every global entry has magnitude 7,000 kN/m
3
δ = 20,000 / 1.4e7 = 1.429 mm along the bar, which is a shift of 1.429 × 0.7071 = 1.010 mm in both x and y. Stress is 66.67 MPa and strain 952.4 µε.
k = 14,000 kN/m, K11 = 7,000 kN/m, δ = 1.429 mm
Try this example →

Example 3 — Vertical Timber Post

E = 10 GPa, A = 10,000 mm² (100 mm by 100 mm), L = 3 m, θ = 90°, P = 30 kN

1
k = 10e9 × 0.01 / 3 = 3.333e7 N/m = 33,330 kN/m
2
At 90° cos θ = 0 and sin θ = 1, so only the y entries are nonzero: K22 = K44 = 33,330 and K24 = −33,330 kN/m
3
δ = 30,000 / 3.333e7 = 0.9000 mm, entirely in y. Stress = 3.000 MPa and strain = 300.0 µε. The material values are typical round numbers for softwood, not a design value.
k = 33,330 kN/m, δ = 0.9000 mm
Try this example →

Example 4 — Two Springs in Series with a Free End

k1 = 200 N/mm, k2 = 100 N/mm, k3 = 0, F1 = 500 N, F2 = 1000 N

1
K = [[300, −100], [−100, 100]] N/mm and det K = 200 × 100 = 20,000 (N/mm)²
2
u1 = (500 × 100 + 100 × 1000) / 20,000 = 7.500 mm and u2 = (100 × 500 + 300 × 1000) / 20,000 = 17.50 mm
3
The left wall reaction is −200 × 7.5 = −1,500 N, equal and opposite to the 1,500 N total load. Spring forces are 1,500 N in k1 and 1,000 N in k2.
u1 = 7.500 mm, u2 = 17.50 mm
Try this example →

Example 5 — Springs Fixed at Both Ends

k1 = 100 N/mm, k2 = 50 N/mm, k3 = 100 N/mm, F1 = 0, F2 = 600 N

1
K = [[150, −50], [−50, 150]] N/mm and det K = 5,000 + 10,000 + 5,000 = 20,000 (N/mm)²
2
u1 = (50 × 600) / 20,000 = 1.500 mm and u2 = (150 × 600) / 20,000 = 4.500 mm
3
Reactions are −100 × 1.5 = −150 N on the left and −100 × 4.5 = −450 N on the right. Their sum, −600 N, balances the 600 N load.
u1 = 1.500 mm, u2 = 4.500 mm, reactions −150 N and −450 N
Try this example →

Example 6 — Loading Only Node 1 (Node 2 Follows)

k1 = 40 kN/m, k2 = 60 kN/m, k3 = 0, F1 = 2 kN, F2 = 0

1
det K = 40 × 60 = 2,400 (kN/m)², so u1 = 2 × 60 / 2,400 = 0.05 m = 50.00 mm
2
u2 = 60 × 2 / 2,400 = 0.05 m = 50.00 mm. Node 2 carries no load and k3 = 0, so spring 2 does not stretch.
3
The spring forces are 2.000 kN in k1 and 0 in k2. The left wall reaction is −2.000 kN.
u1 = 50.00 mm, u2 = 50.00 mm
Try this example →

❓ Frequently Asked Questions

What is the stiffness matrix of a 2-node bar element?+
In local coordinates it is k [[1, -1], [-1, 1]] with k = EA/L, where E is Young's modulus, A the cross-section area and L the length. It relates the axial end forces to the axial end displacements. A steel bar with E = 200 GPa, A = 500 mm2 and L = 2 m has k = 50,000 kN/m.
How do you get the global stiffness matrix of a truss element?+
Rotate the local matrix by the element angle. With c = cos(theta) and s = sin(theta) the 4 x 4 global matrix is (EA/L) times [c2, cs, -c2, -cs; cs, s2, -cs, -s2; -c2, -cs, c2, cs; -cs, -s2, cs, s2]. At 45 degrees every entry has magnitude k/2.
Why is the element stiffness matrix singular?+
An unsupported element can move as a rigid body without storing any strain energy, so its stiffness matrix has zero determinant and no unique solution. You need boundary conditions, such as fixing one node, before you can solve K u = F.
What is the stiffness matrix of a two spring system?+
For a wall, spring k1, node 1, spring k2, node 2 and an optional spring k3 to a second wall, K = [[k1 + k2, -k2], [-k2, k2 + k3]]. With k3 = 0 node 2 is free. The determinant is k1 k2 + k1 k3 + k2 k3.
How do I solve for displacements from the stiffness matrix?+
Solve K u = F. For two degrees of freedom, u1 = (F1 (k2 + k3) + k2 F2) / det and u2 = (k2 F1 + (k1 + k2) F2) / det, with det = k1 k2 + k1 k3 + k2 k3. For k1 = 200, k2 = 100 N/mm, F1 = 500 N and F2 = 1000 N this gives 7.5 mm and 17.5 mm.
How do I find the support reactions?+
The reaction at a wall equals minus the spring stiffness times the node displacement, R = -k u. In the default example the left wall reaction is -1500 N, balancing the applied 500 N and 1000 N. The calculator checks that the forces sum to zero.
Why does node 2 move the same amount as node 1 when F2 is zero?+
If k3 = 0 and no load acts on node 2, spring 2 carries no force, so it does not stretch and node 2 simply follows node 1. With k1 = 40, k2 = 60 kN/m and F1 = 2 kN both nodes move 50 mm.
What is the difference between a truss element and a beam element?+
A truss (bar) element carries only axial force, so each node has two translations in 2D and the matrix is 4 x 4. A beam element also carries bending and shear and adds rotations, giving a 6 x 6 matrix. This calculator covers the bar and spring cases.
What units should I use for stiffness?+
Use the selectors. Young's modulus can be GPa or MPa, area mm2, cm2 or m2, length m or mm, spring stiffness N/m, N/mm or kN/m, and loads N or kN. The selectors only tell the calculator how to read your number, and they never change what you typed.
How does the angle change the stiffness matrix?+
The axial stiffness k does not change, but how it spreads across the x and y degrees of freedom does. A horizontal element has only K11 = k, a vertical element only K22 = k, and at 45 degrees K11, K22 and K12 all have magnitude k/2.
How do I get the elongation of a bar from its stiffness?+
Divide the axial force by the stiffness, delta = P / k = P L / (E A). A 50 kN force on the 50,000 kN/m steel bar gives 1.000 mm, a stress of 100 MPa and a strain of 500 microstrain.

What is the stiffness matrix of a 2-node bar element?

In local coordinates it is k [[1, -1], [-1, 1]] with k = EA/L, where E is Young's modulus, A the cross-section area and L the length. It relates the axial end forces to the axial end displacements. A steel bar with E = 200 GPa, A = 500 mm2 and L = 2 m has k = 50,000 kN/m.

How do you get the global stiffness matrix of a truss element?

Rotate the local matrix by the element angle. With c = cos(theta) and s = sin(theta) the 4 x 4 global matrix is (EA/L) times [c2, cs, -c2, -cs; cs, s2, -cs, -s2; -c2, -cs, c2, cs; -cs, -s2, cs, s2]. At 45 degrees every entry has magnitude k/2.

Why is the element stiffness matrix singular?

An unsupported element can move as a rigid body without storing any strain energy, so its stiffness matrix has zero determinant and no unique solution. You need boundary conditions, such as fixing one node, before you can solve K u = F.

What is the stiffness matrix of a two spring system?

For a wall, spring k1, node 1, spring k2, node 2 and an optional spring k3 to a second wall, K = [[k1 + k2, -k2], [-k2, k2 + k3]]. With k3 = 0 node 2 is free. The determinant is k1 k2 + k1 k3 + k2 k3.

How do I solve for displacements from the stiffness matrix?

Solve K u = F. For two degrees of freedom, u1 = (F1 (k2 + k3) + k2 F2) / det and u2 = (k2 F1 + (k1 + k2) F2) / det, with det = k1 k2 + k1 k3 + k2 k3. For k1 = 200, k2 = 100 N/mm, F1 = 500 N and F2 = 1000 N this gives 7.5 mm and 17.5 mm.

How do I find the support reactions?

Reaction at a wall equals minus the spring stiffness times the node displacement, R = -k u. In the default example the left wall reaction is -1500 N, balancing the applied 500 N and 1000 N. The calculator checks that the forces sum to zero.

Why does node 2 move the same amount as node 1 when F2 is zero?

If k3 = 0 and no load acts on node 2, spring 2 carries no force, so it does not stretch and node 2 simply follows node 1. With k1 = 40, k2 = 60 kN/m and F1 = 2 kN both nodes move 50 mm.

What is the difference between a truss element and a beam element?

A truss (bar) element carries only axial force, so each node has two translations in 2D and the matrix is 4 x 4. A beam element also carries bending and shear and adds rotations, giving a 6 x 6 matrix. This calculator covers the bar and spring cases.

What units should I use for stiffness?

Use the selectors. Young's modulus can be GPa or MPa, area mm2, cm2 or m2, length m or mm, spring stiffness N/m, N/mm or kN/m, and loads N or kN. The selectors only tell the calculator how to read your number, and they never change what you typed.

How does the angle change the stiffness matrix?

The axial stiffness k does not change, but how it spreads across the x and y degrees of freedom does. A horizontal element has only K11 = k, a vertical element only K22 = k, and at 45 degrees K11, K22 and K12 all have magnitude k/2.

How do I get the elongation of a bar from its stiffness?

Divide the axial force by the stiffness, delta = P / k = P L / (E A). A 50 kN force on the 50,000 kN/m steel bar gives 1.000 mm, a stress of 100 MPa and a strain of 500 microstrain.