When using the Finite Element Method, FEM, for solving partial differential equations, a system of linear equations is constructed. There may be known Dirichlet boundary values that are unknown values in the system of equations. The system may be reduced to a smaller system of equations using the following reduction. Given a system of linear equations A x = y with known matrix A, known vector y and needing to solve for vector x, if one of the values of x, say x4, is known then perform the following reduction: | A11 A12 A13 A14 | |x1| |y1| | A21 A22 A23 A24 | * |x2| = |y2| | A31 A32 A33 A34 | |x3| |y3| | A41 A42 A43 A44 | |x4| |y4| Because A x = y and knowing the value of x4 the first three rows become | A11 A12 A13 | |x1| |y1 - A14*x4| | A21 A22 A23 | * |x2| = |y2 - A24*x4| | A31 A32 A33 | |x3| |y3 - A34*x4| The fourth row is not needed since we know x4. Because the simultaneous linear equations may be written in any order, interchange rows so that the last row has the known x value. For n equations in n unknowns, the reduction is for i=1:n-1 y(i) = y(i) - A(i,n) * x(n) end n=n-1 More reductions may be performed if more values of x are known. x(n) is known when y(n) is known and A(n,n)=1.0 and A(n,j)=0.0 for j/=n thus use y(n) in place of x(n) in the above process.