# Building a coefficient matrix for a system of equations

• I
• Hypatio
In summary, the system of equations is:M_1 = f_1+f_2+m_1+m_2M_7 = f_1+f_2+s_1+s_2M_13 = m_1+m_2+s_1+s_2M_18 = m_3+m_4+s_3+s_4
Hypatio
I want to solve the following system of equations

##M_{1} = f_1+f_2+m_1+m_2\ \ ;\ \ M_{7} = f_1+f_2+s_1+s_2\ \ ;\ \ M_{13} = m_1+m_2+s_1+s_2##
##M_{2} = f_1+f_3+m_1+m_3\ \ ;\ \ M_{8} = f_1+f_3+s_1+s_3\ \ ;\ \ M_{14} = m_1+m_3+s_1+s_3##
##M_{3} = f_1+f_4+m_1+m_4\ \ ;\ \ M_{9} = f_1+f_4+s_1+s_4\ \ ;\ \ M_{15} = m_1+m_4+s_1+s_4##
##M_{4} = f_2+f_3+m_2+m_3\ \ ;\ \ M_{10} = f_2+f_3+s_2+s_3\ \ ;\ \ M_{16} = m_2+m_3+s_2+s_3##
##M_{5} = f_2+f_4+m_2+m_4\ \ ;\ \ M_{11} = f_2+f_4+s_2+s_4\ \ ;\ \ M_{17} = m_2+m_4+s_2+s_4##
##M_{6} = f_3+f_4+m_3+m_4\ \ ;\ \ M_{12} = f_3+f_4+s_3+s_4\ \ ;\ \ M_{18} = m_3+m_4+s_3+s_4##

where the 18 M coefficients are known and the 12 f, m, and s coefficients are unknown.

The strategy I want to use is to build a coefficient matrix and solve by inversion, but how can I do this for this system with minimal algebraic manipulation? For example, it is easy to see that at least 6 expressions for each unknown coefficient can be written. Perhaps this could result in a (6*12) by (6*12) coefficient matrix, but I'm unsure what it would look like, or if I am thinking about this correctly.

So, how do I arrange the coefficients so that
##f_1=M_1-f_2-m_1-m_2##
and
##f_1=M_2-f_3-m_1-m_3##
etc. are both satisfied. I thought you could make them both separate variables, like ##f_{1a}## and ##f_{1b}## and then have another equation express that ##f_{1a}=f_{1b}##, but I can't recall how to do this.

Last edited:
Can't you simply combine equations? It won't be too bad. Reduce to a set of equations for the ##m_i## first.

I'll be interested in getting rid of superfluous information or simplifying things, but at the moment I just want to get a naive approach working because the solution follows straightforwardly from the equations. Also, I need to learn this..

I figured that the coefficient matrix doesn't need to be square, so maybe the system could look like:

$$\begin{bmatrix} 1 & 1 & & & 1 & 1 & & & & & & \\ 1 & & 1 & & 1 & & 1 & & & & & \\ 1 & & & 1 & 1 & & & 1 & & & & \\ & 1 & 1 & & & 1 & 1 & & & & & \\ & 1 & & 1 & & 1 & & 1 & & & & \\ & & 1 & 1 & & & 1 & 1 & & & & \\ 1 & 1 & & & & & & & 1 & 1 & & \\ 1 & & 1 & & & & & & 1 & & 1 & \\ 1 & & & 1 & & & & & 1 & & & 1\\ & 1 & 1 & & & & & & & 1 & 1 & \\ & 1 & & 1 & & & & & & 1 & & 1\\ & & 1 & 1 & & & & & & & 1 & 1\\ & & & & 1 & 1 & & & 1 & 1 & & \\ & & & & 1 & & 1 & & 1 & & 1 & \\ & & & & 1 & & & 1 & 1 & & & 1\\ & & & & & 1 & 1 & & & 1 & 1 & \\ & & & & & 1 & & 1 & & 1 & & 1\\ & & & & & & 1 & 1 & & & 1 & 1\\ \end{bmatrix} \begin{bmatrix} f_1\\ f_2\\ f_3\\ f_4\\ m_1\\ m_2\\ m_3\\ m_4\\ s_1\\ s_2\\ s_3\\ s_4 \end{bmatrix} = \begin{bmatrix} M_1\\ M_2\\ M_3\\ M_4\\ M_5\\ M_6\\ M_7\\ M_8\\ M_9\\ M_{10}\\ M_{11}\\ M_{12}\\ M_{13}\\ M_{14}\\ M_{15}\\ M_{16}\\ M_{17}\\ M_{18} \end{bmatrix}$$

Unfortunately, I solved an example with MATLAB backslash and the result is not correct. The solved unknowns do not return the M coefficients with the original equations. Also, vertically flipping the coefficient matrix and left hand side vector changes the solution, which should not happen because they are the same equations.

Last edited:
Doing row operations on that matrix is just the same as combining equations. Using the equations looks like a good option, as you can keep it simple. A 12x18 matrix is a bit unwieldy.

Hypatio said:
Unfortunately, I solved an example with MATLAB backslash and the result is not correct. The solved unknowns do not return the M coefficients with the original equations. Also, vertically flipping the coefficient matrix and left hand side vector changes the solution, which should not happen because they are the same equations.
You have 18 equations for 12 unknowns. In this case the backslash operator will find the least-squares solution, so if the equations are not consistent then the solution you get will not exactly solve them. Are your equations consistent?

jason

Paul Colby
By the way, one way to check for consistency is the following. If your matrix equation is ##\mathbf{A}x=b##, then you can look at the row-reduced form of the augmented matrix to see if any of the equations reduce to ##1=0##. In matlab,
>> M=[A, b]; %M is the augmented matrix
>> R = rref(M) %R is the row-reduced echelon form of M

jason

Hypatio seems almost there. If this is an algebraic problem (and Hypatio, not for the first time, does not fully inform us) I would change the unknowns to more meaningful ones e.g ##a_{i}=f_{i}+m_{i}##, i = 1, 2, 3, 4.
Then the first column of equations is 6 equations in 4 unknowns and you find you must have ##M_{5}-M_{6}=M_{1}-M_{2}## etc. or else this column is not consistent, has no solutions. And there should be a second test of that kind. Similarly you can test the second and third columns.

Assuming this OK, you have for the first column 4 equations in 4 unknowns, ##a_{i}##, fairly easy to solve as the matrices are full of zeroes. If the second and third columns are consistent equations with unique solution you do not have to solve them again, Just change names and numbers in your previous solutions.

It should then be possible to express solutions in terms of the original unknowns in an infinite number of ways, amongst which perhaps some are natural, depending on what the original problem was.

If instead this is not an algebraic question but a numerical analysis/statistical one where e.g. ##\left( M_{1}-M_{2}\right) -\left( M_{5}-M_{6}\right) ## is not exactly 0 but sufficiently small this would be above my pay grade, but I imagine you still do these things anyway.

And anyway (afterthought but should come first) the f, m, s can be isolated. Subtract the second column from the first and add the result to the third and we have a column of s (×2) alone, and we can get one for f and m too.

This problem begins to look so artificially inflated in apparent difficulty I think Hypatio should tell us where it comes from. And also relation with other problems he has brought.

Last edited:

## What is a coefficient matrix?

A coefficient matrix is a rectangular array of numbers that represents the coefficients of a system of linear equations. It is used to solve for the unknown variables in the system.

## How do you build a coefficient matrix for a system of equations?

To build a coefficient matrix, you first need to write out the equations in standard form, with all variables on the left side and constants on the right side. Then, the coefficients of each variable in each equation are placed in a row of the matrix.

## What is the purpose of a coefficient matrix?

The purpose of a coefficient matrix is to simplify the process of solving a system of equations. It allows for a more organized and systematic approach to finding the values of the unknown variables.

## How do you use a coefficient matrix to solve a system of equations?

To solve a system of equations using a coefficient matrix, you can use various methods such as Gaussian elimination, Cramer's rule, or matrix inversion. These methods involve manipulating the matrix to reduce it to a form that makes it easier to solve for the unknown variables.

## Can a coefficient matrix have a determinant of zero?

Yes, a coefficient matrix can have a determinant of zero. This means that the system of equations has no unique solution and may have either infinitely many solutions or no solutions at all.

• Introductory Physics Homework Help
Replies
13
Views
1K
• Linear and Abstract Algebra
Replies
10
Views
3K
• Introductory Physics Homework Help
Replies
29
Views
1K
• Introductory Physics Homework Help
Replies
3
Views
4K
• Introductory Physics Homework Help
Replies
6
Views
2K
• Precalculus Mathematics Homework Help
Replies
1
Views
1K
• Introductory Physics Homework Help
Replies
3
Views
5K
• Introductory Physics Homework Help
Replies
14
Views
3K
• MATLAB, Maple, Mathematica, LaTeX
Replies
0
Views
2K
• Precalculus Mathematics Homework Help
Replies
2
Views
1K