Build an intuition for shape functions, the heart of the finite element method. Switch between linear 2-node and quadratic 3-node elements and move the natural coordinate ξ and the nodal values to see the interpolated field u(ξ), the partition of unity ΣN=1 and the field gradient du/dξ update in real time.
Parameters
Element type
Linear uses 2 nodes; quadratic adds a mid-node (3 nodes)
Natural coordinate ξ
Evaluation point inside the element (−1 to +1, dimensionless)
Node 1 value u₁
Physical quantity at the node ξ=−1
Node 2 value u₂
Physical quantity at the node ξ=+1
Node 3 value u₃
Value at the mid-node ξ=0 (used only by the quadratic element)
Results
—
Shape function N₁(ξ)
—
Shape function N₂(ξ)
—
Shape function N₃(ξ)
—
Interpolated value u(ξ)
—
ΣN (partition of unity)
—
Field gradient du/dξ
—
Shape function visualization — N_i(ξ) and evaluation point
Each coloured curve is a shape function N_i(ξ). The vertical line is the current evaluation point ξ, with dots where it crosses each curve. Node positions are ξ=−1, 0, +1.
The field u(ξ) inside an element is a linear combination of shape functions N_i(ξ) and nodal values u_i. The shape functions always sum to 1 (partition of unity).
$$N_1=\frac{1-\xi}{2},\quad N_2=\frac{1+\xi}{2}$$
Shape functions of the linear 2-node element. First-order in ξ, so the field inside the element is a straight line.
Shape functions of the quadratic 3-node element. Second-order in ξ (parabolas); adding the mid-node N₃ at ξ=0 lets the element represent curved distributions.
What are 1D shape functions?
🙋
I keep running into the term "shape function" in my finite element textbook. What exactly is it?
🎓
In short, it is the interpolation tool that fills in the inside of an element from its nodal values. The temperature or displacement of a continuum is really an infinite-degree-of-freedom function with a value everywhere, and a computer cannot handle that. So the finite element method keeps values only at the element corners (nodes) and interpolates between them with shape functions. The field inside an element is u(ξ) = ΣN_i·u_i — the nodal values blended with weights called shape functions.
🙋
So it's a blending ratio. How are those weights decided? When I set the element to "linear" on the left and move ξ, N₁ and N₂ cross as straight lines.
🎓
Nice observation. For a linear element the shape functions are first-order: N₁=(1−ξ)/2 and N₂=(1+ξ)/2. The key point is that each one equals 1 at its own node and 0 at the other. At ξ=−1 you get N₁=1, N₂=0, and at ξ=+1 it flips, right? That is the Kronecker-delta property. Thanks to it, plugging in the node-1 value gives u(−1) = u₁ exactly. Shape functions are built so they never betray the nodal values.
🙋
There is a "ΣN" result card that stays at 1.000 no matter how I move ξ. What does that mean?
🎓
That is the partition of unity, one of the most important properties of shape functions. The shape functions sum to 1 everywhere inside the element. With that property, if you put the same value c at every node, u = c·ΣN = c, so the element reproduces a constant field perfectly. Physically it means the element can represent a rigid-body translation with zero strain. If you build an element whose ΣN drifts away from 1, a simple translation produces fake strain and the solution never converges.
🙋
When I switch the element to "quadratic" the shape functions become parabolas. How do I choose between linear and quadratic?
🎓
A linear element is straight inside, so it can only represent a straight distribution. A quadratic element adds one mid-node to become second-order, so a single element can capture curved distributions and gradient changes. For beam bending or stress concentrations, quadratic elements reach the required accuracy with far fewer elements. In practical Ansys or Abaqus runs, quadratic elements (like Abaqus C3D20) are standard for stress analysis. But the node count and computation grow, so quadratic everywhere is not always the right call.
🙋
One last thing — why use a coordinate ξ from −1 to +1 instead of the physical coordinate x?
🎓
That is the natural coordinate, a trick for reusing the same formulas regardless of element length or position. A 10 mm element and a 100 mm element are both just −1 to +1 in ξ space. So one set of shape-function formulas covers everything, and numerical integration by Gauss quadrature can be standardized in ξ space. Interpolating both the coordinate x and the field u with the same shape functions is called the isoparametric element, and almost every modern FEM code uses it.
Frequently Asked Questions
Shape functions N_i(ξ) are weighting functions that interpolate a physical quantity at any point inside an element using only its nodal values. The field inside an element is written u(ξ) = ΣN_i(ξ)·u_i. Shape functions have the Kronecker-delta property — equal to 1 at their own node and 0 at every other node — so each u_i is exactly the value at node i. The finite element method uses shape functions to represent the unknown function of a continuum with a finite number of nodal values.
The property that the shape functions always sum to 1 at any point in the element is called the partition of unity. It guarantees the element can exactly reproduce a constant field (rigid-body translation). If all nodal values equal the same constant c, then u = c·ΣN_i = c, so the element represents that constant with zero strain. A shape-function set that violates the partition of unity generates spurious strain under rigid-body motion and gives a non-converging solution. This tool lets you confirm that ΣN equals 1.000 for any ξ.
A linear 2-node element uses only the two end nodes, and its shape functions are first-order in ξ, so the field inside the element is a straight line. A quadratic 3-node element adds a node in the middle, and its shape functions are second-order in ξ (parabolas). Quadratic elements capture curved distributions and gradient changes far better for the same number of elements, which helps with stress concentrations and bending problems. The trade-off is higher computational cost and more nodal degrees of freedom. Switching elements in this tool shows the shape functions changing from straight lines to parabolas.
The natural (non-dimensional) coordinate ξ is a reference coordinate always defined over the range −1 to +1, regardless of element shape or size. Writing shape functions in ξ instead of physical coordinate x lets the same formulas be reused for elements of different lengths. This is the core idea of isoparametric elements, which interpolate both the coordinate x and the field u with the same shape functions. Numerical integration (Gauss quadrature) is also performed in ξ space, which makes the implementation much simpler.
Real-World Applications
The core of structural solvers: Every commercial FEM code — Ansys, Abaqus, Nastran — assembles element stiffness matrices using shape functions. Element stiffness is computed as K = ∫BᵀDB dV, and the strain-displacement matrix B is the derivative of the shape functions themselves. In other words, the choice of shape functions directly determines an element's accuracy, convergence and range of applicability. Understanding shape functions is the first step toward the solver no longer being a black box.
Mesh quality and element-order choice: In practice you constantly face the trade-off "fine linear mesh or coarse quadratic mesh". For stress analysis, quadratic elements capture bending and stress gradients more accurately, so they are often more precise even at the same node count. Conversely, contact analysis and explicit crash analysis tend to favour linear elements. Feeling the difference in shape-function order makes the reason for this choice click into place.
Isoparametric elements and the Jacobian: Shape functions written in natural coordinate ξ are also used for the coordinate mapping x(ξ)=ΣN_i·x_i. Derivatives in physical coordinates are computed through the Jacobian dx/dξ, as in du/dx = (du/dξ)/(dx/dξ). The du/dξ this tool shows is the quantity that precedes that transformation. When a distorted element gives a negative or zero Jacobian the element breaks down, so this is also the theoretical basis for mesh-quality checks.
Beyond the finite element method: The idea of "interpolating nodal values with weighting functions" carries over to the NURBS basis of isogeometric analysis (IGA), the MLS approximation of meshfree methods, and the discontinuous Galerkin method in CFD. The partition-of-unity property is a design principle shared by all of them. Grasping the principle with simple 1D shape functions makes these advanced methods far easier to follow.
Common Misconceptions and Pitfalls
The most common oversight is forgetting that shape functions are interpolation formulas, not the solution itself. A shape function only defines the rule for "how to fill the element once the nodal values are set", and the nodal values u_i are obtained only by solving the system of equations Ku=f. The choice of shape functions affects the accuracy of the solution, but staring at shape functions alone yields no physical answer. This tool lets you set the nodal values by hand to see only the interpolation behaviour; in a real FEM analysis the nodal values are the unknowns.
Next, assuming that raising the order always improves accuracy. Quadratic elements can represent curved distributions, but when the nodal values swing wildly or the load is highly localized, high-order shape functions can instead oscillate (overshoot). Quadratic elements also carry mid-nodes, making them sensitive to mesh mismatch and mid-node displacement. Often a properly refined mesh is more stable than a higher order, so element order and mesh density should be considered together.
Finally, dismissing ΣN=1 and ξ∈[−1,1] as trivial. If you build a shape function that violates the partition of unity, a mere rigid-body translation produces fake strain and the solution never converges. The natural coordinate must also stay within −1 to +1 inside the element; if the coordinate mapping breaks down and ξ goes out of range, the shape functions lose their meaning. The failure where a distorted element gives a negative Jacobian is exactly this state of "the correspondence between ξ space and physical space being broken". The plain, well-behaved properties of shape functions are what underpin the reliability of the finite element method.
How to Use
Set natural coordinate ξ between -1 and +1 using the xiNum slider to traverse the parent element domain.
Select nodal displacement values u₁, u₂, and u₃ (in mm) using the three displacement sliders; u₃ only activates in quadratic mode.
Observe real-time updates of shape functions N₁(ξ), N₂(ξ), N₃(ξ), their sum (partition of unity = 1.0), interpolated field u(ξ), and field gradient du/dξ.
Worked Example
For a linear 2-node element with u₁ = 5 mm and u₂ = -3 mm: at ξ = 0 (element midpoint), N₁(0) = 0.5 and N₂(0) = 0.5, yielding u(0) = 0.5(5) + 0.5(-3) = 1 mm. The gradient du/dξ = (u₂ − u₁)/2 = -4 mm remains constant. In quadratic mode with u₃ = 8 mm at ξ = 0: N₁ = 0, N₂ = 0.6, N₃ = 0.4, producing u(0) = 3.2 mm with parabolic interpolation.
Practical Notes
Partition of unity (ΣN = 1.0 everywhere) ensures rigid body modes are captured; deviation indicates implementation error.
Linear elements exhibit constant du/dξ; quadratic elements produce variable gradients reflecting nodal curvature.
In structural FEM, shape functions weight nodal displacements—aluminum cantilever (E = 70 GPa) requires quadratic elements for accurate stress distribution near fixed supports.