Solve Linear Equations VI
- Updated2025-07-30
- 4 minute(s) read
Solves a linear system AX = Y. The data types you wire to the Input Matrix and Known Vector inputs determine the polymorphic instance to use.

Let A be an m-by-n matrix that represents the Input Matrix, Y be the set of m coefficients in Known Vector, and X be the set of n elements in Solution Vector that solves the system
AX = YWhen m > n, the system has more equations than unknowns, so it is an over-determined system. The solution that satisfies AX = Y might not exist, so the VI finds the least-square solution X, which minimizes ||AX – Y||.
When m < n, the system has more unknowns than equations, so it is an under-determined system. It may have infinite solutions that satisfy AX = Y. The VI finds one of these solutions.
In the case of m = n, if A is a nonsingular matrix—no row or column is a linear combination of any other row or column, respectively—then you can solve the system for X by decomposing the input matrix A into its lower and upper triangular matrices, L and U, such that
AX = LZ = Yand
Z = UXcan be an alternate representation of the original system. Notice that Z is also an n-element vector.
Triangular systems are easy to solve using recursive techniques. Consequently, when you obtain the L and U matrices from A, you can find Z from the LZ = Y system and X from the UX = Z system.
In the case of m ≠ n, A can be decomposed to an orthogonal matrix Q and an upper triangular matrix R, so that A = QR. The linear system then can be represented by QRX = Y. You then can solve RX = QTY.
You can easily solve this triangular system to get x using recursive techniques.
The numerical implementation of the matrix inversion is numerically intensive and, because of its recursive nature, is also highly sensitive to round-off error introduced by the floating-point numeric coprocessor. Although the computations use the maximum possible accuracy, the VI cannot always solve the system.
Solve Complex Linear Equations
Let A represent the m-by-n Input Matrix, Y represent the set of m elements in the Known Vector, and X represent the set of n elements in the Solution Vector that solves for the system
AX = YWhen m > n, the system has more equations than unknowns, so it is an over-determined system. Since the solution that satisfies AX = Y may not exist, the VI finds the least-square solution X, which minimizes ||AX – Y||.
When m < n, the system has more unknowns than equations, so it is an under-determined system. It might have infinite solutions that satisfy AX = Y. The VI then selects one of these solutions.
When m = n, if A is a nonsingular matrix—no row or column is a linear combination of any other row or column, respectively—then you can solve the system for X by decomposing the Input Matrix A into its lower and upper triangular matrices, L and U, such that
AX = LZ = Yand
Z = UXcan be an alternate representation of the original system. Notice that Z is also an n-element vector.
Triangular systems are easy to solve using recursive techniques. Consequently, when you obtain the L and U matrices from A, you can find Z from the LZ = Y system and X from the UX = Z system.
When m ≠ n, A can be decomposed to an orthogonal matrix Q, and an upper triangular matrix R, so that A = QR, and the linear system can be represented by QRX = Y. You then can solve RX = QHY. You can easily solve this triangular system to get X using recursive techniques.
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Mathematics\Linear Algebra\Linear Algebra Calculator.vi