14.2: Well-Determined Fully Specified System
- Page ID
- 122656
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Finding the Solution of a Well-Determined, Fully Specified Nth-Order Linear System in Python
A linear system of equations is a set of n linear equations with n unknown variables. A system is considered well-determined and fully specified if it has exactly one unique solution. This typically means:
- Number of Equations = Number of Variables: There are as many independent equations as there are unknown variables.
- Non-Singular Coefficient Matrix: The determinant of the coefficient matrix is non-zero. If the determinant is zero, the matrix is singular, and the system either has no solutions or infinitely many solutions.
General Form
An n-th order linear system can be represented in matrix form as:
\[Ax = b\]
Where:
- \(A\) is the \(n \times n\) coefficient matrix containing the coefficients of the variables.
- \(x\) is the \(n \times 1\) variable vector containing the unknown variables \(\left (x_1,x_2,…,x_n \right ) \).
- \(b\) is the \(n \times 1\) constant vector containing the constants on the right-hand side of the equations.
For example, a 3rd order system would look like:
\[ \begin{align}
\begin{split}
a_{11} x_1 + a_{12} x_2 + a_{13} x_3 & = b_1 \\
a_{21} x_1 + a_{22} x_2 + a_{23} x_3 & = b_2 \\
a_{31} x_1 + a_{32} x_2 + a_{33} x_3 & = b_3
\end{split}
\end{align} \]
In matrix form:
\[ \begin{bmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} b_1 \\ b_2 \\ b_3 \end{bmatrix} \]
Solving in Python with NumPy
Python's NumPy library provides highly optimized functions for numerical operations, including solving linear systems. The most straightforward and recommended method is using numpy.linalg.solve(). This function efficiently computes the solution x for the equation \(Ax = b\).
Why numpy.linalg.solve?
- Efficiency: It uses advanced numerical algorithms (like LU decomposition) that are much more efficient and numerically stable than explicitly calculating the inverse of A and multiplying it by b (i.e., \(x = A^{−1}b\) ), especially for large systems.
- Robustness: It handles various cases and provides error messages if the matrix is singular or ill-conditioned.
Steps to Solve:
- Import NumPy: Start by importing the numpy library.
- Define Coefficient Matrix (A): Create a NumPy array representing the coefficient matrix A.
- Define Constant Vector (b): Create a NumPy array representing the constant vector b.
- Solve the System: Use numpy.linalg.solve(A, b) to get the solution vector x.
- Interpret Results: The returned vector x contains the values of the unknown variables.
If the coefficient matrix A is singular (i.e., its determinant is zero), numpy.linalg.solve will raise a LinAlgError, indicating that the system does not have a unique solution.
A Well Determined Non-Singular System
A Well Determined Singular Valued System
Summary
A well-determined, fully specified nth-order linear system has a unique solution. In Python, the most efficient and robust way to solve such a system (represented as \(Ax=b\) ) is by using the numpy.linalg.solve() function from the NumPy library.
Here's a summary of the steps involved:
- Represent the System: Define the coefficient matrix A and constant vector b as NumPy arrays.
- Solve with numpy.linalg.solve(): Pass the coefficient matrix A and the constant vector b to np.linalg.solve(A, b). This function will return the solution vector x.
- Handle Errors: If the matrix A is singular (i.e., its determinant is zero, meaning no unique solution exists), numpy.linalg.solve() will raise a LinAlgError. It's good practice to wrap the call in a try-except block to gracefully handle this issue.
The NumPy linalg solve method is preferred over calculating the inverse of A explicitly \(x=A^{−1}b\) because numpy.linalg.solve() is more numerically stable and computationally efficient, especially for larger systems.


