How do I solve a system of equations if the coefficient matrix is singular?

359 Views Asked by At

I am writing a program in MATLAB to analyze the internal forces of a truss. However, when I get to the point that it's time to use the equation $coeff*forces=loads$, I'm not able to use left division to solve because coeff (which is of size 2n by 2n where n is the amount of joints) is mostly zeros and is therefore singular. What would I do to get around this?

5

There are 5 best solutions below

1
On

If a square matrix $A$ is singular, then for almost all $b$ there is no solution to $Ax = b$, and when solutions do exist they are not unique. Are you sure your system has solutions? If it does have solutions, which one do you want?

0
On

I will rename your vectors and matrices to make the discussion easier: $ A = coeff$, $x = forces$, $b = loads$. Now, it is known that $A$ is singular (which has no relation to the amount of zeros inside the matrix, but more to the determinant of A. Hence, I suggest that you double-check you got A correctly)

Next, if indeed $\det(A) = 0$ then it is either you do not have a solution or have many solutions spanning a specific configuration of forces. For example, take: $ A = \begin{bmatrix} 2 & 1 \\ 4 & 2 \end{bmatrix}$. It has eigenvalues $\lambda = 0, 4 $ with eigenvectors $\begin{bmatrix} 1 \\ 2 \end{bmatrix}$ and $\begin{bmatrix} 1 \\ -2 \end{bmatrix}$ respectively.

This means that if the load is in the form: $ b= \begin{bmatrix} 0 \\ 0 \end{bmatrix}$ then any solution $ x = m \begin{bmatrix} 1 \\ -2 \end{bmatrix}$ with any $m$ is valid.

Also, if $b = 4n\begin{bmatrix} 1 \\ 2 \end{bmatrix} $ for any $n \neq 0$ then any $x = n\begin{bmatrix} 1 \\ 2 \end{bmatrix}$ will be a solution.

Other then these two cases, you will not have a solution at all.

To conclude, the solution will be obtained only through the eigenvectors and for that the loads must correspond. For more information, investigate the eigenvalue problem online. Also, these kind of solutions do not come out often in the context of mechanics so I will suggest you take a more careful look at the system you derived.

0
On

There is general criterion to know if a non-homogeneous linear system over a field $K$: $$Ax=b,\qquad A\in \mathcal M_{m\times n}(K),\;x,b\in K^n,$$ has solutions or not.

Let me recall first the set of solutions is either empty or an affine subspace of $K^n$. We may unify the presentation of results, considering the empty set is an affine subspace of negative dimension.

Consider the augmented matrix $[A\:b\,]$. Its rank is either $\operatorname{rank} A$ or $\operatorname{rank} A+1$.

Criterion :The linear sytem $\;Ax=b\;$ has solutions if and only if the matrix $A$ and the augmented matrix $[A\:b\,]$ have the same rank. Furthermore this rank is the codimension of the affine space of solutions.

0
On

If the coefficient matrix coeff is singular, there is either no solution to the system $coeff*forces=loads$ or infinitely many solutions. Specifically, in Matlab, if there is a solution, coeff \ loads will find the solution with smallest 2-norm, and adding to this any linear combination of the columns in null(coeff) will give also a valid solution.

However, as others noted, the fact that there is no unique solution suggests that you set up the truss problem wrong (by including duplicate constraints and missing some other ones). So in this context, you should go back and make sure you have the right set of equations.

0
On

Use the MATLAB backslash command \, Consider the equation $Ax=b$. Then compute $x$ by the following expression

x = A \ b

The obtained $x$ is a solution with minimum norm when the equation has many solutions.

When the equation has no solution, the MATLAB backslash command \ gives an $x$ with minimum residual $\|Ax - b\|_2$.